" " Shane's .vimrc " set binary noeol "set textwidth=80 set novisualbell set mouse=a set scrolloff=3 set nowrap set title set nobackup set ff=unix filetype on "set showmatch " Briefly flash matching brackets in insert mode "let loaded_matchparen = 1 " Turn off matching parenthesis highlighting set matchtime=5 set smartindent set autoindent set switchbuf=usetab syntax on let mapleader="," set timeoutlen=300 " Highlight current line. "autocmd WinEnter * setlocal cursorline "autocmd WinLeave * setlocal nocursorline " Reselect visual block after in/dedent so we can in/dedent more vnoremap < >gv set incsearch set hlsearch nnoremap n :nohlsearch set ignorecase smartcase set wildmode=longest,list set laststatus=2 set viminfo='30,\"500 "set showtabline=2 colorscheme vy3 set t_Co=256 set backspace=indent,eol,start set clipboard+=unnamed set shortmess+=I " Disable splash screen. set autoread :map! kj set pastetoggle=p " Jump to next, previous row when long lines are wrapped. nnoremap j gj nnoremap k gk " If we forget to open a file using sudo, use w!! to save the file. cmap w!! w !sudo tee % >/dev/null " Show tabs and trailing spaces. set listchars=tab:>-,trail:ยท,eol:$ nmap s :set nolist! let c_gnu=1 " Enable detection of some GCC extensions to C. let c_no_bracket_error=1 " Allow {} inside of []. For Objective-C. " Tab completion in source code set completeopt=longest,menuone let g:SuperTabDefaultCompletionType = "" " To get rid of ^M characters as a result of DOS line endings command Crlf :%s/ //g " Soft wrap for text, e.g. emails command Swrap :set wrap linebreak textwidth=0 " Look for tags file in directory or parent directories set tags=tags;/ " F5 invokes FuzzyFinder, space as first character searches in sub " directories. nnoremap :FufFile let g:fuf_abbrevMap = { \ "^ " : [ "**/", ], \ } let g:fuf_previewHeight = 0 nnoremap :NERDTreeToggle nnoremap :TlistToggle let Tlist_GainFocus_On_ToggleOpen=1 " Window resizing. map 3< map 3- map 3+ map 3> " Scroll viewport faster. nnoremap 3 nnoremap 3 " Load any plugin commands and indentation rules filetype plugin indent on " Formatting for different file types augroup vimrc_filetype_formatting "highlight LineTooLong ctermfg=darkgrey guibg=#ffeeee "autocmd FileType c,cpp,objc,java,php,ruby,javascript match LineTooLong /\%>81v.\+/ autocmd FileType c,cpp,objc,java,php,javascript \ setlocal formatoptions=croql cindent \ comments=sr:/*,mb:*,ex:*/,:// \ expandtab \ shiftwidth=4 \ tabstop=4 \ softtabstop=4 autocmd FileType ruby \ setlocal expandtab \ shiftwidth=2 \ tabstop=2 \ softtabstop=2 autocmd BufEnter *.yml \ setlocal expandtab \ shiftwidth=2 \ tabstop=2 \ softtabstop=2 autocmd FileType xml \ setlocal expandtab \ shiftwidth=4 \ tabstop=4 \ softtabstop=4 autocmd FileType html \ setlocal expandtab \ shiftwidth=4 \ tabstop=4 \ softtabstop=4 autocmd BufEnter *.rhtml \ setlocal expandtab \ shiftwidth=2 \ tabstop=2 \ softtabstop=2 autocmd BufEnter *.css \ setlocal expandtab \ shiftwidth=4 \ tabstop=4 \ softtabstop=4 autocmd BufEnter motd,README,*.txt \ setlocal textwidth=76 autocmd BufEnter *.tmp \ setlocal wrap linebreak textwidth=0 augroup end " Custom status line display set laststatus=2 " Always show status line if has('statusline') " Status line detail: " %f file path " %y file type between braces (if defined) " %([%R%M]%) read-only, modified and modifiable flags between braces " %{'!'[&ff=='default_file_format']} " shows a '!' if the file format is not the platform " default " %{'$'[!&list]} shows a '*' if in list mode " %{'~'[&pm=='']} shows a '~' if in patchmode " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) " only for debug : display the current syntax item name " %= right-align following items " #%n buffer number " %l/%L,%c%V line number, total number of lines, and column number function SetStatusLineStyle() if &stl == '' || &stl =~ 'synID' let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " else let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " endif endfunc " Switch between the normal and vim-debug modes in the status line nmap _ds :call SetStatusLineStyle() call SetStatusLineStyle() " Window title if has('title') set titlestring=%t%(\ [%R%M]%) endif " Status line colours hi statusline term=NONE cterm=NONE ctermfg=white ctermbg=black endif