From efd23300b89998835a2fc1960178fe0fa1546737 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Mon, 2 Dec 2019 10:40:03 +0100 Subject: Discovered a sad truth about vim's handling of keyboard input. --- files/vim/ftplugin/ftplugin/css/css_mappings.vim | 4 ++-- files/vim/ftplugin/ftplugin/html/html.vim | 2 +- files/vim/ftplugin/ftplugin/html/html_mappings.vim | 4 ++-- .../ftplugin/ftplugin/javascript/javascript.vim | 2 +- .../ftplugin/javascript/javascript_BufEnter.vim | 24 ++++++++++++++++++++++ files/vim/ftplugin/ftplugin/python/python.vim | 2 +- files/vim/ftplugin/ftplugin/sh/sh.vim | 12 ++++++++++- files/vim/ftplugin/ftplugin/sh/snippets/if.txt | 3 +++ files/vim/ftplugin/ftplugin/tex/tex.vim | 2 +- files/vim/ftplugin/ftplugin/text/text.vim | 2 +- files/vim/ftplugin/ftplugin/vimwiki/vimwiki.vim | 5 ++++- 11 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 files/vim/ftplugin/ftplugin/javascript/javascript_BufEnter.vim create mode 100644 files/vim/ftplugin/ftplugin/sh/snippets/if.txt (limited to 'files/vim/ftplugin') diff --git a/files/vim/ftplugin/ftplugin/css/css_mappings.vim b/files/vim/ftplugin/ftplugin/css/css_mappings.vim index 161f850..c8c8ceb 100644 --- a/files/vim/ftplugin/ftplugin/css/css_mappings.vim +++ b/files/vim/ftplugin/ftplugin/css/css_mappings.vim @@ -9,7 +9,7 @@ set nolist set textwidth=80 " Mappings -nnoremap cc :sp ~/.vim/ftplugin/css/css.vim -nnoremap cm :sp ~/.vim/ftplugin/css/css_mappings.vim +nnoremap Cc :sp ~/.vim/ftplugin/css/css.vim +nnoremap Cm :sp ~/.vim/ftplugin/css/css_mappings.vim nnoremap e :Errors nnoremap s vi{!sort diff --git a/files/vim/ftplugin/ftplugin/html/html.vim b/files/vim/ftplugin/ftplugin/html/html.vim index e4e0ab5..fb1c4bd 100644 --- a/files/vim/ftplugin/ftplugin/html/html.vim +++ b/files/vim/ftplugin/ftplugin/html/html.vim @@ -5,4 +5,4 @@ call matchadd('ColorColumn', '\%101v', 100) -autocmd BufEnter *.html source ~/.vim/ftplugin/html_mappings.vim +autocmd BufEnter *.html source ~/.vim/ftplugin/html/html_mappings.vim diff --git a/files/vim/ftplugin/ftplugin/html/html_mappings.vim b/files/vim/ftplugin/ftplugin/html/html_mappings.vim index b798408..2acd4fe 100644 --- a/files/vim/ftplugin/ftplugin/html/html_mappings.vim +++ b/files/vim/ftplugin/ftplugin/html/html_mappings.vim @@ -3,8 +3,8 @@ nnoremap o :!$BROWSER % & nnoremap f :!firefox --new-window % & -nnoremap cc :sp ~/.vim/ftplugin/html.vim -nnoremap cm :sp ~/.vim/ftplugin/html_mappings.vim +nnoremap Cc :sp ~/.vim/ftplugin/html/html.vim +nnoremap Cm :sp ~/.vim/ftplugin/html/html_mappings.vim nnoremap e :Errors " Layout elements diff --git a/files/vim/ftplugin/ftplugin/javascript/javascript.vim b/files/vim/ftplugin/ftplugin/javascript/javascript.vim index 470287d..71c66ba 100644 --- a/files/vim/ftplugin/ftplugin/javascript/javascript.vim +++ b/files/vim/ftplugin/ftplugin/javascript/javascript.vim @@ -9,4 +9,4 @@ call matchadd('ColorColumn', '\%81v', 100) " JSLint arguments let g:syntastic_javascript_jslint_args = "--browser --indent" -autocmd BufEnter *.js source ~/.vim/ftplugin/javasctipt/javascript_BufEnter.vim +autocmd BufEnter *.js source ~/.vim/ftplugin/javascript/javascript_BufEnter.vim diff --git a/files/vim/ftplugin/ftplugin/javascript/javascript_BufEnter.vim b/files/vim/ftplugin/ftplugin/javascript/javascript_BufEnter.vim new file mode 100644 index 0000000..6b8d852 --- /dev/null +++ b/files/vim/ftplugin/ftplugin/javascript/javascript_BufEnter.vim @@ -0,0 +1,24 @@ +" ~/.vim/ftplugin/javascript/javascript_BufEnter.vim +" JavaScript-specific vim configuration (reloaded when entering buffer) + +" Tabs are expanded to 4 spaces +set tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +set list + +set textwidth=80 + +" Mappings +nnoremap Cc :sp ~/.vim/ftplugin/javascript/javascript.vim +nnoremap Cm :sp ~/.vim/ftplugin/javascript/javascript_BufEnter.vim + +inoremap if if (<+++>) {<++>} <++>?<+++>cf> +inoremap else else {<+++>}<++>?<+++>cf> + +nnoremap gt :YcmCompleter GoTo +nnoremap gr :YcmCompleter GoToReferences +nnoremap fi :YcmCompleter FixIt +nnoremap r :YcmCompleter RefactorRename +nnoremap e :YcmDiags + +nnoremap E :Errors diff --git a/files/vim/ftplugin/ftplugin/python/python.vim b/files/vim/ftplugin/ftplugin/python/python.vim index 74c7e2c..bb0e6f9 100644 --- a/files/vim/ftplugin/ftplugin/python/python.vim +++ b/files/vim/ftplugin/ftplugin/python/python.vim @@ -5,7 +5,7 @@ call matchadd('ColorColumn', '\%81v', 100) let b:syntastic_mode="passive" -nnoremap c :sp ~/.vim/ftplugin/python/python.vim +nnoremap C :sp ~/.vim/ftplugin/python/python.vim nnoremap E :Errors nnoremap gt :YcmCompleter GoTo diff --git a/files/vim/ftplugin/ftplugin/sh/sh.vim b/files/vim/ftplugin/ftplugin/sh/sh.vim index bebdcba..41a5327 100644 --- a/files/vim/ftplugin/ftplugin/sh/sh.vim +++ b/files/vim/ftplugin/ftplugin/sh/sh.vim @@ -1,5 +1,15 @@ " ~/.vim/ftplugin/sh.vim " Bourne shell scripts specific vim configuration +" +" Linters: sh, shellcheck -nnoremap e :Errors call matchadd('ColorColumn', '\%101v', 100) + +nnoremap C :sp ~/.vim/ftplugin/sh/sh.vim +nnoremap +x :!chmod 744 % +nnoremap x :!./% +nnoremap e :Errors + +inoremap sh #!/bin/sh +inoremap if if <+++>; then<++>fi<++>?<+++>cf> +"inoremap if :read ~/.vim/ftplugin/sh/snippets/if.txtkdd/<+++>cf> diff --git a/files/vim/ftplugin/ftplugin/sh/snippets/if.txt b/files/vim/ftplugin/ftplugin/sh/snippets/if.txt new file mode 100644 index 0000000..9f6bb88 --- /dev/null +++ b/files/vim/ftplugin/ftplugin/sh/snippets/if.txt @@ -0,0 +1,3 @@ +if <+++>; then + <++> +fi<++> diff --git a/files/vim/ftplugin/ftplugin/tex/tex.vim b/files/vim/ftplugin/ftplugin/tex/tex.vim index 43492e5..2215190 100644 --- a/files/vim/ftplugin/ftplugin/tex/tex.vim +++ b/files/vim/ftplugin/ftplugin/tex/tex.vim @@ -5,7 +5,7 @@ call matchadd('ColorColumn', '\%91v', 100) -nnoremap c :sp ~/.vim/ftplugin/tex.vim +nnoremap C :sp ~/.vim/ftplugin/tex.vim nnoremap e :Errors " proselint not enabled by default (and better not be) nnoremap sp :SyntasticCheck proselint diff --git a/files/vim/ftplugin/ftplugin/text/text.vim b/files/vim/ftplugin/ftplugin/text/text.vim index 3252e54..bf6b9ab 100644 --- a/files/vim/ftplugin/ftplugin/text/text.vim +++ b/files/vim/ftplugin/ftplugin/text/text.vim @@ -3,7 +3,7 @@ " " Syntastic linter: proselint -nnoremap c :sp ~/.vim/ftplugin/text.vim +nnoremap C :sp ~/.vim/ftplugin/text/text.vim nnoremap e :Errors call matchadd('ColorColumn', '\%101v', 100) diff --git a/files/vim/ftplugin/ftplugin/vimwiki/vimwiki.vim b/files/vim/ftplugin/ftplugin/vimwiki/vimwiki.vim index 92eea91..7164c1c 100644 --- a/files/vim/ftplugin/ftplugin/vimwiki/vimwiki.vim +++ b/files/vim/ftplugin/ftplugin/vimwiki/vimwiki.vim @@ -14,5 +14,8 @@ set textwidth=80 let g:syntastic_vimwiki_checkers = ['markdown/mdl'] -nnoremap c :sp ~/.vim/ftplugin/vimwiki.vim +nnoremap C :sp ~/.vim/ftplugin/vimwiki/vimwiki.vim nnoremap e :Errors + +nnoremap c :w:!toPDF.sh % +nnoremap o :w:!toPDF.sh -o % -- cgit v1.2.1