From 3a3a54720696e543959fd2ac654120755c67ebcc Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 26 Sep 2020 22:35:00 +0100 Subject: [PATCH] VIM: Adds mapping for shebang line The shebang line is used to determine which should interpreter should be used when executing the file The mapping here adds the string `#!/usr/bin/env ` at the begining of the line. https://en.wikipedia.org/wiki/Shebang_(Unix) --- nvim/.config/nvim/plugin/mappings.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nvim/.config/nvim/plugin/mappings.vim b/nvim/.config/nvim/plugin/mappings.vim index 22bb8ce2..958e2994 100644 --- a/nvim/.config/nvim/plugin/mappings.vim +++ b/nvim/.config/nvim/plugin/mappings.vim @@ -32,3 +32,14 @@ endif " a - enter insert mode " u - break undo sequence (new change) inoremap u[s1z=`]au + +" Do Shebang line +" - go into normal mode +" :silent - run command silently +" s/^/…/ - write at the begining of the line +" - used to seperate commands +" filetype detect - attempt to detect filetype again +" :nohlsearch - un-hilight the search pattern +inoremap :silent s/^/#!\/usr\/bin\/env / filetype detect:nohlsearcho +" alternative: inoremap :silent exe ".!which " s/^/#!/ filetype detectYpDi +