forked from lukerandall/dotvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
152 lines (122 loc) · 4.85 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
set hidden " allow buffers to be hidden when they have unsaved changes
set visualbell " turn off beeps
set nobackup " don't need backups with git
set showcmd " show partial commands
set ttyfast " speeds up drawing on fast terminals
set ruler " show cursor position
set gdefault " make searches global by default
set laststatus=2 " show status bar
set nowrap
call pathogen#runtime_append_all_bundles()
let mapleader = "," " map leader key
"imap hh <Esc>
" Remap C-(e|y) so that they scroll by 3 lines
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
map <leader>d :execute 'NERDTreeToggle ' . getcwd()<CR>
map <leader>n :execute 'TlistToggle'<CR>
map <leader>c :execute 'TlistAddFilesRecursive' . getcwd()<CR>
map <leader>t :execute 'CommandT'<CR>
map <leader>f :execute 'CommandTFlush'<CR>
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
let g:easytags_cmd = '/usr/local/bin/ctags'
let g:CommandTMaxHeight=15
let g:yankring_history_file = '.yankring_history'
nnoremap <leader>a :Ack<space>
nnoremap <leader>l :Tabularize<space>/
vnoremap <leader>l :Tabularize<space>/
nnoremap <silent> <leader><space> :noh<CR>
nnoremap <silent> <leader>y :YRShow<cr>
inoremap <silent> <F3> <ESC>:YRShow<cr>
" Map Ctrl + motion key to change windows
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
inoremap <D-CR> <ESC>o
" leader + v to open new vertical split, leader + s to open a horizontal split, leader + o to close all other windows
map <leader>v <C-w>v<C-w>l
map <leader>h <C-w>s<C-w>j
map <leader>o <C-w>o
" leader + w to save buffer
map <leader>s :w<CR>
set directory=/tmp/ " save temp files in /tmp
set history=1000 " keep n items in history
set wildmenu " enable menu for commands
set wildmode=list:longest " list options when hitting tab, and match longest common command
set wildignore=*.log,*.swp,*~ " ignore these files when completing
set backspace=indent,eol,start " allow backspacing over autoindent, eols and start of insert
colorscheme zenburn
syntax on " enable syntax highlighting
filetype plugin on " enable filetype detection and plugins
filetype plugin indent on " indent according to file type
set number " line numbers
set hlsearch " highlight matches
set incsearch " incremental search
set ignorecase " ignore case when searching
set smartcase " unless search terms are upper case
set expandtab " replace tabs with spaces
set softtabstop=2 " use 2 spaces
set shiftwidth=2 " used by indentation commands
set autoindent " copy previous line indentation
set grepprg=ack\ -a " use ack for grepping
nmap <silent> <leader>s :set nolist!<CR>
set listchars=trail:·,precedes:<,extends:>
set shortmess=atI " Shorten file messages
runtime macros/matchit.vim " Enable matching with %
" duplicate selection in visual mode
vmap D y'>p
set title " display title
set scrolloff=3 " keep n lines of offset when scrolling
if has("gui_macvim")
set fuoptions=maxvert,maxhorz " fullscreen options (MacVim only), resized window when changed to fullscreen
set guifont=DroidSansMono:h14 " use Monaco 10pt
set guioptions-=T " remove toolbar
set guioptions=aAce " remove scrollbars
set guioptions-=a " remove auto-copy to clipboard"
set guioptions-=A " this one too"
set noanti " turn off anti-aliasing
end
" F6 displays the syntax highlighting group of the item under the cursor
map <F6> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" Erlang
autocmd FileType erlang set tabstop=4
autocmd FileType erlang set shiftwidth=4
autocmd FileType erlang set expandtab
autocmd FileType erlang set softtabstop=4
let g:erlangHighlightBif = 1
" Haskell
au BufEnter *.hs compiler ghc
let g:haddock_browser = "open"
let g:ghc = "/usr/bin/ghc"
" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" f5 removes trailing whitespace
nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
function! Privatize()
let priorMethod = PriorMethodDefinition()
exec "normal iprivate :" . priorMethod . "\<Esc>=="
endfunction
function! PriorMethodDefinition()
let lineNumber = search('def', 'bn')
let line = getline(lineNumber)
if line == 0
echo "No prior method definition found"
endif
return matchlist(line, 'def \(\w\+\).*')[1]
endfunction
map <Leader>p :call Privatize()<CR>
let macvim_hig_shift_movement = 1