Skip to content

Commit aab8d24

Browse files
authored
Merge pull request #510 from wassup05/clipboard-pwd
feat: hotkey for copying PWD to clipboard
2 parents ecfdff8 + e513432 commit aab8d24

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

src/internal/config_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ type HotkeysType struct {
189189
OpenCommandLine []string `toml:"open_command_line"`
190190

191191
CopyPath []string `toml:"copy_path"`
192+
CopyPWD []string `toml:"copy_present_working_directory"`
192193

193194
ToggleFooter []string `toml:"toggle_footer"`
194195

src/internal/handle_file_operations.go

+7
Original file line numberDiff line numberDiff line change
@@ -631,3 +631,10 @@ func (m model) copyPath() {
631631
outPutLog("Copy path error", panel.element[panel.cursor].location, err)
632632
}
633633
}
634+
635+
func (m model) copyPWD() {
636+
panel := m.fileModel.filePanels[m.filePanelFocusIndex]
637+
if err := clipboard.WriteAll(panel.location); err != nil {
638+
outPutLog("Copy present working directory error", panel.location, err)
639+
}
640+
}

src/internal/key_function.go

+2
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ func (m *model) normalAndBrowserModeKey(msg string) {
186186
m.searchBarFocus()
187187
case containsKey(msg, hotkeys.CopyPath):
188188
m.copyPath()
189+
case containsKey(msg, hotkeys.CopyPWD):
190+
m.copyPWD()
189191
}
190192
}
191193

src/superfile_config/hotkeys.toml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ change_panel_mode = ['v', '']
4040
open_help_menu = ['?', '']
4141
open_command_line = [':', '']
4242
copy_path = ['ctrl+p', '']
43+
copy_present_working_directory = ['c', '']
4344
toggle_footer = ['F', '']
4445
# =================================================================================================
4546
# Typing hotkeys (can conflict with all hotkeys)

src/superfile_config/vimHotkeys.toml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ change_panel_mode = ['m', '']
4242
open_help_menu = ['?', '']
4343
open_command_line = [':', '']
4444
copy_path = ['Y', '']
45+
copy_present_working_directory = ['c', '']
4546
toggle_footer = ['ctrl+f', '']
4647
# =================================================================================================
4748
# Typing hotkeys (can conflict with all hotkeys)

0 commit comments

Comments
 (0)