bgneal@0: set nocompatible bgneal@0: "source $VIMRUNTIME/vimrc_example.vim bgneal@0: "source $VIMRUNTIME/mswin.vim bgneal@0: "behave mswin bgneal@0: bgneal@0: set nobackup bgneal@0: set tabstop=3 bgneal@0: set shiftwidth=3 bgneal@0: set backspace=indent,eol,start bgneal@0: set expandtab bgneal1@9: set textwidth=79 bgneal@0: set number bgneal@0: set ruler bgneal@0: set history=1000 bgneal@0: set encoding=utf-8 bgneal@4: set showcmd bgneal@0: bgneal@0: " CtrlP related settings bgneal@20: set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.o,*.swp,*.pyc bgneal@20: let g:ctrlp_working_path_mode = 'ra' bgneal@0: bgneal@0: " This allows % to toggle on if/elsif/else/end, XML tags, & more bgneal@0: runtime macros/matchit.vim bgneal@0: bgneal@0: " These two options make /-style searching case-sensitive only if there bgneal@0: " is a capital letter in the search expression. bgneal@0: set ignorecase bgneal@0: set smartcase bgneal@0: bgneal@0: " Sets the terminal title when run in an xterm bgneal@0: set title bgneal@0: bgneal@0: " This puts more context around the cursor when scrolling bgneal@0: set scrolloff=3 bgneal@0: bgneal1@9: let g:netrw_sort_sequence = "[\/]$,*,\.bak$,\.o$,\.info$,\.swp$,\.obj$" bgneal@0: bgneal@0: syntax on bgneal@0: filetype on bgneal@0: filetype plugin on bgneal@0: filetype indent on bgneal@0: set hlsearch bgneal@0: set incsearch bgneal@0: bgneal@0: " highlight trailing spaces bgneal@0: let c_space_errors = 1 bgneal1@9: let python_space_error_highlight = 1 bgneal@0: bgneal@2: set background=dark bgneal@2: colorscheme peaksea2 bgneal@0: bgneal@0: " shortcut for word completion in insert mode bgneal@0: imap bgneal@0: bgneal@0: " buffer next and previous commands bgneal@16: " TODO: find a better mapping bgneal@16: " TODO: nnoremap :bnext bgneal@16: " TODO: nnoremap :bprevious bgneal@0: bgneal@0: " Remove extra trailing spaces bgneal@0: nnoremap :%s/\s\+$// bgneal@0: bgneal@4: " setlocal spell spelllang=en_us bgneal@0: bgneal@16: let mapleader="\\" bgneal@6: bgneal1@9: " ctags support bgneal1@9: bgneal1@9: function BgnCtags() bgneal@21: let s:d = finddir(".hg", ";") bgneal@21: if s:d == "" bgneal@21: let s:d = finddir(".git", ";") bgneal@21: endif bgneal@21: if s:d == "" bgneal@21: echo "No root directory found" bgneal@21: return bgneal@21: endif bgneal@21: let s:path = fnamemodify(s:d, ":p:h:h") bgneal@21: let s:tags = s:path . "/.tags" bgneal@21: 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: echo s:cmd bgneal@21: call system(s:cmd) bgneal1@9: endfunction bgneal1@9: bgneal@21: nnoremap c :call BgnCtags() bgneal@21: "nnoremap :tn bgneal@21: "nnoremap :tp bgneal@21: "nnoremap :tj bgneal@21: set tags=.tags;/ bgneal1@9: bgneal1@9: " Trial settings bgneal1@9: set wildmenu bgneal1@9: set wildmode=list:longest bgneal1@9: set laststatus=2 bgneal1@9: set gdefault bgneal1@9: set showmatch bgneal@10: set formatoptions=tcqrn1 bgneal@16: nnoremap / :noh bgneal@16: nnoremap / /\v bgneal@16: vnoremap / /\v bgneal1@9: bgneal1@9: " Splitting windows and moving around between them: bgneal@16: nnoremap v vl bgneal1@9: nnoremap h bgneal1@9: nnoremap j bgneal1@9: nnoremap k bgneal1@9: nnoremap l bgneal1@9: bgneal1@9: " Absolute vs relative line numbers: bgneal@16: nnoremap na :set norelativenumber:set number bgneal@16: nnoremap nr :set relativenumber bgneal1@9: bgneal1@9: " Format paragraph bgneal@16: nnoremap p gqip bgneal1@9: bgneal@22: " Actionscript support bgneal@22: let tlist_actionscript_settings = 'actionscript;c:class;f:method;p:property;v:variable' bgneal@22: au BufRead,BufNewFile *.mxml set ft=actionscript bgneal@22: bgneal1@11: function BgnSwitchPart() bgneal1@11: python << EOF bgneal1@11: import vim, os.path, sys bgneal1@11: fname = vim.current.buffer.name bgneal1@11: base, ext = os.path.splitext(fname) bgneal1@11: headers = ['.h', '.hxx'] bgneal1@11: impls = ['.cpp', '.cxx', '.cc', '.c'] bgneal1@11: new_exts = None bgneal1@11: if ext in headers: bgneal1@11: new_exts = impls bgneal1@11: elif ext in impls: bgneal1@11: new_exts = headers bgneal1@11: bgneal1@11: if new_exts: bgneal1@11: for ext in new_exts: bgneal1@11: new_fname = base + ext bgneal1@11: if os.path.exists(new_fname): bgneal1@11: vim.command(":e %s" % new_fname) bgneal1@11: break bgneal1@11: else: bgneal1@11: sys.stderr.write("Could not find other part\n") bgneal1@11: else: bgneal1@11: sys.stderr.write("Uknown extension %s" % ext) bgneal1@11: EOF bgneal1@11: endfunction bgneal1@11: bgneal@16: nnoremap s :call BgnSwitchPart() bgneal1@11: bgneal@6: " Pathogen support bgneal@6: call pathogen#infect()