annotate vim/.vimrc @ 25:732ed3539b7a

Workiva Vim updates. Local settings for Dart and Groovy. .vimrc tweaks for recent work and plugins. Moved readme for bundle up a level so we can .hgignore the entire directory. Update readme for bundle directory for plugins I started using.
author Brian Neal <bgneal@gmail.com>
date Fri, 31 Jul 2015 15:39:23 -0500
parents 7c2f7ee3f55e
children d17e9bd25f68
rev   line source
bgneal@0 1 set nocompatible
bgneal@0 2 "source $VIMRUNTIME/vimrc_example.vim
bgneal@0 3 "source $VIMRUNTIME/mswin.vim
bgneal@0 4 "behave mswin
bgneal@0 5
bgneal@0 6 set nobackup
bgneal@0 7 set tabstop=3
bgneal@0 8 set shiftwidth=3
bgneal@0 9 set backspace=indent,eol,start
bgneal@0 10 set expandtab
bgneal1@9 11 set textwidth=79
bgneal@0 12 set number
bgneal@0 13 set ruler
bgneal@0 14 set history=1000
bgneal@0 15 set encoding=utf-8
bgneal@4 16 set showcmd
bgneal@0 17
bgneal@0 18 " CtrlP related settings
bgneal@20 19 set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.o,*.swp,*.pyc
bgneal@20 20 let g:ctrlp_working_path_mode = 'ra'
bgneal@25 21 let g:ctrlp_max_files = 30000
bgneal@0 22
bgneal@0 23 " This allows % to toggle on if/elsif/else/end, XML tags, & more
bgneal@0 24 runtime macros/matchit.vim
bgneal@0 25
bgneal@0 26 " These two options make /-style searching case-sensitive only if there
bgneal@0 27 " is a capital letter in the search expression.
bgneal@0 28 set ignorecase
bgneal@0 29 set smartcase
bgneal@0 30
bgneal@0 31 " Sets the terminal title when run in an xterm
bgneal@0 32 set title
bgneal@0 33
bgneal@0 34 " This puts more context around the cursor when scrolling
bgneal@0 35 set scrolloff=3
bgneal@0 36
bgneal1@9 37 let g:netrw_sort_sequence = "[\/]$,*,\.bak$,\.o$,\.info$,\.swp$,\.obj$"
bgneal@0 38
bgneal@25 39 if has('vim_starting')
bgneal@25 40 set runtimepath+=~/.vim/bundle/dart-vim-plugin
bgneal@25 41 endif
bgneal@25 42
bgneal@0 43 syntax on
bgneal@0 44 filetype on
bgneal@0 45 filetype plugin on
bgneal@0 46 filetype indent on
bgneal@0 47 set hlsearch
bgneal@0 48 set incsearch
bgneal@0 49
bgneal@0 50 " highlight trailing spaces
bgneal@0 51 let c_space_errors = 1
bgneal1@9 52 let python_space_error_highlight = 1
bgneal@0 53
bgneal@2 54 set background=dark
bgneal@2 55 colorscheme peaksea2
bgneal@0 56
bgneal@0 57 " shortcut for word completion in insert mode
bgneal@0 58 imap <S-Tab> <C-n>
bgneal@0 59
bgneal@0 60 " buffer next and previous commands
bgneal@16 61 " TODO: find a better mapping
bgneal@16 62 " TODO: nnoremap <Tab> :bnext<CR>
bgneal@16 63 " TODO: nnoremap <S-Tab> :bprevious<CR>
bgneal@0 64
bgneal@0 65 " Remove extra trailing spaces
bgneal@0 66 nnoremap <F2> :%s/\s\+$//<CR>
bgneal@0 67
bgneal@4 68 " setlocal spell spelllang=en_us
bgneal@0 69
bgneal@16 70 let mapleader="\\"
bgneal@6 71
bgneal1@9 72 " ctags support
bgneal1@9 73
bgneal1@9 74 function BgnCtags()
bgneal@21 75 let s:d = finddir(".hg", ";")
bgneal@21 76 if s:d == ""
bgneal@21 77 let s:d = finddir(".git", ";")
bgneal@21 78 endif
bgneal@21 79 if s:d == ""
bgneal@21 80 echo "No root directory found"
bgneal@21 81 return
bgneal@21 82 endif
bgneal@21 83 let s:path = fnamemodify(s:d, ":p:h:h")
bgneal@21 84 let s:tags = s:path . "/.tags"
bgneal@21 85 let s:cmd = "ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=-all --languages=+c,c++,python,actionscript -f " . s:tags . " " . s:path
bgneal@21 86 echo s:cmd
bgneal@21 87 call system(s:cmd)
bgneal1@9 88 endfunction
bgneal1@9 89
bgneal@21 90 nnoremap <leader>c :call BgnCtags()<CR>
bgneal@21 91 "nnoremap <F9> :tn<CR>
bgneal@21 92 "nnoremap <F10> :tp<CR>
bgneal@21 93 "nnoremap <F11> :tj<CR>
bgneal@21 94 set tags=.tags;/
bgneal1@9 95
bgneal1@9 96 " Trial settings
bgneal1@9 97 set wildmenu
bgneal1@9 98 set wildmode=list:longest
bgneal1@9 99 set laststatus=2
bgneal1@9 100 set gdefault
bgneal1@9 101 set showmatch
bgneal@10 102 set formatoptions=tcqrn1
bgneal@16 103 nnoremap <leader>/ :noh<CR>
bgneal@16 104 nnoremap / /\v
bgneal@16 105 vnoremap / /\v
bgneal1@9 106
bgneal1@9 107 " Splitting windows and moving around between them:
bgneal@16 108 nnoremap <leader>v <C-w>v<C-w>l
bgneal1@9 109 nnoremap <C-h> <C-w>h
bgneal1@9 110 nnoremap <C-j> <C-w>j
bgneal1@9 111 nnoremap <C-k> <C-w>k
bgneal1@9 112 nnoremap <C-l> <C-w>l
bgneal1@9 113
bgneal1@9 114 " Absolute vs relative line numbers:
bgneal@16 115 nnoremap <leader>na :set norelativenumber<CR>:set number<CR>
bgneal@16 116 nnoremap <leader>nr :set relativenumber<CR>
bgneal1@9 117
bgneal1@9 118 " Format paragraph
bgneal@16 119 nnoremap <leader>p gqip
bgneal1@9 120
bgneal@22 121 " Actionscript support
bgneal@22 122 let tlist_actionscript_settings = 'actionscript;c:class;f:method;p:property;v:variable'
bgneal@22 123 au BufRead,BufNewFile *.mxml set ft=actionscript
bgneal@22 124
bgneal1@11 125 function BgnSwitchPart()
bgneal1@11 126 python << EOF
bgneal1@11 127 import vim, os.path, sys
bgneal1@11 128 fname = vim.current.buffer.name
bgneal1@11 129 base, ext = os.path.splitext(fname)
bgneal1@11 130 headers = ['.h', '.hxx']
bgneal1@11 131 impls = ['.cpp', '.cxx', '.cc', '.c']
bgneal1@11 132 new_exts = None
bgneal1@11 133 if ext in headers:
bgneal1@11 134 new_exts = impls
bgneal1@11 135 elif ext in impls:
bgneal1@11 136 new_exts = headers
bgneal1@11 137
bgneal1@11 138 if new_exts:
bgneal1@11 139 for ext in new_exts:
bgneal1@11 140 new_fname = base + ext
bgneal1@11 141 if os.path.exists(new_fname):
bgneal1@11 142 vim.command(":e %s" % new_fname)
bgneal1@11 143 break
bgneal1@11 144 else:
bgneal1@11 145 sys.stderr.write("Could not find other part\n")
bgneal1@11 146 else:
bgneal1@11 147 sys.stderr.write("Uknown extension %s" % ext)
bgneal1@11 148 EOF
bgneal1@11 149 endfunction
bgneal1@11 150
bgneal@16 151 nnoremap <leader>s :call BgnSwitchPart()<CR>
bgneal@25 152 nmap <silent> <Leader>e :Explore<CR>
bgneal1@11 153
bgneal@6 154 " Pathogen support
bgneal@6 155 call pathogen#infect()