diff --git a/ftplugin/javascript/common.vim b/ftplugin/javascript/common.vim deleted file mode 100644 index b1f739b..0000000 --- a/ftplugin/javascript/common.vim +++ /dev/null @@ -1,5 +0,0 @@ -setlocal foldmethod=syntax -setlocal list - -" reformat json struct -map ] :%!python -m json.tool diff --git a/ftplugin/json b/ftplugin/json deleted file mode 120000 index f504a95..0000000 --- a/ftplugin/json +++ /dev/null @@ -1 +0,0 @@ -javascript \ No newline at end of file diff --git a/ftplugin/markdown/commons.vim b/ftplugin/markdown/commons.vim deleted file mode 100644 index 38a45e0..0000000 --- a/ftplugin/markdown/commons.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Some common settings for all reSt files -setlocal textwidth=80 -setlocal makeprg=md2html.py\ \"%\"\ \"%:p:r.html\" -setlocal spell -setlocal smartindent -setlocal autoindent -setlocal formatoptions=tcq "set VIms default - -autocmd BufWritePost *.md :silent make diff --git a/ftplugin/python/common.vim b/ftplugin/python/common.vim deleted file mode 100644 index beffb13..0000000 --- a/ftplugin/python/common.vim +++ /dev/null @@ -1,39 +0,0 @@ -setlocal cinkeys-=0# -setlocal indentkeys-=0# -setlocal foldlevel=100 -setlocal foldmethod=indent -setlocal list -setlocal noautoindent -setlocal smartindent -setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with -setlocal smarttab - -setlocal statusline=%<%F " filename (fullpath) -setlocal statusline+=\ %h " indicator for help buffer -setlocal statusline+=%m " modified flag -setlocal statusline+=%r " readonly flag -setlocal statusline+=\ %{TagInStatusLine()} " current tag and its type -setlocal statusline+=%= " switch to the right -setlocal statusline+=%(%l,%c%V%) " line, column and virtual column -setlocal statusline+=\ %3p%% " percentage of the file - -set wildignore+=*.pyc - -inoremap # X# - -"set ofu=syntaxcomplete#Complete - -"autocmd FileType python setlocal omnifunc=pysmell#Complete -let python_highlight_all=1 - -"I don't want to have pyflakes errors in qfix, it interfering with Pep8/Pylint -let g:pyflakes_use_quickfix = 0 - -"Load views for py files -autocmd BufWinLeave *.py mkview -autocmd BufWinEnter *.py silent loadview - -"Something bad happens for python comments - it places 2 spaces instead of 1 -"after the # sign. Workaround: -let g:NERDCustomDelimiters = {'python': {'left': '#'}} -let g:NERDSpaceDelims = 0 diff --git a/ftplugin/rst/commons.vim b/ftplugin/rst/commons.vim deleted file mode 100644 index c1e6312..0000000 --- a/ftplugin/rst/commons.vim +++ /dev/null @@ -1,23 +0,0 @@ -" Some common settings for all reSt files -setlocal textwidth=79 -let &makeprg = 'rst2html.py --syntax-highlight=short --stylesheet ' . expand(':p:h', 1) . '/style.css "%" "%:p:r.html"' - -setlocal spell -setlocal smartindent -setlocal autoindent -setlocal formatoptions=tcq "set VIms default - -function! ShowInBrowser() - let l:uri = expand("%:p:r") . ".html" - silent make - call system(g:browser . " " . l:uri) - - echohl Statement - echo "Opened '" . l:uri ."' in " . g:browser - echohl None -endfunction - -if !exists(":ShowInBrowser") - command ShowInBrowser call s:ShowInBrowser() - map :ShowInBrowser -endif diff --git a/ftplugin/rst/style.css b/ftplugin/rst/style.css deleted file mode 100644 index 6e3887c..0000000 --- a/ftplugin/rst/style.css +++ /dev/null @@ -1,183 +0,0 @@ -/* simple stylesheet for preview rst files in HTML */ -html { - margin: 0; - padding: 0; -} - -body { - font-family: Helvetica,Arial,sans-serif; - margin: 0; - padding: 0; - color: rgb(51, 51, 51); -} -a { - color: rgb(64, 120, 192); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -img { - max-width: 100%; - height: auto; -} - -.document { - margin-left: auto; - margin-right: auto; - margin-bottom: 2em; - margin-top: 2em; - width: 60em; - padding: 3em; - - word-wrap: break-word; - background-color: rgb(255, 255, 255); - border: 1px solid rgb(221, 221, 221); - border-radius: 4px 4px 4px 4px; -} - -input { - background: none repeat scroll 0 0 #555; - border: medium none; - border-radius: 5px 5px 5px 5px; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) inset; - padding: 4px 7px; - transition: width 0.7s ease 0s; -} - -/* Pygments highlighting classes */ - -.code { - font: 12px Consolas,"Liberation Mono",Menlo,Courier,monospace; - margin: 0; - padding: 16px; - overflow: auto; - line-height: 1.45; - background-color: rgb(247, 24, 247); - border-radius: 4px 4px 4px 4px; -} - -.code pre { - padding: 0; - margin: 0; - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: rgb(47, 247, 247); - border-radius: 4px 4px 4px 4px; -} - -.code .hll { background-color: #ffffcc } -.code { background: #f8f8f8; } -.code .c { color: #408080; font-style: italic } /* Comment */ -.code .err { border: 1px solid #FF0000 } /* Error */ -.code .k { color: #008000; font-weight: bold } /* Keyword */ -.code .o { color: #666666 } /* Operator */ -.code .ch { color: #408080; font-style: italic } /* Comment.Hashbang */ -.code .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -.code .cp { color: #BC7A00 } /* Comment.Preproc */ -.code .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ -.code .c1 { color: #408080; font-style: italic } /* Comment.Single */ -.code .cs { color: #408080; font-style: italic } /* Comment.Special */ -.code .gd { color: #A00000 } /* Generic.Deleted */ -.code .ge { font-style: italic } /* Generic.Emph */ -.code .gr { color: #FF0000 } /* Generic.Error */ -.code .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -.code .gi { color: #00A000 } /* Generic.Inserted */ -.code .go { color: #888888 } /* Generic.Output */ -.code .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -.code .gs { font-weight: bold } /* Generic.Strong */ -.code .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -.code .gt { color: #0044DD } /* Generic.Traceback */ -.code .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ -.code .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ -.code .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ -.code .kp { color: #008000 } /* Keyword.Pseudo */ -.code .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ -.code .kt { color: #B00040 } /* Keyword.Type */ -.code .m { color: #666666 } /* Literal.Number */ -.code .s { color: #BA2121 } /* Literal.String */ -.code .na { color: #7D9029 } /* Name.Attribute */ -.code .nb { color: #008000 } /* Name.Builtin */ -.code .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -.code .no { color: #880000 } /* Name.Constant */ -.code .nd { color: #AA22FF } /* Name.Decorator */ -.code .ni { color: #999999; font-weight: bold } /* Name.Entity */ -.code .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -.code .nf { color: #0000FF } /* Name.Function */ -.code .nl { color: #A0A000 } /* Name.Label */ -.code .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -.code .nt { color: #008000; font-weight: bold } /* Name.Tag */ -.code .nv { color: #19177C } /* Name.Variable */ -.code .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -.code .w { color: #bbbbbb } /* Text.Whitespace */ -.code .mb { color: #666666 } /* Literal.Number.Bin */ -.code .mf { color: #666666 } /* Literal.Number.Float */ -.code .mh { color: #666666 } /* Literal.Number.Hex */ -.code .mi { color: #666666 } /* Literal.Number.Integer */ -.code .mo { color: #666666 } /* Literal.Number.Oct */ -.code .sb { color: #BA2121 } /* Literal.String.Backtick */ -.code .sc { color: #BA2121 } /* Literal.String.Char */ -.code .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ -.code .s2 { color: #BA2121 } /* Literal.String.Double */ -.code .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -.code .sh { color: #BA2121 } /* Literal.String.Heredoc */ -.code .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -.code .sx { color: #008000 } /* Literal.String.Other */ -.code .sr { color: #BB6688 } /* Literal.String.Regex */ -.code .s1 { color: #BA2121 } /* Literal.String.Single */ -.code .ss { color: #19177C } /* Literal.String.Symbol */ -.code .bp { color: #008000 } /* Name.Builtin.Pseudo */ -.code .vc { color: #19177C } /* Name.Variable.Class */ -.code .vg { color: #19177C } /* Name.Variable.Global */ -.code .vi { color: #19177C } /* Name.Variable.Instance */ -.code .il { color: #666666 } /* Literal.Number.Integer.Long */ - -h1.title { - padding-bottom: 0.3em; - font-size: 2em; - border-bottom: 1px solid rgb(238, 238, 238); -} - -h1 { - border-bottom: 1px solid rgb(238, 238, 238); - font-size: 1.5em; - padding-bottom: 0.3em; -} - -h2 { - font-size: 1.25em; -} - -h3 { - font-size: 1.12em; -} - -h4 { - font-size: 1.6em; -} - -h5 { - font-size: 1.3em; -} - -h6 { - font-size: 1.1em; -} - -.figure { - margin: 0 auto 2em; - padding: 5px; - text-align: center; -} - -.figure p { - font-size: 0.9em; -} - -.figure img, table.results { - border: 2px solid black; -} diff --git a/ftplugin/rst/word_utils.vim b/ftplugin/rst/word_utils.vim deleted file mode 100644 index 9ef4f50..0000000 --- a/ftplugin/rst/word_utils.vim +++ /dev/null @@ -1,29 +0,0 @@ -function! WordFrequency() range - let all = split(join(getline(a:firstline, a:lastline)), '\k\+') - let frequencies = {} - for word in all - let frequencies[word] = get(frequencies, word, 0) + 1 - endfor - new - setlocal buftype=nofile bufhidden=hide noswapfile tabstop=4 - for [key,value] in items(frequencies) - call append('$', value."\t".key) - endfor - sort i -endfunction -command! -range=% WordFrequency ,call WordFrequency() - -function! CreateDict() range - let all = split(join(getline(a:firstline, a:lastline)), '[^A-Za-zęóąśłżźćńĘÓĄŚŁŻŹĆŃ]\+') - let frequencies = {} - for word in all - let frequencies[word] = get(frequencies, word, 0) + 1 - endfor - new - setlocal buftype=nofile bufhidden=hide noswapfile - for [key,value] in items(frequencies) - call append('$', key) - endfor - sort i -endfunction -command! -range=% CreateDict ,call CreateDict() diff --git a/ftplugin/snippet/common.vim b/ftplugin/snippet/common.vim deleted file mode 100644 index 908cd46..0000000 --- a/ftplugin/snippet/common.vim +++ /dev/null @@ -1,8 +0,0 @@ -set nolist -set tabstop=4 -set autoindent -"set foldmethod=manual -set noexpandtab -set shiftwidth=4 -set noexpandtab -set list diff --git a/ftplugin/sql/common.vim b/ftplugin/sql/common.vim deleted file mode 100644 index b45b038..0000000 --- a/ftplugin/sql/common.vim +++ /dev/null @@ -1,4 +0,0 @@ -set nolist -set nosmartindent -set autoindent -set foldmethod=manual diff --git a/ftplugin/vim/common.vim b/ftplugin/vim/common.vim deleted file mode 100644 index b45b038..0000000 --- a/ftplugin/vim/common.vim +++ /dev/null @@ -1,4 +0,0 @@ -set nolist -set nosmartindent -set autoindent -set foldmethod=manual diff --git a/ftplugin/yaml/common.vim b/ftplugin/yaml/common.vim deleted file mode 100644 index d6a1455..0000000 --- a/ftplugin/yaml/common.vim +++ /dev/null @@ -1,5 +0,0 @@ -" Set indents compatible to yaml specification -setlocal softtabstop=2 -setlocal tabstop=2 -setlocal shiftwidth=2 -setlocal expandtab diff --git a/vimrc b/vimrc index 872c992..c74df51 100644 --- a/vimrc +++ b/vimrc @@ -170,7 +170,161 @@ let html_use_encoding = "utf-8" "Set the browser executable let g:browser = 'xdg-open' "}}} -"COMMON: specific vim behaviour {{{ +"FileTypes: specific vim behaviour {{{ +function s:SetPythonSettings() "{{{2 + " Python specific options + setlocal cinkeys-=0# + setlocal indentkeys-=0# + setlocal foldlevel=100 + setlocal foldmethod=indent + setlocal list + setlocal noautoindent + setlocal smartindent + setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with + setlocal smarttab + + setlocal statusline=%<%F " filename (fullpath) + setlocal statusline+=\ %h " indicator for help buffer + setlocal statusline+=%m " modified flag + setlocal statusline+=%r " readonly flag + setlocal statusline+=\ %{TagInStatusLine()} " current tag and its type + setlocal statusline+=%= " switch to the right + setlocal statusline+=%(%l,%c%V%) " line, column and virtual column + setlocal statusline+=\ %3p%% " percentage of the file + + set wildignore+=*.pyc + + inoremap # X# + + "set ofu=syntaxcomplete#Complete + + "autocmd FileType python setlocal omnifunc=pysmell#Complete + let python_highlight_all=1 + + "I don't want to have pyflakes errors in qfix, it interfering with + "Pep8/Pylint + let g:pyflakes_use_quickfix = 0 + + "Load views for py files + autocmd BufWinLeave *.py mkview + autocmd BufWinEnter *.py silent loadview + + "Something bad happens for python comments - it places 2 spaces instead + "of 1 after the # sign. Workaround: + let g:NERDCustomDelimiters = {'python': {'left': '#'}} + let g:NERDSpaceDelims = 0 +endfunction +"}}} +function s:SetJavaScriptSettings() "{{{2 + setlocal foldmethod=syntax + setlocal list + + " reformat json struct + map ] :%!python -m json.tool +endfunction +"}}} +function s:SetMarkdownSettings() "{{{2 + setlocal textwidth=80 + setlocal makeprg=md2html.py\ \"%\"\ \"%:p:r.html\" + setlocal spell + setlocal smartindent + setlocal autoindent + setlocal formatoptions=tcq "set VIms default + + autocmd BufWritePost *.md :silent make +endfunction +"}}} +function s:SetSnippetSettings() "{{{2 + set nolist + set tabstop=4 + set autoindent + "set foldmethod=manual + set noexpandtab + set shiftwidth=4 + set noexpandtab + set list +endfunction +"}}} +function s:SetSqlSettings() "{{{2 + set nolist + set nosmartindent + set autoindent + set foldmethod=manual +endfunction +"}}} +function s:SetVimSettings() "{{{2 + set nolist + set nosmartindent + set autoindent + set foldmethod=manual +endfunction +"}}} +function s:SetYamlSettings() "{{{2 + " Set indents compatible to yaml specification + setlocal softtabstop=2 + setlocal tabstop=2 + setlocal shiftwidth=2 + setlocal expandtab +endfunction +"}}} +function s:SetRestSettings() "{{{2 + " Some common settings for all reSt files + setlocal textwidth=79 + let &makeprg = 'rst2html.sh "%" "%:p:r.html"' + + setlocal spell + setlocal smartindent + setlocal autoindent + setlocal formatoptions=tcq "set VIms default + + function! ShowInBrowser() + let l:uri = expand("%:p:r") . ".html" + silent make + call system(g:browser . " " . l:uri) + + echohl Statement + echo "Opened '" . l:uri ."' in " . g:browser + echohl None + endfunction + + if !exists(":ShowInBrowser") + command ShowInBrowser call s:ShowInBrowser() + map :ShowInBrowser + endif + + function! WordFrequency() range + let all = split(join(getline(a:firstline, a:lastline)), '\k\+') + let frequencies = {} + for word in all + let frequencies[word] = get(frequencies, word, 0) + 1 + endfor + new + setlocal buftype=nofile bufhidden=hide noswapfile tabstop=4 + for [key,value] in items(frequencies) + call append('$', value."\t".key) + endfor + sort i + endfunction + command! -range=% WordFrequency ,call WordFrequency() + + function! CreateDict() range + let all = split(join(getline(a:firstline, a:lastline)), + \ '[^A-Za-zęóąśłżźćńĘÓĄŚŁŻŹĆŃ]\+') + let frequencies = {} + for word in all + let frequencies[word] = get(frequencies, word, 0) + 1 + endfor + new + setlocal buftype=nofile bufhidden=hide noswapfile + for [key,value] in items(frequencies) + call append('$', key) + endfor + sort i + endfunction + command! -range=% CreateDict ,call CreateDict() + +endfunction +"}}} "remove all trailing whitespace for specified files before write autocmd BufWritePre * :call StripTrailingWhitespaces(0, 'n') @@ -183,6 +337,17 @@ autocmd BufRead *.ass, *asm set filetype=kickass " make the current line highlighted only on current window autocmd WinEnter * setlocal cursorline autocmd WinLeave * setlocal nocursorline + +autocmd FileType python call SetPythonSettings() +autocmd FileType json call SetJavaScriptSettings() +autocmd FileType javascript call SetJavaScriptSettings() +autocmd FileType rst call SetRestSettings() +autocmd FileType yaml call SetRestSettings() +autocmd FileType snippet call SetSnippetSettings() +autocmd FileType sql call SetSqlSettings() +autocmd FileType markdown call SetMarkdownSettings() +autocmd FileType vim call SetVimSettings() + " }}} "TERMINAL: options for terminal emulators {{{ if $TERM == 'rxvt-unicode-256color' || $TERM == 'xterm' @@ -271,12 +436,12 @@ let g:languagetool_jar='/opt/LanguageTool/languagetool-commandline.jar' "}}} "mark {{{2 " addidtional colors -- -fun! s:CustomHighlightings() +function s:CustomHighlightings() highlight def MarkWord7 ctermbg=White ctermfg=Black guibg=#E8E8E8 guifg=Black highlight def MarkWord8 ctermbg=LightGray ctermfg=Black guibg=#C0C0C0 guifg=Black highlight def MarkWord9 ctermbg=DarkYellow ctermfg=Black guibg=#FFC299 guifg=Black highlight def MarkWord10 ctermbg=DarkGreen ctermfg=Black guibg=#6E9954 guifg=Black -endfun +endfunction autocmd ColorScheme * call CustomHighlightings() "}}}