From 4f66093335e5a0d370cf43b3fc637c0795376334 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Tue, 3 Aug 2021 21:38:03 +0900 Subject: introduce edit command template to open a specifig line of a file --- pkg/config/config_default_platform.go | 3 ++- pkg/config/config_linux.go | 3 ++- pkg/config/config_windows.go | 3 ++- pkg/config/user_config.go | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'pkg/config') diff --git a/pkg/config/config_default_platform.go b/pkg/config/config_default_platform.go index fabdf8a88..cb6e338df 100644 --- a/pkg/config/config_default_platform.go +++ b/pkg/config/config_default_platform.go @@ -5,7 +5,8 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, + Editor: ``, + EditCommand: `{{editor}} {{filename}}`, OpenCommand: "open {{filename}}", OpenLinkCommand: "open {{link}}", } diff --git a/pkg/config/config_linux.go b/pkg/config/config_linux.go index 8399e0e47..1eed335f0 100644 --- a/pkg/config/config_linux.go +++ b/pkg/config/config_linux.go @@ -3,7 +3,8 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, + Editor: ``, + EditCommand: `{{editor}} {{filename}}`, OpenCommand: `sh -c "xdg-open {{filename}} >/dev/null"`, OpenLinkCommand: `sh -c "xdg-open {{link}} >/dev/null"`, } diff --git a/pkg/config/config_windows.go b/pkg/config/config_windows.go index f6780eb6b..1bc919848 100644 --- a/pkg/config/config_windows.go +++ b/pkg/config/config_windows.go @@ -3,7 +3,8 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, + Editor: ``, + EditCommand: `{{editor}} {{filename}}`, OpenCommand: `cmd /c "start "" {{filename}}"`, OpenLinkCommand: `cmd /c "start "" {{link}}"`, } diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 38259f6f2..ea079948e 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -252,7 +252,10 @@ type KeybindingSubmodulesConfig struct { // OSConfig contains config on the level of the os type OSConfig struct { - // EditCommand is the command for editing a file + // Editor is the command for editing a file + Editor string `yaml:"editor,omitempty"` + + // EditCommand is the command template for editing a file EditCommand string `yaml:"editCommand,omitempty"` // OpenCommand is the command for opening a file -- cgit v1.2.3