view 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
line wrap: on
line source
set nocompatible
"source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin

set nobackup
set tabstop=3
set shiftwidth=3
set backspace=indent,eol,start
set expandtab
set textwidth=79
set number
set ruler
set history=1000
set encoding=utf-8
set showcmd

" CtrlP related settings
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.o,*.swp,*.pyc
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_max_files = 30000

" This allows % to toggle on if/elsif/else/end, XML tags, & more
runtime macros/matchit.vim

" These two options make /-style searching case-sensitive only if there
" is a capital letter in the search expression.
set ignorecase
set smartcase

" Sets the terminal title when run in an xterm
set title

" This puts more context around the cursor when scrolling
set scrolloff=3

let g:netrw_sort_sequence = "[\/]$,*,\.bak$,\.o$,\.info$,\.swp$,\.obj$"

if has('vim_starting')
  set runtimepath+=~/.vim/bundle/dart-vim-plugin
endif

syntax on
filetype on
filetype plugin on
filetype indent on
set hlsearch
set incsearch

" highlight trailing spaces
let c_space_errors = 1
let python_space_error_highlight = 1

set background=dark
colorscheme peaksea2

" shortcut for word completion in insert mode
imap <S-Tab> <C-n>

" buffer next and previous commands
" TODO: find a better mapping
" TODO: nnoremap <Tab> :bnext<CR>
" TODO: nnoremap <S-Tab> :bprevious<CR>

" Remove extra trailing spaces
nnoremap <F2> :%s/\s\+$//<CR>

" setlocal spell spelllang=en_us

let mapleader="\\"

" ctags support

function BgnCtags()
   let s:d = finddir(".hg", ";")
   if s:d == ""
      let s:d = finddir(".git", ";")
   endif
   if s:d == ""
      echo "No root directory found"
      return
   endif
   let s:path = fnamemodify(s:d, ":p:h:h")
   let s:tags = s:path . "/.tags"
   let s:cmd = "ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=-all --languages=+c,c++,python,actionscript -f " . s:tags . " " . s:path
   echo s:cmd
   call system(s:cmd)
endfunction

nnoremap <leader>c :call BgnCtags()<CR>
"nnoremap <F9> :tn<CR>
"nnoremap <F10> :tp<CR>
"nnoremap <F11> :tj<CR>
set tags=.tags;/

" Trial settings
set wildmenu
set wildmode=list:longest
set laststatus=2
set gdefault
set showmatch
set formatoptions=tcqrn1
nnoremap <leader>/ :noh<CR>
nnoremap / /\v
vnoremap / /\v

" Splitting windows and moving around between them:
nnoremap <leader>v <C-w>v<C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

" Absolute vs relative line numbers:
nnoremap <leader>na :set norelativenumber<CR>:set number<CR>
nnoremap <leader>nr :set relativenumber<CR>

" Format paragraph
nnoremap <leader>p gqip

" Actionscript support
let tlist_actionscript_settings = 'actionscript;c:class;f:method;p:property;v:variable'
au BufRead,BufNewFile *.mxml set ft=actionscript

function BgnSwitchPart()
python << EOF
import vim, os.path, sys
fname = vim.current.buffer.name
base, ext = os.path.splitext(fname)
headers = ['.h', '.hxx']
impls = ['.cpp', '.cxx', '.cc', '.c']
new_exts = None
if ext in headers:
    new_exts = impls
elif ext in impls:
    new_exts = headers

if new_exts:
    for ext in new_exts:
        new_fname = base + ext
        if os.path.exists(new_fname):
            vim.command(":e %s" % new_fname)
            break
    else:
        sys.stderr.write("Could not find other part\n")
else:
    sys.stderr.write("Uknown extension %s" % ext)
EOF
endfunction

nnoremap <leader>s :call BgnSwitchPart()<CR>
nmap <silent> <Leader>e :Explore<CR>

" Pathogen support
call pathogen#infect()