diff --git a/vim/config/after.vim b/vim/config/after.vim index 30e6d59..3c498fb 100644 --- a/vim/config/after.vim +++ b/vim/config/after.vim @@ -16,8 +16,9 @@ endif "when enabled, this will override each file type default and disable all line breaks (default: 1) if !exists("g:disablelinebreaks") - let g:disablelinebreaks=1 + let g:disablelinebreaks = 1 endif + if (g:disablelinebreaks == 1) autocmd VimEnter * set textwidth=0 endif diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim index 588e927..22adc89 100644 --- a/vim/config/plugins.vim +++ b/vim/config/plugins.vim @@ -14,10 +14,21 @@ scriptencoding utf-8 "INITIALIZE PLUGINS: {{{ "create missing plugin config files and directories - if exists('*mkdir')|if !isdirectory(glob("~/.vim/tags_by_filetype"))|call mkdir(glob("~/.vim/tags_by_filetype"),'p')|endif|endif - if !filereadable(glob("~/.vim/tags"))|new|silent e ~/.vim/tags|silent w|q|endif - if !filereadable(glob("~/.vim/snippets.json"))|new|silent e ~/.vim/snippets.json|silent w|q|endif - if !filereadable(glob("~/.vim/filetypes.vim"))|new|silent e ~/.vim/filetypes.vim|silent w|q|endif + if exists('*mkdir') && !isdirectory(glob("~/.vim/tags_by_filetype")) + call mkdir(glob("~/.vim/tags_by_filetype"),'p') + endif + + if !filereadable(glob("~/.vim/tags")) + new|silent e ~/.vim/tags|silent w|q + endif + + if !filereadable(glob("~/.vim/snippets.json")) + new|silent e ~/.vim/snippets.json|silent w|q + endif + + if !filereadable(glob("~/.vim/filetypes.vim")) + new|silent e ~/.vim/filetypes.vim|silent w|q + endif "load plugins in vim/bundle/ and vim/bundle.user/ execute pathogen#infect('bundle/{}', 'bundle.user/{}') diff --git a/vim/config/plugins/emmet-vim.vim b/vim/config/plugins/emmet-vim.vim index 68f3fe7..7028322 100644 --- a/vim/config/plugins/emmet-vim.vim +++ b/vim/config/plugins/emmet-vim.vim @@ -1,5 +1,5 @@ -let g:use_emmet_complete_tag=1 -let g:user_emmet_mode='a' +let g:use_emmet_complete_tag = 1 +let g:user_emmet_mode = 'a' if filereadable("~/.vim/snippets.json") let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.vim/snippets.json')), "\n")) diff --git a/vim/config/plugins/gundo.vim b/vim/config/plugins/gundo.vim index 382d342..eb730d8 100644 --- a/vim/config/plugins/gundo.vim +++ b/vim/config/plugins/gundo.vim @@ -1,5 +1,5 @@ -let g:gundo_right=0 -let g:gundo_width=35 -let g:gundo_preview_height=10 +let g:gundo_right = 0 +let g:gundo_width = 35 +let g:gundo_preview_height = 10 autocmd FileType gundo setlocal nocursorcolumn diff --git a/vim/config/plugins/incsearch.vim b/vim/config/plugins/incsearch.vim index c198552..f1a54ff 100644 --- a/vim/config/plugins/incsearch.vim +++ b/vim/config/plugins/incsearch.vim @@ -4,4 +4,4 @@ map ? (incsearch-backward) map g/ (incsearch-stay) "n and N behavioru is consistant -let g:incsearch#consistent_n_direction=1 +let g:incsearch#consistent_n_direction = 1 diff --git a/vim/config/plugins/lightline.vim b/vim/config/plugins/lightline.vim index b95e4f2..69a59ca 100644 --- a/vim/config/plugins/lightline.vim +++ b/vim/config/plugins/lightline.vim @@ -32,7 +32,6 @@ function! LLFugitive() return strlen(_) ? mark._ : '' endif catch - endtry return '' @@ -80,7 +79,7 @@ endfunction "status bar config with and without powerline fonts (default: 0) if !exists("g:powerlinefonts") - let g:powerlinefonts=0 + let g:powerlinefonts = 0 endif if (g:powerlinefonts == 1) diff --git a/vim/config/plugins/syntastic.vim b/vim/config/plugins/syntastic.vim index 4b39fba..888e668 100644 --- a/vim/config/plugins/syntastic.vim +++ b/vim/config/plugins/syntastic.vim @@ -1,71 +1,81 @@ "autostart syntax checking when vim opens to a compatible filetype (default: 0) if !exists("g:autostartchecker") - let g:autostartchecker=0 + let g:autostartchecker = 0 endif if &diff - let g:autostartchecker=0 + let g:autostartchecker = 0 else if (g:autostartchecker == 1) - let g:syntastic_mode_map={ + let g:syntastic_mode_map = { \ 'mode':'active', \ 'active_filetypes':[], \ 'passive_filetypes':[] \ } - let g:syntastic_check_on_open=1 + + let g:syntastic_check_on_open = 1 else - let g:syntastic_mode_map={ + let g:syntastic_mode_map = { \ 'mode':'passive', \ 'active_filetypes':[], \ 'passive_filetypes':[] \ } - let g:syntastic_check_on_open=0 + + let g:syntastic_check_on_open = 0 endif "configure warnings/errors that should be silenced by module - let g:syntastic_less_lessc_quiet_messages={ + let g:syntastic_less_lessc_quiet_messages = { \ 'regex':[ \ 'NameError:.* is undefined', \ 'FileError:.*' \ ]} - let g:syntastic_scss_sass_quiet_messages={ + + let g:syntastic_scss_sass_quiet_messages = { \ 'regex':[ \ 'File to import not found or unreadable.*' \ ]} - let g:syntastic_java_javac_quiet_messages={ + + let g:syntastic_java_javac_quiet_messages = { \ 'regex':[ \ 'cannot find symbol.*', \ 'method does not override or implement a method from a supertype.*', \ 'package [^\ ]* does not exist.*' \ ]} - let g:syntastic_javascript_eslint_quiet_messages={ + + let g:syntastic_javascript_eslint_quiet_messages = { \ 'regex':[ \ '.* is defined but never used', \ "'[^']*' is not defined", \ 'Missing "use strict" statement', \ 'Unexpected [^ ]* statement.*' \ ]} - let g:syntastic_javascript_jshint_quiet_messages={ + + let g:syntastic_javascript_jshint_quiet_messages = { \ 'regex':[ \ 'Expected an assignment or function call and instead saw an expression.' \ ]} - let g:syntastic_javascript_standard_quiet_messages={ + + let g:syntastic_javascript_standard_quiet_messages = { \ 'regex':[ \ '.* is defined but never used', \ "'[^']*' is not defined" \ ]} - let g:syntastic_markdown_mdl_quiet_messages={ + + let g:syntastic_markdown_mdl_quiet_messages = { \ 'regex':[ \ '.*MD013.*', \ '.*MD002.*', \ '.*MD029.*' \ ]} - let g:syntastic_python_flake8_quiet_messages={ + + let g:syntastic_python_flake8_quiet_messages = { \ 'regex':[ \ '.*\[W293\]', \ '.*\[E501\]' \ ]} - let g:syntastic_php_phpmd_quiet_messages={ + + let g:syntastic_php_phpmd_quiet_messages = { \ 'regex':[ \ 'Avoid using short method names like.*', \ 'Avoid variables with short names like.*', @@ -79,11 +89,13 @@ else \ 'The class.*has.*public methods.*', \ 'The class.*lines of code' \ ]} - let g:syntastic_sh_bashate_quiet_messages={ + + let g:syntastic_sh_bashate_quiet_messages = { \ 'regex':[ \ 'Indent not multiple of 4' \ ]} - let g:syntastic_sh_shellcheck_quiet_messages={ + + let g:syntastic_sh_shellcheck_quiet_messages = { \ 'regex':[ \ '.*\[SC1001\]', \ '.*\[SC2015\]', @@ -95,17 +107,18 @@ else \ '.*follow non-constant source', \ 'Not following:' \ ]} - autocmd BufNewFile,BufRead PKGBUILD,bash.bashrc,.bashrc let g:syntastic_quiet_messages={"level":"warnings"} - let g:syntastic_check_on_wq=0 - let g:syntastic_always_populate_loc_list=1 - let g:syntastic_auto_loc_list=1 - let g:syntastic_loc_list_height=5 + autocmd BufNewFile,BufRead PKGBUILD,bash.bashrc,.bashrc let g:syntastic_quiet_messages = {"level":"warnings"} + + let g:syntastic_check_on_wq = 0 + let g:syntastic_always_populate_loc_list = 1 + let g:syntastic_auto_loc_list = 1 + let g:syntastic_loc_list_height = 5 endif "function to enable syntastic and set check_on_open on function s:SyntasticToggleOn() - let g:syntastic_check_on_open=1 + let g:syntastic_check_on_open = 1 if (g:syntastic_mode_map.mode == "passive") SyntasticToggleMode @@ -116,7 +129,7 @@ command! -buffer SyntasticToggleOn call s:SyntasticToggleOn() "function to disable syntastic and set check_on_open off function s:SyntasticToggleOff() - let g:syntastic_check_on_open=0 + let g:syntastic_check_on_open = 0 if (g:syntastic_mode_map.mode == "active") SyntasticToggleMode diff --git a/vim/config/plugins/tagbar.vim b/vim/config/plugins/tagbar.vim index e006934..802b279 100644 --- a/vim/config/plugins/tagbar.vim +++ b/vim/config/plugins/tagbar.vim @@ -1,16 +1,16 @@ "autostart tagbar when vim opens to a compatible filetype (default: 0) if !exists("g:autostarttagbar") - let g:autostarttagbar=0 + let g:autostarttagbar = 0 endif if !&diff && (g:autostarttagbar == 1) autocmd VimEnter * nested :call tagbar#autoopen(1) endif -let g:tagbar_sort=0 -let g:tagbar_compact=1 -let g:tagbar_singleclick=1 -let g:tagbar_width=35 -let g:tagbar_autofocus=1 +let g:tagbar_sort = 0 +let g:tagbar_compact = 1 +let g:tagbar_singleclick = 1 +let g:tagbar_width = 35 +let g:tagbar_autofocus = 1 autocmd FileType tagbar setlocal nocursorcolumn diff --git a/vim/config/plugins/tcommand.vim b/vim/config/plugins/tcommand.vim index 55caff7..80e514d 100644 --- a/vim/config/plugins/tcommand.vim +++ b/vim/config/plugins/tcommand.vim @@ -1 +1 @@ -let g:tcommand#include_history=0 +let g:tcommand#include_history = 0 diff --git a/vim/config/plugins/tcomment.vim b/vim/config/plugins/tcomment.vim index 232c07e..72de7a5 100644 --- a/vim/config/plugins/tcomment.vim +++ b/vim/config/plugins/tcomment.vim @@ -1 +1,2 @@ -let g:tcomment#rstrip_on_uncomment=2 "remove right-hand whitespace from all lines on uncomment +"remove right-hand whitespace from all lines on uncomment +let g:tcomment#rstrip_on_uncomment = 2 diff --git a/vim/config/plugins/vim-easytags.vim b/vim/config/plugins/vim-easytags.vim index d884e11..6c5e526 100644 --- a/vim/config/plugins/vim-easytags.vim +++ b/vim/config/plugins/vim-easytags.vim @@ -1,22 +1,22 @@ -let g:easytags_suppress_ctags_warning=1 +let g:easytags_suppress_ctags_warning = 1 if filereadable(glob("~/.vim/tags")) - let g:easytags_file='~/.vim/tags' + let g:easytags_file = '~/.vim/tags' endif if isdirectory(glob("~/.vim/tags_by_filetype")) - let g:easytags_by_filetype='~/.vim/tags_by_filetype' + let g:easytags_by_filetype = '~/.vim/tags_by_filetype' endif "prevent automatically generating the tagfile and syntax highlighting tags (default: 0) if !exists("g:disableautotags") - let g:disableautotags=0 + let g:disableautotags = 0 endif if (g:disableautotags == 1) - let g:easytags_auto_update=0 - let g:easytags_auto_highlight=0 + let g:easytags_auto_update = 0 + let g:easytags_auto_highlight = 0 else - let g:easytags_auto_update=1 - let g:easytags_auto_highlight=1 + let g:easytags_auto_update = 1 + let g:easytags_auto_highlight = 1 endif diff --git a/vim/config/plugins/vim-signify.vim b/vim/config/plugins/vim-signify.vim index 6ac1e1f..2f36011 100644 --- a/vim/config/plugins/vim-signify.vim +++ b/vim/config/plugins/vim-signify.vim @@ -1,4 +1,4 @@ -let g:signify_sign_add='+' -let g:signify_sign_change='!' -let g:signify_sign_delete='-' -let g:signify_sign_delete_first_line='~' +let g:signify_sign_add = '+' +let g:signify_sign_change = '!' +let g:signify_sign_delete = '-' +let g:signify_sign_delete_first_line = '~' diff --git a/vim/config/plugins/vimfiler.vim b/vim/config/plugins/vimfiler.vim index f7cbf22..3daff54 100644 --- a/vim/config/plugins/vimfiler.vim +++ b/vim/config/plugins/vimfiler.vim @@ -1,22 +1,22 @@ "autostart filer when vim opens to an empty buffer (default: 1) if !exists("g:autostartfiler") - let g:autostartfiler=1 + let g:autostartfiler = 1 endif if (g:autostartfiler == 1) autocmd VimEnter * if !argc() | VimFiler -quit -project | endif endif -let g:vimfiler_as_default_explorer=1 -let g:vimfiler_safe_mode_by_default=0 -let g:vimfiler_enable_auto_cd=1 +let g:vimfiler_as_default_explorer = 1 +let g:vimfiler_safe_mode_by_default = 0 +let g:vimfiler_enable_auto_cd = 1 -let g:vimfiler_tree_indentation=2 -let g:vimfiler_explorer_columns='type:time' -let g:vimfiler_tree_closed_icon='▸' "['▶', '▼'], ['▸', '▾'], ['▷', '◢'] -let g:vimfiler_tree_opened_icon='▾' -let g:vimfiler_file_icon='-' -let g:vimfiler_marked_file_icon='+' +let g:vimfiler_tree_indentation = 2 +let g:vimfiler_explorer_columns = 'type:time' +let g:vimfiler_tree_closed_icon = '▸' "['▶', '▼'], ['▸', '▾'], ['▷', '◢'] +let g:vimfiler_tree_opened_icon = '▾' +let g:vimfiler_file_icon = '-' +let g:vimfiler_marked_file_icon = '+' "edit files by double clicking them, and justify the cursor on the left autocmd FileType vimfiler setlocal nonumber nocursorcolumn diff --git a/vim/config/settings.vim b/vim/config/settings.vim index 4b7e1f6..07624d6 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -25,12 +25,20 @@ "use the '*' register as well as the the '+' register if it's available too set clipboard=unnamed - if has('unnamedplus')|set clipboard+=unnamedplus|endif + + if has('unnamedplus') + set clipboard+=unnamedplus + endif "fancy mouse reporting with xterm2 fallback if !has('nvim') - if has("mouse_sgr")|set ttymouse=sgr|else|set ttymouse=xterm2|endif + if has("mouse_sgr") + set ttymouse=sgr + else + set ttymouse=xterm2 + endif endif + set mouse=a "enables mouse functionality with extended capabilities "8 colours in $TERM=linux, 256 elsewhere @@ -39,10 +47,14 @@ "configure to primarily use utf8 if has("multi_byte") - if &termencoding == ""|let &termencoding = &encoding|endif + if &termencoding == "" + let &termencoding = &encoding + endif + set encoding=utf-8 setglobal fileencoding=utf-8 endif + set fileformats=unix,dos,mac "set compatible line endings in order of preference "}}} @@ -72,7 +84,7 @@ set list listchars=tab:>-,trail:- "display tabs as: >--- and trailing spaces as: - set showmatch "show matching open bracket when closed bracket is inserted set matchtime=5 "the amount of time before the matching bracket will highlight - let &showbreak="" "character to prepend to wrapped lines when linewrapping is enabled + let &showbreak = "" "character to prepend to wrapped lines when linewrapping is enabled "enable tab completion in command mode and configure how it handles extensions set completeopt=longest,menuone @@ -91,7 +103,10 @@ set ttimeout ttimeoutlen=100 "how long before timing out for terminal key codes "create ~/.vim/swap if necessary, then use as default swap file location - if !isdirectory($HOME.'/.vim/swap')|call mkdir($HOME.'/.vim/swap','p')|endif + if exists('*mkdir') && !isdirectory($HOME.'/.vim/swap') + call mkdir($HOME.'/.vim/swap','p') + endif + set directory=$HOME/.vim/swap,.,/var/tmp,/tmp "FUNCTIONS: {{{ @@ -100,10 +115,14 @@ if !exists('*s:MakeNewDir') function s:MakeNewDir(fullpath, buf) if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/' - let dirpath=fnamemodify(a:fullpath,':h') - if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif + let dirpath = fnamemodify(a:fullpath,':h') + + if !isdirectory(dirpath) + call mkdir(dirpath,'p') + endif endif endfunction + augroup WriteDir autocmd! autocmd BufWritePre * :call s:MakeNewDir(expand(''),+expand('')) @@ -121,26 +140,34 @@ function s:SPResize33() sp|wincmd =|q endfunction + function s:sp33() sp|call s:SPResize33()|wincmd j endfunction + command! -buffer SP33 call s:sp33() + function s:sp66() sp|wincmd j|call s:SPResize33() endfunction + command! -buffer SP66 call s:sp66() "functions to create a vertical split using 33% and 66% width function s:VSResize66() vs|wincmd =|q endfunction + function s:vs66() vs|call s:VSResize66() endfunction + command! -buffer VS66 call s:vs66() + function s:vs33() vs|wincmd h|call s:VSResize66()|wincmd l endfunction + command! -buffer VS33 call s:vs33() "}}} "}}}