Add support for kakoune editor
This commit is contained in:
parent
069e672a5c
commit
aa0a8d079b
@ -50,9 +50,9 @@ runEditor mpos f = editFileAtPositionCommand mpos f >>= runCommand >>= waitForPr
|
|||||||
-- @
|
-- @
|
||||||
-- EDITOR program is: LINE/COL specified ? Command should be:
|
-- EDITOR program is: LINE/COL specified ? Command should be:
|
||||||
-- ------------------ -------------------- -----------------------------------
|
-- ------------------ -------------------- -----------------------------------
|
||||||
-- emacs, emacsclient LINE COL emacs +LINE:COL FILE
|
-- emacs LINE COL EDITOR +LINE:COL FILE
|
||||||
-- LINE emacs +LINE FILE
|
-- emacsclient LINE EDITOR +LINE FILE
|
||||||
-- emacs FILE
|
-- kak EDITOR FILE
|
||||||
--
|
--
|
||||||
-- nano LINE COL nano +LINE,COL FILE
|
-- nano LINE COL nano +LINE,COL FILE
|
||||||
-- LINE nano +LINE FILE
|
-- LINE nano +LINE FILE
|
||||||
@ -78,6 +78,7 @@ runEditor mpos f = editFileAtPositionCommand mpos f >>= runCommand >>= waitForPr
|
|||||||
-- emacs: emacs FILE -f end-of-buffer # (-f must appear after FILE, +LINE:COL must appear before)
|
-- emacs: emacs FILE -f end-of-buffer # (-f must appear after FILE, +LINE:COL must appear before)
|
||||||
-- emacsclient: can't
|
-- emacsclient: can't
|
||||||
-- vi: vi + FILE
|
-- vi: vi + FILE
|
||||||
|
-- kakoune: kak +: FILE
|
||||||
-- @
|
-- @
|
||||||
--
|
--
|
||||||
editFileAtPositionCommand :: Maybe TextPosition -> FilePath -> IO String
|
editFileAtPositionCommand :: Maybe TextPosition -> FilePath -> IO String
|
||||||
@ -89,11 +90,13 @@ editFileAtPositionCommand mpos f = do
|
|||||||
ml = show.fst <$> mpos
|
ml = show.fst <$> mpos
|
||||||
mc = maybe Nothing (fmap show.snd) mpos
|
mc = maybe Nothing (fmap show.snd) mpos
|
||||||
args = case editor of
|
args = case editor of
|
||||||
e | e `elem` ["emacs", "emacsclient"] -> ['+' : join ":" [ml,mc], f']
|
e | e `elem` ["emacs", "emacsclient",
|
||||||
|
"kak"] -> ['+' : join ":" [ml,mc], f']
|
||||||
e | e `elem` ["nano"] -> ['+' : join "," [ml,mc], f']
|
e | e `elem` ["nano"] -> ['+' : join "," [ml,mc], f']
|
||||||
e | e `elem` ["code"] -> ["--goto " ++ join ":" [Just f',ml,mc]]
|
e | e `elem` ["code"] -> ["--goto " ++ join ":" [Just f',ml,mc]]
|
||||||
e | e `elem` ["vi","vim","view","nvim","evim","eview","gvim","gview","rvim","rview",
|
e | e `elem` ["vi", "vim", "view", "nvim", "evim", "eview",
|
||||||
"rgvim","rgview","ex"] -> [maybe "" plusMaybeLine ml, f']
|
"gvim", "gview", "rvim", "rview", "rgvim", "rgview",
|
||||||
|
"ex"] -> [maybe "" plusMaybeLine ml, f']
|
||||||
_ -> [f']
|
_ -> [f']
|
||||||
where
|
where
|
||||||
join sep = intercalate sep . catMaybes
|
join sep = intercalate sep . catMaybes
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user