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@0
|
21
|
bgneal@0
|
22 " This allows % to toggle on if/elsif/else/end, XML tags, & more
|
bgneal@0
|
23 runtime macros/matchit.vim
|
bgneal@0
|
24
|
bgneal@0
|
25 " These two options make /-style searching case-sensitive only if there
|
bgneal@0
|
26 " is a capital letter in the search expression.
|
bgneal@0
|
27 set ignorecase
|
bgneal@0
|
28 set smartcase
|
bgneal@0
|
29
|
bgneal@0
|
30 " Sets the terminal title when run in an xterm
|
bgneal@0
|
31 set title
|
bgneal@0
|
32
|
bgneal@0
|
33 " This puts more context around the cursor when scrolling
|
bgneal@0
|
34 set scrolloff=3
|
bgneal@0
|
35
|
bgneal1@9
|
36 let g:netrw_sort_sequence = "[\/]$,*,\.bak$,\.o$,\.info$,\.swp$,\.obj$"
|
bgneal@0
|
37
|
bgneal@0
|
38 syntax on
|
bgneal@0
|
39 filetype on
|
bgneal@0
|
40 filetype plugin on
|
bgneal@0
|
41 filetype indent on
|
bgneal@0
|
42 set hlsearch
|
bgneal@0
|
43 set incsearch
|
bgneal@0
|
44
|
bgneal@0
|
45 " highlight trailing spaces
|
bgneal@0
|
46 let c_space_errors = 1
|
bgneal1@9
|
47 let python_space_error_highlight = 1
|
bgneal@0
|
48
|
bgneal@2
|
49 set background=dark
|
bgneal@2
|
50 colorscheme peaksea2
|
bgneal@0
|
51
|
bgneal@0
|
52 " shortcut for word completion in insert mode
|
bgneal@0
|
53 imap <S-Tab> <C-n>
|
bgneal@0
|
54
|
bgneal@0
|
55 " buffer next and previous commands
|
bgneal@16
|
56 " TODO: find a better mapping
|
bgneal@16
|
57 " TODO: nnoremap <Tab> :bnext<CR>
|
bgneal@16
|
58 " TODO: nnoremap <S-Tab> :bprevious<CR>
|
bgneal@0
|
59
|
bgneal@0
|
60 " Remove extra trailing spaces
|
bgneal@0
|
61 nnoremap <F2> :%s/\s\+$//<CR>
|
bgneal@0
|
62
|
bgneal@4
|
63 " setlocal spell spelllang=en_us
|
bgneal@0
|
64
|
bgneal@16
|
65 let mapleader="\\"
|
bgneal@6
|
66
|
bgneal1@9
|
67 " ctags support
|
bgneal1@9
|
68
|
bgneal1@9
|
69 function BgnCtags()
|
bgneal@21
|
70 let s:d = finddir(".hg", ";")
|
bgneal@21
|
71 if s:d == ""
|
bgneal@21
|
72 let s:d = finddir(".git", ";")
|
bgneal@21
|
73 endif
|
bgneal@21
|
74 if s:d == ""
|
bgneal@21
|
75 echo "No root directory found"
|
bgneal@21
|
76 return
|
bgneal@21
|
77 endif
|
bgneal@21
|
78 let s:path = fnamemodify(s:d, ":p:h:h")
|
bgneal@21
|
79 let s:tags = s:path . "/.tags"
|
bgneal@21
|
80 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
|
81 echo s:cmd
|
bgneal@21
|
82 call system(s:cmd)
|
bgneal1@9
|
83 endfunction
|
bgneal1@9
|
84
|
bgneal@21
|
85 nnoremap <leader>c :call BgnCtags()<CR>
|
bgneal@21
|
86 "nnoremap <F9> :tn<CR>
|
bgneal@21
|
87 "nnoremap <F10> :tp<CR>
|
bgneal@21
|
88 "nnoremap <F11> :tj<CR>
|
bgneal@21
|
89 set tags=.tags;/
|
bgneal1@9
|
90
|
bgneal1@9
|
91 " Trial settings
|
bgneal1@9
|
92 set wildmenu
|
bgneal1@9
|
93 set wildmode=list:longest
|
bgneal1@9
|
94 set laststatus=2
|
bgneal1@9
|
95 set gdefault
|
bgneal1@9
|
96 set showmatch
|
bgneal@10
|
97 set formatoptions=tcqrn1
|
bgneal@16
|
98 nnoremap <leader>/ :noh<CR>
|
bgneal@16
|
99 nnoremap / /\v
|
bgneal@16
|
100 vnoremap / /\v
|
bgneal1@9
|
101
|
bgneal1@9
|
102 " Splitting windows and moving around between them:
|
bgneal@16
|
103 nnoremap <leader>v <C-w>v<C-w>l
|
bgneal1@9
|
104 nnoremap <C-h> <C-w>h
|
bgneal1@9
|
105 nnoremap <C-j> <C-w>j
|
bgneal1@9
|
106 nnoremap <C-k> <C-w>k
|
bgneal1@9
|
107 nnoremap <C-l> <C-w>l
|
bgneal1@9
|
108
|
bgneal1@9
|
109 " Absolute vs relative line numbers:
|
bgneal@16
|
110 nnoremap <leader>na :set norelativenumber<CR>:set number<CR>
|
bgneal@16
|
111 nnoremap <leader>nr :set relativenumber<CR>
|
bgneal1@9
|
112
|
bgneal1@9
|
113 " Format paragraph
|
bgneal@16
|
114 nnoremap <leader>p gqip
|
bgneal1@9
|
115
|
bgneal1@11
|
116 function BgnSwitchPart()
|
bgneal1@11
|
117 python << EOF
|
bgneal1@11
|
118 import vim, os.path, sys
|
bgneal1@11
|
119 fname = vim.current.buffer.name
|
bgneal1@11
|
120 base, ext = os.path.splitext(fname)
|
bgneal1@11
|
121 headers = ['.h', '.hxx']
|
bgneal1@11
|
122 impls = ['.cpp', '.cxx', '.cc', '.c']
|
bgneal1@11
|
123 new_exts = None
|
bgneal1@11
|
124 if ext in headers:
|
bgneal1@11
|
125 new_exts = impls
|
bgneal1@11
|
126 elif ext in impls:
|
bgneal1@11
|
127 new_exts = headers
|
bgneal1@11
|
128
|
bgneal1@11
|
129 if new_exts:
|
bgneal1@11
|
130 for ext in new_exts:
|
bgneal1@11
|
131 new_fname = base + ext
|
bgneal1@11
|
132 if os.path.exists(new_fname):
|
bgneal1@11
|
133 vim.command(":e %s" % new_fname)
|
bgneal1@11
|
134 break
|
bgneal1@11
|
135 else:
|
bgneal1@11
|
136 sys.stderr.write("Could not find other part\n")
|
bgneal1@11
|
137 else:
|
bgneal1@11
|
138 sys.stderr.write("Uknown extension %s" % ext)
|
bgneal1@11
|
139 EOF
|
bgneal1@11
|
140 endfunction
|
bgneal1@11
|
141
|
bgneal@16
|
142 nnoremap <leader>s :call BgnSwitchPart()<CR>
|
bgneal1@11
|
143
|
bgneal@6
|
144 " Pathogen support
|
bgneal@6
|
145 call pathogen#infect()
|