diff --git a/.gitmodules b/.gitmodules index b530002..d77862b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -148,12 +148,12 @@ [submodule "vim/plugins/ansible-vim"] path = vim/plugins/ansible-vim url = https://github.com/pearofducks/ansible-vim -[submodule "vim/plugins/traces.vim"] - path = vim/plugins/traces.vim - url = https://github.com/markonm/traces.vim [submodule "vim/plugins/vim-window-resize-easy"] path = vim/plugins/vim-window-resize-easy url = https://github.com/roxma/vim-window-resize-easy +[submodule "vim/plugins/traces.vim"] + path = vim/plugins/traces.vim + url = https://github.com/markonm/traces.vim [submodule "vim/plugins/nerdtree"] path = vim/plugins/nerdtree url = https://github.com/scrooloose/nerdtree diff --git a/vim/.vimrc b/vim/.vimrc index 8b9f7fa..687e2d1 100755 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,68 +1,54 @@ -set encoding=utf-8 +" Plugin Manager execute pathogen#infect('plugins/{}') execute pathogen#infect('snippets/{}') -autocmd vimenter * Helptags + +" Prepare central backup/swap/undo directory +let &undodir = expand('~/.vim/.undo') +let &backupdir = expand('~/.vim/.backup//') +let &directory = expand('~/.vim/.swp//') + syntax on filetype plugin on filetype plugin indent on -set number -set relativenumber -set autochdir + +set encoding=utf-8 + +" Use whitespace instead of tab set expandtab -let &undodir = expand('~/.vim/.undo') -let &backupdir = expand('~/.vim/.backup//') -let &directory = expand('~/.vim/.swp//') -set undofile - -colorscheme happy_hacking -source ~/.vim/config/plugin.vim -source ~/.vim/config/keybindings.vim - -" General editor settings +" Make a tabulator equal 4 spaces set tabstop=4 set shiftwidth=4 + +" Enable persistent undo +set undofile + +" Use relative line numbers +set number +set relativenumber + +" Set linelength indicator to 120 characters set cc=120 + +" Natural window splitting set splitbelow set splitright - -let g:netrw_liststyle = 3 -let g:netrw_browse_split = 4 -let g:netrw_winsize = 20 -let g:netrw_altv = 0 -let g:netrw_banner = 0 -let g:tex_conceal = "" - -function! ForceResizeNetrw() -let curWin = winnr() - for winnr in range(1, winnr('$')) - if getwinvar(winnr, '&ft')=="netrw" - if curWin != winnr - silent noautocmd exec winnr 'wincmd w' - silent noautocmd exec 'vertical resize ' . g:netrw_winsize - silent noautocmd exec curWin 'wincmd w' - else - silent noautocmd exec 'vertical resize ' . g:netrw_winsize - endif - endif - endfor -endfunction +" Set colors +colorscheme happy_hacking -autocmd WinEnter * call ForceResizeNetrw() -autocmd BufNew * call ForceResizeNetrw() +" Apply plugin configurations +source ~/.vim/config/plugin.vim -" R Markdown -function Rmarkdown() - set filetype=markdown - set conceallevel=0 - let g:markdown_syntax_conceal=0 - let g:markdown_fenced_languages=['r', 'python', 'html', 'sql', 'bash=sh'] -endfunction -autocmd BufNewFile,BufReadPost *.Rmd call Rmarkdown() -autocmd BufNewFile,BufReadPost *.rmd call Rmarkdown() +" Apply custom keybindings +source ~/.vim/config/keybindings.vim +" Apply settings for custom filetypes +source ~/.vim/config/filetypes.vim + +" Rebuild help files on startup +autocmd vimenter * Helptags " Transparency hi Normal guibg=NONE ctermbg=NONE diff --git a/vim/config/filetypes.vim b/vim/config/filetypes.vim new file mode 100644 index 0000000..5854216 --- /dev/null +++ b/vim/config/filetypes.vim @@ -0,0 +1,13 @@ +" This config includes custom settings for special filetypes + + +" Rmarkdown / .rmd +function Rmarkdown() + set filetype=markdown + set conceallevel=0 + let g:markdown_syntax_conceal=0 + let g:markdown_fenced_languages=['r', 'python', 'html', 'sql', 'bash=sh'] +endfunction +autocmd BufNewFile,BufReadPost *.Rmd call Rmarkdown() +autocmd BufNewFile,BufReadPost *.rmd call Rmarkdown() + diff --git a/vim/config/plugin.vim b/vim/config/plugin.vim index f84daa3..5b14f41 100644 --- a/vim/config/plugin.vim +++ b/vim/config/plugin.vim @@ -21,8 +21,6 @@ let g:airline_theme="minimalist" autocmd TextChanged * GitGutter - - " JavaComplete if has("autocmd") autocmd Filetype java setlocal omnifunc=javacomplete#CompleteParamsInfo