From faeb7cab78f10b8359b2fa86a96e6861e2b86e3f Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 9 Jul 2020 01:10:36 +0200 Subject: Trying space as leader for vim ftplugins. --- files/vim/ftplugin/cpp/cpp.vim | 20 ++++++++++++-------- files/vim/ftplugin/html/html.vim | 13 ++++++++++++- files/vim/ftplugin/html/snips/template.txt | 12 ++++++++++++ files/vim/ftplugin/javascript/javascript.vim | 21 +++++++++++++-------- files/vim/ftplugin/plantuml/plantuml.vim | 4 ++++ files/vim/ftplugin/plantuml/snips/template.txt | 9 +++++++++ files/vim/ftplugin/sh/sh.vim | 4 ++-- files/vim/ftplugin/typescript/typescript.vim | 21 ++++++++++++++------- files/vim/ftplugin/vimwiki/snips/plantUml.txt | 5 +++++ files/vim/ftplugin/vimwiki/snips/template.txt | 3 +++ files/vim/ftplugin/vimwiki/vimwiki.vim | 24 +++++++++++++++--------- 11 files changed, 101 insertions(+), 35 deletions(-) create mode 100644 files/vim/ftplugin/html/snips/template.txt create mode 100644 files/vim/ftplugin/plantuml/snips/template.txt create mode 100644 files/vim/ftplugin/vimwiki/snips/plantUml.txt diff --git a/files/vim/ftplugin/cpp/cpp.vim b/files/vim/ftplugin/cpp/cpp.vim index 6b4807d..e2072c1 100644 --- a/files/vim/ftplugin/cpp/cpp.vim +++ b/files/vim/ftplugin/cpp/cpp.vim @@ -1,24 +1,28 @@ " ~/.vim/ftplugin/cpp/cpp.vim " C++-specific vim configuration -highlight Comment ctermfg=darkgreen +let mapleader = " " " Column marker: 80 characters -call matchadd('ColorColumn', '\%81v', 100) +match ColorColumn /\%81v/ +setlocal textwidth=80 nnoremap C :sp ~/.vim/ftplugin/cpp/cpp.vim nnoremap E :Errors nnoremap c :w:!g++ "%"; ./a.out -nnoremap E :Errors -nnoremap gt :YcmCompleter GoTo -nnoremap gr :YcmCompleter GoToReferences -nnoremap gd :YcmCompleter GetDoc -nnoremap gT :YcmCompleter GetType +nnoremap gd :YcmCompleter GoTo +nnoremap gr :YcmCompleter GoToReferences +nnoremap gh :YcmCompleter GetType +nnoremap gD :YcmCompleter GetDoc +nnoremap gR :YcmCompleter RefactorRename nnoremap fi :YcmCompleter FixIt nnoremap e :YcmDiags +nnoremap temp :-1r ~/.vim/ftplugin/cpp/snips/template.txtGdd?<+++>cf> + +let mapleader = "," + inoremap if if (<+++>) {<++>}?<+++>cf> inoremap for for (<+++>; <++>; <++>) {<++>}?<+++>cf> -nnoremap temp :-1r ~/.vim/ftplugin/cpp/snips/template.txtGdd?<+++>cf> diff --git a/files/vim/ftplugin/html/html.vim b/files/vim/ftplugin/html/html.vim index a2d0fdd..30e4484 100644 --- a/files/vim/ftplugin/html/html.vim +++ b/files/vim/ftplugin/html/html.vim @@ -3,13 +3,25 @@ " " Syntastic linter: tidy +" Tabs are expanded to 2 spaces +setlocal tabstop=2 shiftwidth=2 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +" Column marker: 110 characters call matchadd('ColorColumn', '\%101v', 100) +let mapleader = " " + nnoremap o :!$BROWSER % & nnoremap f :!firefox --new-window % & nnoremap C :sp ~/.vim/ftplugin/html/html.vim nnoremap e :Errors +nnoremap temp :-1r ~/.vim/ftplugin/html/snips/template.txtGdd?<+++>cf> + +let mapleader = "," + " Layout elements inoremap hheader
<++>kki inoremap hnav <++>kki @@ -63,4 +75,3 @@ inoremap himg <++><++>?"" nnoremap hc I0 " Uncomment a line nnoremap hC 05x/-->3x0 - diff --git a/files/vim/ftplugin/html/snips/template.txt b/files/vim/ftplugin/html/snips/template.txt new file mode 100644 index 0000000..38d9f26 --- /dev/null +++ b/files/vim/ftplugin/html/snips/template.txt @@ -0,0 +1,12 @@ + + + + <+++> + + + + + <++> + + + diff --git a/files/vim/ftplugin/javascript/javascript.vim b/files/vim/ftplugin/javascript/javascript.vim index dde35c6..4935410 100644 --- a/files/vim/ftplugin/javascript/javascript.vim +++ b/files/vim/ftplugin/javascript/javascript.vim @@ -10,7 +10,7 @@ let b:ale_linters = ['eslint'] " Tabs are expanded to 4 spaces -setlocal tabstop=2 shiftwidth=2 expandtab +setlocal tabstop=4 shiftwidth=4 expandtab " Show existing tabs (they can be deleted with :retab) setlocal list @@ -19,15 +19,20 @@ call matchadd('ColorColumn', '\%111v', 100) setlocal textwidth=110 " Mappings + +let mapleader = " " + nnoremap C :sp ~/.vim/ftplugin/javascript/javascript.vim -"nnoremap gt :YcmCompleter GoTo -"nnoremap gr :YcmCompleter GoToReferences -"nnoremap fi :YcmCompleter FixIt -"nnoremap r :YcmCompleter RefactorRename -"nnoremap e :YcmDiags -"nnoremap E :Errors +nnoremap gd :YcmCompleter GoTo +nnoremap gr :YcmCompleter GoToReferences +nnoremap gh :YcmCompleter GetType +nnoremap gD :YcmCompleter GetDoc +nnoremap gR :YcmCompleter RefactorRename +nnoremap fi :YcmCompleter FixIt +nnoremap e :YcmDiags + +let mapleader = "," inoremap if if (<+++>) {<++>} <++>?<+++>cf> inoremap else else {<+++>}<++>?<+++>cf> - diff --git a/files/vim/ftplugin/plantuml/plantuml.vim b/files/vim/ftplugin/plantuml/plantuml.vim index eaa8911..e493e5b 100644 --- a/files/vim/ftplugin/plantuml/plantuml.vim +++ b/files/vim/ftplugin/plantuml/plantuml.vim @@ -10,6 +10,10 @@ setlocal list call matchadd('ColorColumn', '\%81v', 100) setlocal textwidth=80 +let mapleader = " " + +nnoremap temp :-1r ~/.vim/ftplugin/plantuml/snips/template.txtGdd?<+++>cf> + nnoremap C :sp ~/.vim/ftplugin/plantuml/plantuml.vim nnoremap e :Errors diff --git a/files/vim/ftplugin/plantuml/snips/template.txt b/files/vim/ftplugin/plantuml/snips/template.txt new file mode 100644 index 0000000..f649539 --- /dev/null +++ b/files/vim/ftplugin/plantuml/snips/template.txt @@ -0,0 +1,9 @@ +@startuml + +class <+++> { + <++> +} + +<++> + +@enduml diff --git a/files/vim/ftplugin/sh/sh.vim b/files/vim/ftplugin/sh/sh.vim index ccea418..3eb4da5 100644 --- a/files/vim/ftplugin/sh/sh.vim +++ b/files/vim/ftplugin/sh/sh.vim @@ -3,8 +3,8 @@ " " Linters: sh, shellcheck -call matchadd('ColorColumn', '\%81v', 100) -setlocal textwidth=80 +call matchadd('ColorColumn', '\%111v', 100) +setlocal textwidth=110 nnoremap C :sp ~/.vim/ftplugin/sh/sh.vim nnoremap +x :!chmod 744 % diff --git a/files/vim/ftplugin/typescript/typescript.vim b/files/vim/ftplugin/typescript/typescript.vim index d80dde4..7c91032 100644 --- a/files/vim/ftplugin/typescript/typescript.vim +++ b/files/vim/ftplugin/typescript/typescript.vim @@ -2,10 +2,10 @@ " TypeScript-specific vim configuration " ALE -"let b:ale_linters = ['eslint'] +let b:ale_linters = ['eslint'] " Tabs are expanded to 4 spaces -setlocal tabstop=2 shiftwidth=2 expandtab +setlocal tabstop=4 shiftwidth=4 expandtab " Show existing tabs (they can be deleted with :retab) setlocal list @@ -14,13 +14,20 @@ call matchadd('ColorColumn', '\%111v', 100) setlocal textwidth=110 " Mappings + +let mapleader = " " + nnoremap C :sp ~/.vim/ftplugin/typescript/typescript.vim -nnoremap gd :ALEGoToDefinition -nnoremap h :ALEHover -nnoremap r :ALERename -nnoremap fr :ALEFindReferences +nnoremap gd :YcmCompleter GoTo +nnoremap gr :YcmCompleter GoToReferences +nnoremap gh :YcmCompleter GetType +nnoremap gD :YcmCompleter GetDoc +nnoremap gR :YcmCompleter RefactorRename +nnoremap fi :YcmCompleter FixIt +nnoremap e :YcmDiags + +let mapleader = "," inoremap if if (<+++>) {<++>} <++>?<+++>cf> inoremap else else {<+++>}<++>?<+++>cf> - diff --git a/files/vim/ftplugin/vimwiki/snips/plantUml.txt b/files/vim/ftplugin/vimwiki/snips/plantUml.txt new file mode 100644 index 0000000..4a016eb --- /dev/null +++ b/files/vim/ftplugin/vimwiki/snips/plantUml.txt @@ -0,0 +1,5 @@ +```{.plantuml caption="<+++>"} +@startuml +<++> +@enduml +``` diff --git a/files/vim/ftplugin/vimwiki/snips/template.txt b/files/vim/ftplugin/vimwiki/snips/template.txt index 18280d3..f6b16a8 100644 --- a/files/vim/ftplugin/vimwiki/snips/template.txt +++ b/files/vim/ftplugin/vimwiki/snips/template.txt @@ -1,4 +1,7 @@ --- +header-includes: + - \usepackage[margin=1.5in]{geometry} + title: "Title" author: - Íñigo Gutiérrez Fernández diff --git a/files/vim/ftplugin/vimwiki/vimwiki.vim b/files/vim/ftplugin/vimwiki/vimwiki.vim index f0e6cd5..e8f7a18 100644 --- a/files/vim/ftplugin/vimwiki/vimwiki.vim +++ b/files/vim/ftplugin/vimwiki/vimwiki.vim @@ -3,25 +3,31 @@ " " Syntastic linter: mdl, proselint, textlint -let g:syntastic_vimwiki_checkers = ['markdown/mdl'] +"let g:syntastic_vimwiki_checkers = ['markdown/mdl'] " Tabs hate: tabs are expanded to 2 spaces setlocal tabstop=2 shiftwidth=2 expandtab " Show existing tabs (they can be deleted with :retab) setlocal list -" Column marker: 80 characters -call matchadd('ColorColumn', '\%101v', 100) -setlocal textwidth=100 +" Text width +match ColorColumn /\%81v/ +setlocal textwidth=80 +setlocal linebreak + +" Syntax highlighting colors +highlight Title ctermfg=blue +highlight TitleHash ctermfg=cyan +match TitleHash /^##*/ nnoremap C :sp ~/.vim/ftplugin/vimwiki/vimwiki.vim nnoremap e :Errors -nnoremap t :-1r ~/.vim/ftplugin/vimwiki/snips/template.txt +nnoremap tt :r ~/.vim/ftplugin/vimwiki/snips/template.txt +nnoremap tp :r ~/.vim/ftplugin/vimwiki/snips/plantUml.txt/<+++>cf> nnoremap c :w:!toPDF.sh "%" -nnoremap o :w:!toPDF.sh -o "%" - -" Syntax highlighting colors -highlight Title ctermfg=darkblue +nnoremap o :w:!toPDF.sh -o "%" +inoremap h < l >>A -- cgit v1.2.1