-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
executable file
·196 lines (153 loc) · 5.17 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
" ~/.vimrc
"
" This is your Vim initialization file. It is read on Vim startup.
"
" Change this file to customize your Vim settings.
"
" Vim treats lines beginning with " as comments.
"
" EXAMPLES are available in /usr/local/doc/startups.
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
call pathogen#infect()
"call pathogen#helptags()
filetype plugin on
filetype indent on
set textwidth=79
"set number
set ruler
" always show status line
set laststatus=2
let mapleader = ","
let maplocalleader = ","
" something else for latex
" set grepprg=grep\ -nH\ $*
" disable folding
set nofoldenable
let g:vim_markdown_folding_disabled=1
" only refresh on save
let g:instant_markdown_slow = 1
" keep the cursor away from the screen top/bottom
set scrolloff=5
autocmd QuickFixCmdPost *grep* cwindow
" Give a shortcut key to NERD Tree
"map <leader>e :NERDTreeToggle<CR>
"map <leader>f :NERDTreeFind<CR>
" compile to pdf and use preview
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_ViewRule_pdf = 'open -a Preview'
" one last thing for latex
let g:tex_flavor='latex'
" move within paragraph
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
" make a shortcut to turn off all indentation
"nnoremap <C-i> :setl noai nocin nosi inde=<CR>
" use hardwrap for mkd
"let g:pandoc_use_hard_wraps = 1
"let g:pandoc_auto_format = 1
"let g:pandoc_no_folding = 1
" soft wrapping for mkd
"set formatoptions=1
autocmd FileType mkd,pandoc setlocal wrap
autocmd FileType mkd,pandoc setlocal linebreak
autocmd FileType mkd,pandoc setlocal tw=0
" spell check
autocmd FileType mkd,pandoc setlocal spell
function SetIndentSpaces(n)
let &tabstop = a:n
let &softtabstop = a:n
let &shiftwidth = a:n
endfunction
" auto indent to 2 spaces
set autoindent
call SetIndentSpaces(2)
set expandtab
autocmd FileType tex,pandoc,mkd call SetIndentSpaces(4)
autocmd BufNewFile,BufReadPost *.coffee.md call SetIndentSpaces(4)
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax enable
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Terminal.app needs to have solarized installed, and use the ansi
" terminal type
"colorscheme solarized
colo lucius
" keep swap files hidden away
set backupdir=$HOME/.vim_swap//,/tmp
set directory=$HOME/.vim_swap//,/tmp
" Switch buffers with double comma
map <Leader><Leader> <C-w>w
" Highlight search terms
set hlsearch
" Clear the search buffer with double slash
nmap // :let @/ = ""<CR>
" Easy edit of vimrc
nmap <Leader>vv :e $MYVIMRC<CR>
" Reload a new vimrc
nmap <Leader>vs :source $MYVIMRC<CR>
" No more shift for commands!
nnoremap ; :
" Show trailing whitespace
nmap <Leader>ww /\s\+$<CR>
" Remove trailing whitespace
nmap <Leader>wd :%s/\s\+$//<CR>
" Capture ESC for CommandT
let g:CommandTCancelMap = ['<ESC>', '<C-c>']
" Use ,o to open
nnoremap <silent> <Leader>o :CommandT<CR>
" Capture up and down keys - they read as EscO?
let g:CommandTSelectPrevMap= ['<C-p>', '<C-k>', '<Esc>OA', '<Up>']
let g:CommandTSelectNextMap= ['<C-n>', '<C-j>', '<Esc>OB', '<Down>']
" Make a Mongo query filetype
autocmd BufNewFile,BufReadPost *.mql setlocal filetype=mongoql
" Detect TypeScript
autocmd BufNewFile,BufReadPost *.ts setlocal filetype=typescript
"" Allow tab to be used for autocomplete
"function! SuperCleverTab()
" if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
" return "\<Tab>"
" else
" if &omnifunc != ''
" return "\<C-X>\<C-O>"
" elseif &dictionary != ''
" return "\<C-K>"
" else
" return "\<C-N>"
" endif
" endif
"endfunction
"" Use tab for special autocomplete
"inoremap <Tab> <C-R>=SuperCleverTab()<cr>
" Remap default autocomplete trigger (not working!)
"inoremap <C-space> <C-x><C-o>
" Turn on autocomplete for various languages
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
if has("autocmd")
" Have Vim jump to the last position when reopening a file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
" Remove trailing whitespace on write for some filetypes
"autocmd FileType js,ocaml,html,css autocmd BufWritePre <buffer> :%s/\s\+$//e
" Have Vim load indentation rules according to the detected filetype. Per
" default Debian Vim only load filetype specific plugins.
filetype indent on
endif
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes) in terminals