forked from nviennot/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvimrc
More file actions
177 lines (140 loc) · 4.66 KB
/
vimrc
File metadata and controls
177 lines (140 loc) · 4.66 KB
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
filetype off
execute pathogen#infect()
syntax on
filetype plugin indent on
set cursorline
colorscheme molokai
set number
set autoindent smartindent " turn on auto/smart indenting
set smarttab " make <tab> and <backspace> smarter
set tabstop=8 " tabstops of 8
set shiftwidth=8 " indents of 8
set backspace=eol,start,indent " allow backspacing over indent, eol, & start
set undolevels=1000 " number of forgivable mistakes
set updatecount=100 " write swap file to disk every 100 chars
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion
set viminfo=%100,'100,/100,h,\"500,:100,n~/.vim/viminfo
set ignorecase
set smartcase
set hlsearch
set incsearch
set showmatch
set diffopt=filler,iwhite " ignore all whitespace and sync
nnoremap <C-g> :NERDTreeToggle<cr>
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$' ]
let NERDTreeHighlightCursorline=1
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let g:yankring_history_dir = '$HOME/.vim'
set ls=2 " Always show status line
if has('statusline')
function SetStatusLineStyle()
let &stl="%f %y%([%R%M]%) %#StatusLineNC#%{&ff=='unix'?'':&ff.'\ format'}%* %{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=%#Search# %{fugitive#statusline()} %#StatusLine# #%n %4.l/%L %3v %3.p%%"
endfunc
" Switch between the normal and vim-debug modes in the status line
call SetStatusLineStyle()
" Window title
if has('title')
set titlestring=%t%(\ [%R%M]%)
endif
endif
command! -nargs=? HighlightLongLines call s:HighlightLongLines('<args>')
function! s:HighlightLongLines(width)
let targetWidth = a:width != '' ? a:width : 79
if targetWidth > 0
exec 'match Todo /\%>' . (targetWidth) . 'v/'
else
echomsg "Usage: HighlightLongLines [natural number]"
endif
endfunction
""""""""""""""""""""""""""""""
" => Minibuffer plugin
""""""""""""""""""""""""""""""
let g:miniBufExplorerMoreThanOne = 10000
let g:miniBufExplModSelTarget = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplSplitBelow=1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplVSplit = 20
map <M-j> :bn<cr>
map <M-k> :bp<cr>
set wildmenu
set hidden
let Grep_Skip_Dirs = '.git'
let Grep_Skip_files = '*~ cscope* .svn'
let Grep_Default_Options = '-i -I'
let mapleader=","
let localmapleader=","
map <Leader>ss :setlocal spell!<cr>
map <Leader>/ :nohlsearch<cr>
map <Leader>l :MBEOpen<cr>
map <Leader>c :call setqflist([])<cr>
map <Leader>d :set ft=muttdiff<cr>
map <Leader>g :Ggrep "<C-r><C-w>"<CR>
map <Leader>t :call system('tmux load-buffer -', @")<cr>
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
vnoremap <Leader>y y:call system("pbcopy", getreg("\""))<cr>
nnoremap <Leader>p :call setreg("\"",system("pbpaste"))<cr>p
else
vnoremap <Leader>y "*y
nnoremap <Leader>p "*p
endif
endif
set list!
set listchars=tab:▸\ ,trail:•,extends:»,precedes:«
vnoremap . :normal .<CR>
vnoremap @ :normal! @
set undolevels=10000
let xml_use_xhtml = 1
set directory=~/.vim/swap
map <F1> :set lines=75<CR>:set columns=135<CR>
map <F2> :set lines=75<CR>:set columns=210<CR>
nnoremap <F5> :GundoToggle<CR>
let g:quickfixsigns_classes=['qfl', 'vcsdiff', 'breakpoints']
" Let mac-vim receive meta-key input
if has("gui_running") && has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
set invmmta
endif
endif
""""""""""""""""""""""""""""""""""""""
" Some Vim-LaTeX settings
if has('gui_running')
let g:tex_flavor='latex'
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_ViewRule_pdf = 'Skim'
let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 --interaction=nonstopmode $*'
let g:Tex_UseMakefile = 0
let g:Tex_GotoError=0
autocmd BufRead *.log setlocal autoread
endif
" Disable folding
let Tex_FoldedSections=""
let Tex_FoldedEnvironments=""
let Tex_FoldedMisc=""
let g:vim_markdown_folding_disabled = 1
""""""""""""""""""""""""""""""""""""""
" When I write assembly, I write ARM assembly
au BufNewFile,BufRead *.S set filetype=armasm
"""""""""""""""""""""""""""""""""""""
" Remap autocomplete to ctrl+space
if has("gui_running")
" C-Space seems to work under gVim on both Linux and win32
inoremap <C-Space> <C-n>
else " no gui
if has("unix")
inoremap <Nul> <C-n>
else
" I have no idea of the name of Ctrl-Space elsewhere
endif
endif
""""""""""""""""""""""""""""""""""""""
" Remap C-n and C-p to to navigate the quickfix next-previous in normal mode
nmap <C-p> :cprev<cr>
nmap <C-n> :cnext<cr>
" Support shortcut for going to window below
let g:BASH_Ctrl_j = 'off'
nnoremap <C-j> <C-W>j