diff options
Diffstat (limited to 'stow/vim/dot-vim/ftplugin')
25 files changed, 678 insertions, 0 deletions
diff --git a/stow/vim/dot-vim/ftplugin/antlr/antlr3.vim b/stow/vim/dot-vim/ftplugin/antlr/antlr3.vim new file mode 100644 index 0000000..10e24e5 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/antlr/antlr3.vim @@ -0,0 +1,91 @@ +" vim: ts=8 +" Vim syntax file +" Language: ANTLRv3 +" Maintainer: Jörn Horstmann (updated by Davyd Madeley) +" Last Change: 2008-11-21 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn keyword antlrKeyword grammar lexer parser tree header members options fragment returns throws scope init + +syn match antlrCharacter '\\\(r\|n\|t\|f\|b\|"\|\'\|\\\|u\x\{4}\)' contained display + +syn match antlrToken "\<[A-Z_][a-zA-Z_0-9]\+\>" +syn match antlrRule "[a-z][a-zA-Z_0-9]\+" +syn match antlrScopeVariable '$\k\+::\k\+' + +syn match antlrOperator "[:;@.]" +syn match antlrOperator "[()]" +syn match antlrOperator "[?+*~|!]" +syn match antlrOperator "[->=^]" + +syn match antlrBrace "[{}]" +syn match antlrBrace "[\[\]]" +syn region antlrAction matchgroup=antlrBrace start="[{\[]" end="[}\]]" contains=antlrVariable,antlrLiteral,antlrComment +syn match antlrVariable contained "$[a-zA-Z][a-zA-Z_0-9]*" + +syn region antlrLiteral start=+'+ end=+'+ contains=antlrCharacter +syn region antlrLiteral start=+"+ end=+"+ contains=antlrCharacter + +syn region antlrComment start="/\*" end="\*/" +syn match antlrComment "//.*$" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 + if version < 508 + let did_antlr_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink antlrLiteral String + hi def antlrVariable term=bold cterm=bold gui=bold + HiLink antlrBrace Operator + HiLink antlrCharacter Special + HiLink antlrComment Comment + HiLink antlrOperator Operator + HiLink antlrKeyword Keyword + HiLink antlrToken PreProc + HiLink antlrScopeVariable Identifier + HiLink antlrRule Type + + delcommand HiLink +endif + +" try to figure out the target language +let target_languages = [] +" can we figure out from the file name +let extensions = split(expand('%:t'), '\.') +if len(extensions) >= 3 + " great.. the target language was provided via file name + call add(target_languages, tolower(extensions[-2])) +else + " no multiple extensions... have to figure out from the content + let buffer = join(getline(1, line('$')), "\n") + let antlr_options = matchstr(buffer, '\m\(\_s\|;\)options\_s\+{\_.\{-\}}') + call substitute(antlr_options, '\mlanguage\_s*=\_s*''\?\(.\{-\}\)''\?\_s*;', '\=add(target_languages, tolower(submatch(1)))', 'g') +endif +if exists('target_languages[-1]') + " the last defined target language takes precendece + let lang=target_languages[-1] + let syntax_file = findfile('syntax/' . lang . '.vim', &rtp, 1) + if syntax_file != '' + " if a valid syntax file was found only + let b:current_syntax = '' + unlet b:current_syntax + let region_name = '@' . lang . 'Language' + exe 'syntax include ' . region_name . ' ' . syntax_file + exe 'syntax region ' . lang . ' start="{" end="}" keepend contains=' . region_name + endif +endif + +let b:current_syntax = "antlr3" diff --git a/stow/vim/dot-vim/ftplugin/antlr/antlr4.vim b/stow/vim/dot-vim/ftplugin/antlr/antlr4.vim new file mode 100644 index 0000000..456076c --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/antlr/antlr4.vim @@ -0,0 +1,76 @@ +" vim: ts=8 +" Vim syntax file +" Language: ANTLRv4 +" Maintainer: Jörn Horstmann (updated by Dylon Edwards) +" Last Change: 2015-12-15 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn keyword antlrKeyword import fragment lexer parser grammar returns locals throws catch finally mode options tokens header members init after channels mode protected public private + +syn keyword antlrReserved rule + +syn match antlrCharacter '\\\(r\|n\|t\|f\|b\|"\|\'\|\\\|u\x\{4}\)' contained display + +syn match antlrToken "\<[A-Z_][a-zA-Z_0-9]\+\>" +syn match antlrRule "[a-z][a-zA-Z_0-9]\+" +syn match antlrScopeVariable '$\k\+::\k\+' + +syn match antlrOperator "[:;@.]" +syn match antlrOperator "[()]" +syn match antlrOperator "[?+*~|!]" +syn match antlrOperator "[->=^]" + +syn match antlrBlock "[{}]" +syn region antlrAction matchgroup=antlrBlock start="{" end="}" contains=antlrVariable,antlrAction +syn match antlrVariable contained "$[a-zA-Z][a-zA-Z_0-9]*" + +syn include @JAVA syntax/java.vim +syn region ANTLR4EmbeddedJavaAction matchgroup=antlrBlock start="{" end="}" contains=@JAVA,antlrVariable containedin=antlrAction + +syn keyword antlrOperations pushMode popMode skip channel + +syn match antlrBrace "[\[\]]" +syn region antlrCharClass matchgroup=antlrBrace start="\[" end="\]" contains=antlrCharacter + +syn region antlrLiteral start=+'+ end=+'+ contains=antlrCharacter +syn region antlrLiteral start=+"+ end=+"+ contains=antlrCharacter + +syn region antlrComment start="/\*" end="\*/" +syn match antlrComment "//.*$" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 + if version < 508 + let did_antlr_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink antlrReserved Error + HiLink antlrOperations Identifier + HiLink antlrLiteral String + hi def antlrVariable term=bold cterm=bold gui=bold + HiLink antlrBrace Operator + HiLink antlrBlock Operator + HiLink antlrCharacter Special + HiLink antlrComment Comment + HiLink antlrOperator Operator + HiLink antlrKeyword Keyword + HiLink antlrToken PreProc + HiLink antlrScopeVariable Identifier + HiLink antlrRule Type + + delcommand HiLink +endif + +let b:current_syntax = "antlr4" diff --git a/stow/vim/dot-vim/ftplugin/asciidoc/asciidoc.vim b/stow/vim/dot-vim/ftplugin/asciidoc/asciidoc.vim new file mode 100644 index 0000000..b94b875 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/asciidoc/asciidoc.vim @@ -0,0 +1,19 @@ +" ~/.vim/ftplugin/asciidoc/asciidoc.vim +" asciidoc vim configuration +" +" Syntastic linter: proselint + +" 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', '\%81v', 100) +setlocal textwidth=80 + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/asciidoc/asciidoc.vim<CR> + +" Proselint is slow to act +nnoremap <buffer> <leader>sp :SyntasticCheck proselint<CR> +nnoremap <buffer> <leader>e :Errors<CR> diff --git a/stow/vim/dot-vim/ftplugin/cpp/cpp.vim b/stow/vim/dot-vim/ftplugin/cpp/cpp.vim new file mode 100644 index 0000000..e2072c1 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/cpp/cpp.vim @@ -0,0 +1,28 @@ +" ~/.vim/ftplugin/cpp/cpp.vim +" C++-specific vim configuration + +let mapleader = " " + +" Column marker: 80 characters +match ColorColumn /\%81v/ +setlocal textwidth=80 + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/cpp/cpp.vim<CR> +nnoremap <buffer> <leader>E :Errors<CR> + +nnoremap <buffer> <leader>c :w<CR>:!g++ "%"; ./a.out<Space> + +nnoremap <buffer> gd :YcmCompleter GoTo<CR> +nnoremap <buffer> gr :YcmCompleter GoToReferences<CR> +nnoremap <buffer> gh :YcmCompleter GetType<CR> +nnoremap <buffer> gD :YcmCompleter GetDoc<CR> +nnoremap <buffer> gR :YcmCompleter RefactorRename<Space> +nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR> +nnoremap <buffer> <leader>e :YcmDiags<CR> + +nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/cpp/snips/template.txt<CR>Gdd?<+++><CR>cf> + +let mapleader = "," + +inoremap <buffer> <leader>if if (<+++>) {<CR><++><CR>}?<+++><CR>cf> +inoremap <buffer> <leader>for for (<+++>; <++>; <++>) {<CR><++><CR>}?<+++><CR>cf> diff --git a/stow/vim/dot-vim/ftplugin/cpp/snips/template.txt b/stow/vim/dot-vim/ftplugin/cpp/snips/template.txt new file mode 100644 index 0000000..90ef863 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/cpp/snips/template.txt @@ -0,0 +1,6 @@ +#include <iostream> + +int main() { + <+++> + return 0; +} diff --git a/stow/vim/dot-vim/ftplugin/css/css.vim b/stow/vim/dot-vim/ftplugin/css/css.vim new file mode 100644 index 0000000..695243c --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/css/css.vim @@ -0,0 +1,20 @@ +" ~/.vim/ftplugin/css/css.vim +" CSS-specific vim configuration +" +" Syntastic linters: csslint, prettycss, sstylelint + +"let g:syntastic_css_csslint_args = "--ignore=order-alphabetical,ids" + +setlocal textwidth=80 +call matchadd('ColorColumn', '\%81v', 100) + +" Tabs are expanded to 2 spaces +setlocal tabstop=2 shiftwidth=2 expandtab +" Don't show existing tabs +setlocal nolist + +" Mappings +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/css/css.vim<CR> +nnoremap <buffer> <leader>e :Errors<CR> +nnoremap <buffer> <leader>s vi{!sort<CR> + diff --git a/stow/vim/dot-vim/ftplugin/html/html.vim b/stow/vim/dot-vim/ftplugin/html/html.vim new file mode 100644 index 0000000..41890b4 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/html/html.vim @@ -0,0 +1,78 @@ +" ~/.vim/ftplugin/html/html.vim +" HTML-specific vim configuration +" +" 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: 100 characters +call matchadd('ColorColumn', '\%101v', 100) +setlocal textwidth=100 + +let mapleader = " " + +nnoremap <buffer> <leader>o :!$BROWSER % &<CR><CR> +nnoremap <buffer> <leader>f :!firefox --new-window % &<CR><CR> +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/html/html.vim<CR> +nnoremap <buffer> <leader>e :Errors<CR> + +nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/html/snips/template.txt<CR>Gdd?<+++><CR>cf> + +let mapleader = "," + +" Layout elements +inoremap <buffer> <leader>hheader <header><Enter><Enter></header><Enter><++><Esc>kki +inoremap <buffer> <leader>hnav <nav><Enter><Enter></nav><Enter><++><Esc>kki +inoremap <buffer> <leader>hsection <section><Enter><Enter></section><Enter><++><Esc>kki +inoremap <buffer> <leader>harticle <article><Enter><Enter></article><Enter><++><Esc>kki +inoremap <buffer> <leader>hfooter <footer><Enter><Enter></footer><Enter><++><Esc>kki +inoremap <buffer> <leader>haside <aside><Enter><Enter></aside><Enter><++><Esc>kki +inoremap <buffer> <leader>hdiv <div class=""><Enter><++><Enter></div><Enter><++><Esc>?""<Enter>a + +" Headers and paragraphs +inoremap <buffer> <leader>hh1 <h1></h1><Enter><++><Esc>?</h1><Enter>i +inoremap <buffer> <leader>hh2 <h2></h2><Enter><++><Esc>?</h2><Enter>i +inoremap <buffer> <leader>hh3 <h3></h3><Enter><++><Esc>?</h3><Enter>i +inoremap <buffer> <leader>hh4 <h4></h4><Enter><++><Esc>?</h4><Enter>i +inoremap <buffer> <leader>hh5 <h5></h5><Enter><++><Esc>?</h5><Enter>i +inoremap <buffer> <leader>hh6 <h6></h6><Enter><++><Esc>?</h6><Enter>i +inoremap <buffer> <leader>hp <p></p><Enter><++><Esc>?</p><Enter>i + +" Text formatting +inoremap <buffer> <leader>hb <b></b><++><Esc>?</b><Enter>i +inoremap <buffer> <leader>hi <i></i><++><Esc>?</i><Enter>i +inoremap <buffer> <leader>hem <em></em><++><Esc>?</em><Enter>i +inoremap <buffer> <leader>hcode <code></code><++><Esc>?</code><Enter>i +inoremap <buffer> <leader>hsub <sub></sub><++><Esc>?</sub><Enter>i +inoremap <buffer> <leader>hsup <sup></sup><++><Esc>?</sup><Enter>i +inoremap <buffer> <leader>hcite <cite></cite><++><Esc>?</cite><Enter>i + +" Tables +inoremap <buffer> <leader>htable <table border=""><Enter><caption><++></caption><Enter><thead><Enter><tr><Enter><++><Enter></tr><Enter></thead><Enter><tbody><Enter><++><Enter></tbody><Enter></table><Enter><++><Esc>?""<Enter>a +inoremap <buffer> <leader>htr <tr><Enter><Enter></tr><Enter><++><Esc>kki +inoremap <buffer> <leader>hth <th></th><Enter><++><Esc>?</<Enter>i +inoremap <buffer> <leader>htd <td></td><Enter><++><Esc>?</<Enter>i + +" Lists +inoremap <buffer> <leader>hul <ul><Enter><li></li><Enter><++><Enter></ul><Enter><++><Esc>?</l<Enter>i +inoremap <buffer> <leader>hol <ol><Enter><li></li><Enter><++><Enter></ol><Enter><++><Esc>?</l<Enter>i +inoremap <buffer> <leader>hli <li></li><Enter><++><Esc>?</<Enter>i + +" Forms +inoremap <buffer> <leader>hform <form><Enter><fieldset><Enter><Enter></fieldset><Enter></form><Enter><++><Esc>3ki +inoremap <buffer> <leader>hfs <fieldset><Enter><Enter></fieldset><Enter><++><Esc>kki +inoremap <buffer> <leader>hlegend <legend></legend><Enter><++><Esc>?</<Enter>i +inoremap <buffer> <leader>hlabel <label><input type="<++>"></label><Enter><++><Esc>?<i<Enter>i + +" Media +inoremap <buffer> <leader>ha <a href=""><++></a><Enter><++><Esc>?""<Enter>a +inoremap <buffer> <leader>himg <img src="" alt="<++>"><Enter><++><Esc>?""<Enter>a + +" Misc +" Comment a line +nnoremap <buffer> <leader>hc I<!-- <Esc>A --><Esc>0 +" Uncomment a line +nnoremap <buffer> <leader>hC 05x/--><Enter>3x0 diff --git a/stow/vim/dot-vim/ftplugin/html/snips/template.txt b/stow/vim/dot-vim/ftplugin/html/snips/template.txt new file mode 100644 index 0000000..38d9f26 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/html/snips/template.txt @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<head> + <title><+++></title> +</head> + +<body> + + <++> + +</body> +</html> diff --git a/stow/vim/dot-vim/ftplugin/java/java.vim b/stow/vim/dot-vim/ftplugin/java/java.vim new file mode 100644 index 0000000..2595b32 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/java/java.vim @@ -0,0 +1,14 @@ +" ~/.vim/ftplugin/java.vim +" Java-specific vim configuration + +call matchadd('ColorColumn', '\%131v', 100) + +let g:syntastic_java_checkers = [] + +nnoremap <buffer> <leader>gt :YcmCompleter GoTo<CR> +nnoremap <buffer> <leader>gr :YcmCompleter GoToReferences<CR> +nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR> +nnoremap <buffer> <leader>rr :YcmCompleter RefactorRename<Space> +nnoremap <buffer> <leader>e :YcmDiags<CR> +nnoremap <buffer> <leader>R :!./run.sh<CR> + diff --git a/stow/vim/dot-vim/ftplugin/javascript/javascript.vim b/stow/vim/dot-vim/ftplugin/javascript/javascript.vim new file mode 100644 index 0000000..4935410 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/javascript/javascript.vim @@ -0,0 +1,38 @@ +" ~/.vim/ftplugin/javascript/javascript.vim +" JavaScript-specific vim configuration +" +" Syntastic linters: jslint + +" JSLint arguments +" let g:syntastic_javascript_jslint_args = "--browser --indent" + +" ALE +let b:ale_linters = ['eslint'] + +" Tabs are expanded to 4 spaces +setlocal tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +" Column marker: 110 characters +call matchadd('ColorColumn', '\%111v', 100) +setlocal textwidth=110 + +" Mappings + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/javascript/javascript.vim<CR> + +nnoremap <buffer> gd :YcmCompleter GoTo<CR> +nnoremap <buffer> gr :YcmCompleter GoToReferences<CR> +nnoremap <buffer> gh :YcmCompleter GetType<CR> +nnoremap <buffer> gD :YcmCompleter GetDoc<CR> +nnoremap <buffer> gR :YcmCompleter RefactorRename<Space> +nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR> +nnoremap <buffer> <leader>e :YcmDiags<CR> + +let mapleader = "," + +inoremap <buffer> <leader>if if (<+++>) {<CR><++><CR>} <++><Esc>?<+++><CR>cf> +inoremap <buffer> <leader>else else {<CR><+++><CR>}<CR><++><Esc>?<+++><CR>cf> diff --git a/stow/vim/dot-vim/ftplugin/plantuml/plantuml.vim b/stow/vim/dot-vim/ftplugin/plantuml/plantuml.vim new file mode 100644 index 0000000..5bab6a2 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/plantuml/plantuml.vim @@ -0,0 +1,20 @@ +" ~/.vim/ftplugin/plantuml/plantuml.vim +" PlantUML-specific vim configuration + +" Tabs hate: tabs are expanded to 4 spaces +setlocal tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +" Column marker: 80 characters +call matchadd('ColorColumn', '\%81v', 100) +setlocal textwidth=80 + +let mapleader = " " + +nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/plantuml/snips/template.txt<CR>Gdd?<+++><CR>cf> + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/plantuml/plantuml.vim<CR> + +nnoremap <buffer> <leader>c :w<CR>:!compilePlantUML.sh "%"<CR><CR> +nnoremap <buffer> <leader>o :w<CR>:!compilePlantUML.sh -o "%"<CR><CR> diff --git a/stow/vim/dot-vim/ftplugin/plantuml/snips/template.txt b/stow/vim/dot-vim/ftplugin/plantuml/snips/template.txt new file mode 100644 index 0000000..f649539 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/plantuml/snips/template.txt @@ -0,0 +1,9 @@ +@startuml + +class <+++> { + <++> +} + +<++> + +@enduml diff --git a/stow/vim/dot-vim/ftplugin/python/python.vim b/stow/vim/dot-vim/ftplugin/python/python.vim new file mode 100644 index 0000000..358f902 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/python/python.vim @@ -0,0 +1,34 @@ +" ~/.vim/ftplugin/python/python.vim +" Python-specific vim configuration + +" Tabs are expanded to 4 spaces +setlocal tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +" Column marker: 90 characters +call matchadd('ColorColumn', '\%91v', 100) +setlocal textwidth=90 + +let b:ale_python_pylint_options = '-d invalid-name' + +" Mappings + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/python/python.vim<CR> +nnoremap <buffer> <leader>x :! ./% +nnoremap <buffer> <leader>X :! ./%<CR> + +nnoremap <buffer> gd :YcmCompleter GoTo<CR> +nnoremap <buffer> gr :YcmCompleter GoToReferences<CR> +nnoremap <buffer> gR :YcmCompleter RefactorRename<Space> +nnoremap <buffer> <leader>gd :YcmCompleter GetDoc<CR> +nnoremap <buffer> <leader>gT :YcmCompleter GetType<CR> + +nnoremap <buffer> <leader>db :!tmux split-window -l '40\%' 'python -mÌ€ pdb %' + +let mapleader = "," + +inoremap <buffer> <leader>temp <Esc>:-1r ~/.vim/ftplugin/python/snips/template<CR>Gdd?<+++><CR>cf> +inoremap <buffer> <leader>class <Esc>:-1r ~/.vim/ftplugin/python/snips/class<CR>Gdd?<+++><CR>cf> diff --git a/stow/vim/dot-vim/ftplugin/python/snips/class b/stow/vim/dot-vim/ftplugin/python/snips/class new file mode 100644 index 0000000..0febf0c --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/python/snips/class @@ -0,0 +1,3 @@ +class <+++>: + def __init__(<++>): + self.<++> = <++> diff --git a/stow/vim/dot-vim/ftplugin/python/snips/template b/stow/vim/dot-vim/ftplugin/python/snips/template new file mode 100644 index 0000000..d10fa4a --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/python/snips/template @@ -0,0 +1,5 @@ +#!/usr/bin/python + +"""<+++>""" + +<++> diff --git a/stow/vim/dot-vim/ftplugin/sent/sent.vim b/stow/vim/dot-vim/ftplugin/sent/sent.vim new file mode 100644 index 0000000..c9cc974 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/sent/sent.vim @@ -0,0 +1,19 @@ +" ~/.vim/ftplugin/sent/sent.vim +" Vim configuration for writing sent presentations + +" Tabs hate: tabs are expanded to 4 spaces +setlocal tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +call matchadd('ColorColumn', '\%41v', 100) +setlocal textwidth=40 + +setlocal spell + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/sent/sent.vim<CR> + +nnoremap <buffer> <leader>c :w<CR>:!killall sent <CR>:!sent % & <CR><CR> +nnoremap <buffer> <leader>o :w<CR>:!sent % & <CR><CR> diff --git a/stow/vim/dot-vim/ftplugin/sh/sh.vim b/stow/vim/dot-vim/ftplugin/sh/sh.vim new file mode 100644 index 0000000..3eb4da5 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/sh/sh.vim @@ -0,0 +1,16 @@ +" ~/.vim/ftplugin/sh.vim +" Bourne shell scripts specific vim configuration +" +" Linters: sh, shellcheck + +call matchadd('ColorColumn', '\%111v', 100) +setlocal textwidth=110 + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/sh/sh.vim<CR> +nnoremap <buffer> <leader>+x :!chmod 744 %<CR><CR> +nnoremap <buffer> <leader>x :w<CR>:!./%<Space> +nnoremap <buffer> <leader>e :Errors<CR> + +inoremap <buffer> <leader>sh #!/bin/sh +inoremap <buffer> <leader>if if <+++>; then<CR><++><CR>fi<++><Esc>?<+++><CR>cf> +"inoremap <buffer> <leader>if <Esc>:read ~/.vim/ftplugin/sh/snippets/if.txt<CR>kdd/<+++><CR>cf> diff --git a/stow/vim/dot-vim/ftplugin/sh/snippets/if.txt b/stow/vim/dot-vim/ftplugin/sh/snippets/if.txt new file mode 100644 index 0000000..9f6bb88 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/sh/snippets/if.txt @@ -0,0 +1,3 @@ +if <+++>; then + <++> +fi<++> diff --git a/stow/vim/dot-vim/ftplugin/tex/snips/template.txt b/stow/vim/dot-vim/ftplugin/tex/snips/template.txt new file mode 100644 index 0000000..1f4bd46 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/tex/snips/template.txt @@ -0,0 +1,30 @@ +\documentclass{article} + +\usepackage{geometry} +\usepackage{graphicx} +\usepackage{booktabs} + +\geometry{left=4.5cm,top=2cm,bottom=2cm,right=4.5cm} + +\renewcommand{\contentsname}{Contenidos} +\renewcommand{\figurename}{Figura} + +\begin{document} + +\frenchspacing + +\title{<+++>} + +\author{<++>} + +\date{} + +\maketitle + +\tableofcontents + +\section{<++>} + +<++> + +\end{document} diff --git a/stow/vim/dot-vim/ftplugin/tex/tex.vim b/stow/vim/dot-vim/ftplugin/tex/tex.vim new file mode 100644 index 0000000..87f3c88 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/tex/tex.vim @@ -0,0 +1,45 @@ +" ~/.vim/ftplugin/tex.vim +" LaTeX-specific vim configuration + +" Syntastic linters: chktex, lacheck, proselint + +call matchadd('ColorColumn', '\%91v', 100) +setlocal textwidth=80 + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/tex/tex.vim<CR> +nnoremap <buffer> <leader>e :Errors<CR> +" proselint not enabled by default (it's slow) +"nnoremap <buffer> <leader>sp :SyntasticCheck proselint<CR> + +nnoremap <buffer> <leader>c :w<Enter>:!toPDF.sh %<CR><CR> +nnoremap <buffer> <leader>o :w<Enter>:!toPDF.sh -o %<CR><CR> +nnoremap <buffer> <leader>O :w<Enter>:!toPDF.sh -o %<CR> +nnoremap <buffer> <leader>m :w<Enter>:!make<CR><CR> +nnoremap <buffer> <leader>M :w<Enter>:!make<CR> + +nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/tex/snips/template.txt<CR>/<+++><CR>cf> + +let mapleader = "," + +inoremap <buffer> <leader>ldocclass \documentclass{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lpckg \usepackage{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lbdoc \begin{document}<Esc>o<Enter><Enter><Enter>\end{document}<Esc>kkI +inoremap <buffer> <leader>lauthor \author{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>ltitle \title{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lsection \section{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lssection \subsection{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lsssection \subsubsection{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lssssection \paragraph{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lsssssection \subparagraph{}<Esc>o<++><Esc>k$i +inoremap <buffer> <leader>lb \textbf{}<++><Esc>F}i +inoremap <buffer> <leader>li \textit{}<++><Esc>F}i +inoremap <buffer> <leader>lemph \emph{}<++><Esc>F}i +inoremap <buffer> <leader>llabel \label{}<++><Esc>F}i +inoremap <buffer> <leader>lref ~\ref{}<++><Esc>F}i +inoremap <buffer> <leader>lenumerate \begin{enumerate}<Esc>o<Enter><Enter><Enter>\end{enumerate}<Esc>kkI\item<Enter><Esc>I<Tab><++><Esc>k<<i<Tab><Esc>$a<Space> +inoremap <buffer> <leader>litemize \begin{itemize}<Esc>o<Enter><Enter><Enter>\end{itemize}<Esc>kkI\item<Enter><Esc>I<Tab><++><Esc>k<<i<Tab><Esc>$a<Space> +inoremap <buffer> <leader>litem \item<Enter><++><Esc>k$a<Space> +inoremap <buffer> <leader>limage \begin{figure}[h]<Enter>\begin{center}<Enter>\includegraphics[width=\textwidth]{}<Enter>\caption{<++>}<Enter>\end{center}<Enter>\end{figure}<Enter><++><Esc>4k$i +inoremap <buffer> <leader>ltable \begin{table}[h]<Enter>\makebox[\linewidth]{\centering<Enter>\centering<Enter>\begin{tabular}{c<Space>cxxx}<Enter>\toprule<Enter><++><Space>&<Space><++><Space>\\<Enter>\midrule<Enter><++><Space>&<Space><++><Space>\\<Enter>\bottomrule<Enter>\end{tabular}<Enter>}<Enter>\end{table}<Enter><++><Esc>?xxx<Enter>cw diff --git a/stow/vim/dot-vim/ftplugin/text/text.vim b/stow/vim/dot-vim/ftplugin/text/text.vim new file mode 100644 index 0000000..c370a74 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/text/text.vim @@ -0,0 +1,20 @@ +" ~/.vim/ftplugin/text/text.vim +" Plain text files vim configuration +" +" Syntastic linter: proselint + +" 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 + +let mapleader = " " + +call matchadd('ColorColumn', '\%101v', 100) +setlocal textwidth=100 + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/text/text.vim<CR> + +" Proselint is slow to act +nnoremap <buffer> <leader>sp :SyntasticCheck proselint<CR> +nnoremap <buffer> <leader>e :Errors<CR> diff --git a/stow/vim/dot-vim/ftplugin/typescript/typescript.vim b/stow/vim/dot-vim/ftplugin/typescript/typescript.vim new file mode 100644 index 0000000..7c91032 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/typescript/typescript.vim @@ -0,0 +1,33 @@ +" ~/.vim/ftplugin/typescript/typescript.vim +" TypeScript-specific vim configuration + +" ALE +let b:ale_linters = ['eslint'] + +" Tabs are expanded to 4 spaces +setlocal tabstop=4 shiftwidth=4 expandtab +" Show existing tabs (they can be deleted with :retab) +setlocal list + +" Column marker: 110 characters +call matchadd('ColorColumn', '\%111v', 100) +setlocal textwidth=110 + +" Mappings + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/typescript/typescript.vim<CR> + +nnoremap <buffer> gd :YcmCompleter GoTo<CR> +nnoremap <buffer> gr :YcmCompleter GoToReferences<CR> +nnoremap <buffer> gh :YcmCompleter GetType<CR> +nnoremap <buffer> gD :YcmCompleter GetDoc<CR> +nnoremap <buffer> gR :YcmCompleter RefactorRename<Space> +nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR> +nnoremap <buffer> <leader>e :YcmDiags<CR> + +let mapleader = "," + +inoremap <buffer> <leader>if if (<+++>) {<CR><++><CR>} <++><Esc>?<+++><CR>cf> +inoremap <buffer> <leader>else else {<CR><+++><CR>}<CR><++><Esc>?<+++><CR>cf> diff --git a/stow/vim/dot-vim/ftplugin/vimwiki/snips/plantUml.txt b/stow/vim/dot-vim/ftplugin/vimwiki/snips/plantUml.txt new file mode 100644 index 0000000..4a016eb --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/vimwiki/snips/plantUml.txt @@ -0,0 +1,5 @@ +```{.plantuml caption="<+++>"} +@startuml +<++> +@enduml +``` diff --git a/stow/vim/dot-vim/ftplugin/vimwiki/snips/template.txt b/stow/vim/dot-vim/ftplugin/vimwiki/snips/template.txt new file mode 100644 index 0000000..f6b16a8 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/vimwiki/snips/template.txt @@ -0,0 +1,15 @@ +--- +header-includes: + - \usepackage[margin=1.5in]{geometry} + +title: "Title" +author: +- Ãñigo Gutiérrez Fernández + + \ + + UO238186 +date: "10/04/2020" +--- + +# Introducción diff --git a/stow/vim/dot-vim/ftplugin/vimwiki/vimwiki.vim b/stow/vim/dot-vim/ftplugin/vimwiki/vimwiki.vim new file mode 100644 index 0000000..c361600 --- /dev/null +++ b/stow/vim/dot-vim/ftplugin/vimwiki/vimwiki.vim @@ -0,0 +1,39 @@ +" ~/.vim/ftplugin/vimwiki.vim +" vimwiki-specific vim configuration +" +" Syntastic linter: mdl, proselint, textlint + +"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 + +" Text width +match ColorColumn /\%81v/ +setlocal textwidth=80 +setlocal linebreak + +" Syntax highlighting colors +highlight Title ctermfg=blue +highlight TitleHash ctermfg=cyan +match TitleHash /^##*/ + +setlocal conceallevel=1 + +let mapleader = " " + +nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/vimwiki/vimwiki.vim<CR> +nnoremap <buffer> <leader>e :Errors<CR> + +nnoremap <buffer> <leader>tt :r ~/.vim/ftplugin/vimwiki/snips/template.txt<CR> +nnoremap <buffer> <leader>tp :r ~/.vim/ftplugin/vimwiki/snips/plantUml.txt<CR>/<+++><CR>cf> + +nnoremap <buffer> <leader>c :w<CR>:!toPDF.sh "%"<CR> +nnoremap <buffer> <leader>o :w<CR>:!toPDF.sh -o "%"<CR><CR> + +let mapleader = "," + +inoremap <buffer> <leader>h <Esc><<A +inoremap <buffer> <leader>l <Esc>>>A |