diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-29 13:08:54 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-29 13:08:54 -0500 |
| commit | eb2fcf5731d8f6ee65371b6c220aefd81e7ec91f (patch) | |
| tree | 356203df607a5705afe9c0775365511eb6d8b965 /modules/prog-general.el | |
| parent | 8b231754bc06d2fbe184309d8328861f9e147a02 (diff) | |
| download | dotemacs-eb2fcf5731d8f6ee65371b6c220aefd81e7ec91f.tar.gz dotemacs-eb2fcf5731d8f6ee65371b6c220aefd81e7ec91f.zip | |
feat(dirvish): add file duplication with 'd' key, move deadgrep to 'D'
This commit adds a convenient file duplication function to dirvish and
reorganizes keybindings to avoid conflicts.
## Changes
**1. New function: cj/dirvish-duplicate-file (dirvish-config.el:150)**
Duplicates the file at point with "-copy" suffix before the extension:
- report.pdf → report-copy.pdf
- script.el → script-copy.el
- README → README-copy
Features:
- Prevents duplicating directories (files only)
- Checks if target exists and prompts to overwrite
- Refreshes buffer automatically after copying
- Shows clear message with old and new names
**2. Keybinding changes**
dirvish-config.el:
- Bound 'd' to cj/dirvish-duplicate-file (was dired-flag-file-deletion)
- Updated Commentary section to document new binding
prog-general.el:
- Moved cj/deadgrep-here from 'd' to 'D' (capital D)
- More mnemonic: D for Deadgrep
- Avoids conflict with new duplicate function
## Rationale
The 'd' key is prime real estate in file managers, and duplicating files
is a very common operation. The standard dired-flag-file-deletion is still
available via 'x' or the mark-and-delete workflow.
Deadgrep on 'D' is more discoverable (capital D for Deadgrep) and less
likely to be pressed accidentally.
## Usage
In dirvish, navigate to a file and press:
- 'd' - Duplicate file with "-copy" suffix
- 'D' - Search with deadgrep in current directory
Diffstat (limited to 'modules/prog-general.el')
| -rw-r--r-- | modules/prog-general.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/prog-general.el b/modules/prog-general.el index d8d9627d1..9929228d5 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -251,7 +251,7 @@ If no such file exists there, display a message." (deadgrep term dir)))) (with-eval-after-load 'dired - (keymap-set dired-mode-map "d" #'cj/deadgrep-here)) + (keymap-set dired-mode-map "D" #'cj/deadgrep-here)) ;; ---------------------------------- Snippets --------------------------------- |
