diff --git a/vim/vim.symlink/functions.vim b/vim/vim.symlink/functions.vim index c2595df..d0d4bd3 100644 --- a/vim/vim.symlink/functions.vim +++ b/vim/vim.symlink/functions.vim @@ -13,30 +13,22 @@ function! WinMove(key) endif endfunction -" tell me what syntax group the word below the cursor belongs to -function! SynStack() - if !exists("*synstack") - return - endif - echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') -endfunction - " recursively search up from dirname, sourcing all .vimrc.local files along the way function! ApplyLocalSettings(dirname) " convert windows paths to unix style - let l:curDir = substitute(a:dirname, "\\", "/", "g") + let l:curDir = substitute(a:dirname, '\\', '/', 'g') " walk to the top of the dir tree - let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, "/")) + let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, '/')) if isdirectory(l:parentDir) call ApplyLocalSettings(l:parentDir) endif " now walk back down the path and source .vimsettings as you find them. " child directories can inherit from their parents - let l:settingsFile = a:dirname . "/.vimrc.local" + let l:settingsFile = a:dirname . '/.vimrc.local' if filereadable(l:settingsFile) - exec ":source" . l:settingsFile + exec ':source' . l:settingsFile endif endfunction @@ -47,18 +39,18 @@ function! Smart_TabComplete() let substr = strpart(line, -1, col('.')+1) " from the start of the current " line to one character right " of the cursor - let substr = matchstr(substr, "[^ \t]*$") " word till cursor + let substr = matchstr(substr, '[^ \t]*$') " word till cursor if (strlen(substr)==0) " nothing to match on empty string - return "\" + return '\' endif let has_period = match(substr, '\.') != -1 " position of period, if any let has_slash = match(substr, '\/') != -1 " position of slash, if any if (!has_period && !has_slash) - return "\\" " existing text matching + return '\\' " existing text matching elseif ( has_slash ) - return "\\" " file matching + return '\\' " file matching else - return "\\" " plugin matching + return '\\' " plugin matching endif endfunction diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index db2c5af..8b96038 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -20,8 +20,8 @@ set autoread " detect when a file is changed set backspace=indent,eol,start " set a map leader for more key combos -let mapleader = "," -let g:mapleader = "," +let mapleader = ',' +let g:mapleader = ',' set history=10000 " change history to 1000 " set textwidth=80 @@ -44,14 +44,11 @@ set clipboard=unnamed " faster redrawing set ttyfast -" allow matching of if/end, etc. with % -" runtime macros/matchit.vim - " highlight conflicts match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' " file type specific settings -if has("autocmd") && !exists("autocommands_loaded") +if has('autocmd') && !exists('autocommands_loaded') let autocommands_loaded = 1 autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab @@ -64,7 +61,7 @@ if has("autocmd") && !exists("autocommands_loaded") "autocmd WinLeave * setlocal nocursorline " automatically resize panes on resize - autocmd VimResized * exe "normal! \=" + autocmd VimResized * exe 'normal! \=' autocmd BufWritePost .vimrc source % autocmd BufWritePost .vimrc.local source % " save all files on focus lost, ignoring warnings about untitled buffers @@ -77,6 +74,8 @@ if has("autocmd") && !exists("autocommands_loaded") " make quickfix windows take all the lower section of the screen when there " are multiple windows open autocmd FileType qf wincmd J + + autocmd! BufEnter * call ApplyLocalSettings(expand(':p:h')) endif " code folding settings @@ -97,8 +96,6 @@ set noshowmode " don't show which mode disabled for PowerLine set wildmode=list:longest " complete files like a shell set scrolloff=3 " lines of text around cursor set shell=$SHELL -set ruler " show postiion in file -set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids" set cmdheight=1 " command bar height set title " set terminal title @@ -124,9 +121,6 @@ set tm=500 " switch syntax highlighting on syntax on -highlight ColorColumn ctermbg=magenta -call matchadd('ColorColumn', '\%81v', 100) - set encoding=utf8 set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors" set background=dark @@ -134,10 +128,9 @@ colorscheme hybrid " set number " show line numbers set relativenumber " show relative line numbers -set number +set number " show the current line number" -set wrap " turn on line wrapping -"set nowrap "turn off line wrapping +set nowrap "turn off line wrapping set wrapmargin=8 " wrap lines when coming within n characters from side set linebreak " set soft wrapping set showbreak=… " show ellipsis at breaking @@ -145,11 +138,6 @@ set showbreak=… " show ellipsis at breaking set autoindent " automatically set indent of new line set smartindent -try - lang en_US -catch -endtry - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Files, backups, and undo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -186,21 +174,23 @@ nmap :%s/\s\+$ " shortcut to save nmap , :w -" disable Visual mode +" disable Ex mode noremap Q " set paste toggle set pastetoggle= -" toggle paste +" toggle paste mode map v :set paste! " edit ~/.vimrc -map e :e! ~/.vimrc +map ev :e! ~/.vimrc " edit vim plugins -map ep :e! ~/.vim/plugins.vim -" edit vim plugins -map ef :e! ~/.vim/functions.vim +map evp :e! ~/.vim/plugins.vim +" edit vim functions +map evf :e! ~/.vim/functions.vim +" edit gitconfig +map eg :e! ~/.gitconfig " clear highlighted search noremap :set hlsearch! hlsearch? @@ -221,10 +211,6 @@ vmap ] >gv nmap [ << nmap ] >> -" buffer shortcuts -nmap n :bn " go to next buffer -nmap p :bp " go to prev buffer -nmap q :bd " close the current buffer " switch between current and last buffer nmap . @@ -238,9 +224,6 @@ map :call WinMove('l') map wc :wincmd q -" equalize windows -map = = - " toggle cursor line nnoremap i :set cursorline! @@ -252,15 +235,9 @@ nnoremap 3 nnoremap j gj nnoremap k gk -nnoremap / :call ToggleNuMode() - " search for word under the cursor nnoremap / "fyiw :/f -" find out what syntax stack a statement belongs to -" nmap s :call SynStack() -autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) - " inoremap =Smart_TabComplete() map r :call RunCustomCommand() @@ -271,12 +248,6 @@ let g:silent_custom_command = 0 " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Powerline settings -" must have modified font installed to enable fancy -" let g:Powerline_symbols = 'fancy' - -" let g:Powerline_stl_path_style = 'filename' - " close NERDTree after a file is opened let g:NERDTreeQuitOnOpen=1 " Toggle NERDTree