From a731c14e48897a171e616bb291c77ff8a7652b18 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Mon, 25 May 2015 16:10:23 -0300 Subject: [PATCH] A few more tweaks Enabled the save undo feature, but now it's cluttering my filesystem with *.un~ files (something I need to give a more deeper look now). Moved the autocommand for styles to a single section, so now they are all grouped in the same place. --- configs/gvimrc | 6 ++-- configs/vimrc | 87 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 31 deletions(-) diff --git a/configs/gvimrc b/configs/gvimrc index 32819f1..b956210 100644 --- a/configs/gvimrc +++ b/configs/gvimrc @@ -3,15 +3,15 @@ set columns=116 " number of columns (uses most of my screen, in this case) set cursorline " highlight the line with the cursor set colorcolumn=+2 " put a marker at textwidth + 2 set linespace=1 " spread the lines a bit, adding a 1px line above all +set t_vb= " disable the visual bell if has('mac') set gfn=monofur:h15 " My screen size sucks, mkay? set lines=63 " number of lines, based on my screen size and font else - set gfn=monofur\ for\ Powerline\ 12 + " set gfn=monofur\ for\ Powerline\ 12 set lines=54 - let g:Powerline_symbols = 'fancy' - color hybrid + " let g:Powerline_symbols = 'fancy' endif if filereadable(expand("~/.vim/local.gvimrc")) diff --git a/configs/vimrc b/configs/vimrc index 8300cbe..0e58950 100644 --- a/configs/vimrc +++ b/configs/vimrc @@ -56,6 +56,8 @@ set wim=longest,list " file auto-completion set background=dark " to follow most of the colorschemes I use set vb t_vb= " convert bells to visual bells and do nothing as visual bell set t_Co=256 " 256 color terminals +set modeline " Enable modelines +set undofile " saves undo changes in a separate file, so we can undo anytime let mapleader="," " use comma to start user-defined (in plugins) functions @@ -115,6 +117,7 @@ Plugin 'EditPlus' Plugin 'altercation/vim-colors-solarized' Plugin 'w0ng/vim-hybrid' Plugin 'baycomb' +Plugin 'tomasr/molokai' " Improved syntax files Plugin 'Glench/Vim-Jinja2-Syntax' @@ -133,6 +136,9 @@ Plugin 'xolox/vim-easytags' Plugin 'Shougo/vimproc' Plugin 'Shougo/vimshell.vim' +" Undo +Plugin 'sjl/gundo.vim' + " Mega-autocomplete " Plugin 'Valloric/YouCompleteMe' @@ -163,6 +169,9 @@ autocmd BufReadPost * augroup END +" Files that should be ignored in most file operations +set wildignore+=*/build/*,*.egginfo,*.pyc,*.mo,*/dist/* + " ---------------------------------------------------------------------- " Auto-commands " ---------------------------------------------------------------------- @@ -171,38 +180,72 @@ augroup END " (use spaces instead of tabs (expandtab), uses 4 spaces for tabs (tabstop), " when auto-indenting, also use 4 spaces (shiftwidth), when deleting text, 4 " spaces are a tab (softtabstop) and break the line at column 78 (textwidth)) +" also, remove all tailing spaces au FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=78 colorcolumn=79 - -" Python files should not have empty lines au FileType python autocmd BufWritePre :%s/\s\+$//e +" Default C/C++ style +" show a column marker at column 100, break the line at line 100, use tabs +" instead of sapces and display a "¦" for tabs (this way we can see the lines +" that are not using real tabs) +au FileType c setlocal colorcolumn=100 tw=100 noet list lcs=tab:¦\ +au FileType c autocmd BufWritePre :%s/\s\+$//e +au FileType cpp setlocal colorcolumn=100 tw=100 noet list lcs=tab:¦\ +au FileType cpp autocmd BufWritePre :%s/\s\+$//e + +" Default ReStructured document style " reStructured files follow python closely, but use 3 tab stops instead of 4 au FileType rst setlocal expandtab tabstop=3 sw=3 sts=3 textwidth=78 -" templates (Jinja2 in this case) will use tabs instead (to reduce file size) +" Default Jinja2/Django styles +" These options reflect most of the same style as Python. au FileType htmldjango setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 au FileType jinja setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 -" the smarty filetypes doesn't have any sort of indentation, so we set it to -" auto +" Default Smarty style +" Smarty doesn't have a proper syntax (I think) so we enable autoidentation +" for it to indent HTML properly. au FileType smarty setlocal ai -" PHP break lines at column 79, like Python +" Default PHP style +" PHP should break at column 79 (pretty much like Python). +" We also enable a syntax option, which will colorize instance members in a +" different way (so we know when a variable is an instance member or something +" coming from outside). au FileType php setlocal textwidth=79 -let php_smart_members=1 " colorize instance members +let php_smart_members=1 -" svn (when editing svn commit messages, break lines at -" column 70) +" Default Subversion style. +" Simply break lines at column 70. au FileType svn setlocal tw=70 -" email (mostly mutt stuff) +" Default Email style. +" This is mostly used by Mutt. au FileType mail setlocal spell spelllang=en -" JavaScript (who though those were "good" defaults?) +" Default JavaScript style +" This mirrors Python, except we'll be using 2 spaces instead of 4. Also, +" there is no hard-break, as JavaScript seems more prone to break in the wrong +" place than Python. au FileType javascript setlocal expandtab tabstop=2 sw=2 sts=2 textwidth=0 -" Files that should be ignored in most file operations -set wildignore+=*/build/*,*.egginfo,*.pyc,*.mo,*/dist/* +" Default JSON styles +" Every file with the extesion "json" should have the filetype "json"; +" Use spaces instead of tabs and use 4 spaces for it. +" Remove tailing spaces. +" Also, in case we are using vim-json (through Polyglot), do not conceal any +" characters (check elzr/vim-json on Github about this feature) +let g:vim_json_syntax_conceal = 0 +autocmd BufNewFile,BufRead *.json set filetype=json +autocmd Filetype json set et ts=4 sts=4 +autocmd FileType json autocmd BufWritePre :%s/\s\+$//e + +" Default Pinpoint style +au BufNewFile,BufRead *.pin set filetype=pinpoint +au FileType pinpoint setlocal colorcolumn=79 textwidth=78 + +" Default Yang style + " ---------------------------------------------------------------------- " mapings @@ -265,9 +308,9 @@ let g:AutoPairsMapCR = 1 " ---------------------------------------------------------------------- let g:airline_powerline_fonts = 1 let g:airline_theme = 'understated' -let g:airline_detect_whitespace=0 "disabled -let g:airline_enable_branch = 1 -let g:airline_enable_syntastic = 1 +let g:airline#extensions#whitespace#enabled = 0 "disabled +let g:airline#extensions#branch#enabled = 1 +let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#show_buffers = 0 let g:airline#extensions#tabline#show_tab_type = 0 @@ -285,18 +328,6 @@ let g:airline#extensions#tabline#tab_nr_type = 1 let g:indent_guides_start_level=2 let g:indent_guides_guide_size=1 -" ---------------------------------------------------------------------- -" JSON syntax -" ---------------------------------------------------------------------- -let g:vim_json_syntax_conceal = 0 -autocmd BufNewFile,BufRead *.json set filetype=json -autocmd Filetype json set noet ts=4 - -" ---------------------------------------------------------------------- -" Pinpoint syntax -" ---------------------------------------------------------------------- -au BufNewFile,BufRead *.pin set filetype=pinpoint -au FileType pinpoint setlocal colorcolumn=79 textwidth=78 " ---------------------------------------------------------------------- " Jedi-VIM