-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
238 lines (184 loc) · 6.31 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
" PLUGINS
" set Terminal Colors to 256 colors for vim airline
set t_Co=256
" encoding
set encoding=utf-8
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
" set rtp+=~/.vim/bundle/Vundle.vim
" call vundle#begin()
call plug#begin('~/.vim/plugged')
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
" Plug 'VundleVim/Vundle.vim'
Plug 'valloric/youcompleteme', { 'do': './install.sh'}
"Plugin 'klen/python-mode'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
Plug '/home/roland/.vim/bundle/SpellChecker'
" call vundle#end() " require
call plug#end()
filetype plugin indent on " required
" TERMINAL settings and Misc
set shell=/bin/sh
" filetype indent on
" get a list of completions when typing the beginning of a latex command and
" hit 'tab' (http://stackoverflow.com/questions/3723493/latex-and-vim-usage)
"filetype on
au FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))
set complete+=k
"------------------------------------------------------------
" Must have options {{{1
"
set hidden
" for clever completeion wiht :find command
set path+=**
" Better command-line completion
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see
" the mapping of <C-L> below)
set hlsearch
" As you type search
set incsearch
" show tabs and non-breakable spaces
set listchars=tab:>>,nbsp:~
" show lines above and below
set scrolloff=0
" disable showmode since using vim-airline; otherwise use 'set showmode'
set noshowmode
" more history
set history=8192
" save read-only files
"command -nargs=0 Sudow w !sudo tee % >/dev/null
"------------------------------------------------------------
" Usability options {{{1
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled,
" keep the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Enable syntax highlighting
syntax on
" Stop certain movements from always going to the first character of a
" line. While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the
" status line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead
" raise a dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is
" set, and this line is also included, vim will neither flash nor beep. If
" visualbell is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of
" having to "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F9> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F9>
" Set Mapleader key to '<'
" let mapleader = '<'
" open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" quicker window movement
"nnoremap <C-j> <C-w>j
"noremap <C-k> <C-w>k
"nnoremap <C-h> <C-w>h
"nnoremap <C-l> <C-w>l
"------------------------------------------------------------
" Indentation options {{{1
set expandtab
set shiftwidth=2
set softtabstop=2
set tw=80
"------------------------------------------------------------
" Mappings {{{1
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
" map Y y$
" save file
nnoremap <C-s> :w<CR>
" change to next tab
nnoremap <Leader>< :tabp<CR>
nnoremap <Leader>> :tabn<CR>
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
"nnoremap <C-L> :nohl<CR><C-L>
"noremap <Up> :echo "Don't be stupid"
"noremap! <Up> <Esc>
"noremap <Down> :echo "Don't be stupid"
"noremap! <Down> <Esc>
"noremap <Left> :echo "Don't be stupid"
"noremap! <Left> <Esc>
"noremap <Right> :echo "Don't be stupid"
"noremap! <Right> <Esc>
"
inoremap <F2> <C-R>=strftime('%c')<CR>
command! AddHeading :normal i[+]<ESC>
command! AddSubHeading :normal i [-]<ESC>
nnoremap th :AddHeading<CR>
nnoremap tj :AddSubHeading<CR>
nnoremap ' :noh<CR>
"-------------------------------------------------------------
" PLUGIN Configurations
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor = "latex"
" compile latex files per default to PDF
let g:Tex_DefaultTargetFormat='pdf'
" specify pdf viewer
let g:Tex_ViewRule_pdf = 'evince'
" For compiling also with BibTex or just multiple times
let g:Tex_MultipleCompileFormats='pdf,bib,pdf'
let g:ycm_python_binary_path = 'python'
" airline
" let g:airline_theme='molokai'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='luna'
"youcompleteme
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:UltiSnipsExpandTrigger="<C-space>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsUsePythonVersion = 2
"nerdtree
map <F2> :NERDTreeToggle<CR>
"---------------------
"" Custom functions
"---------------------
"
fun! TrimWhitespace()
let l:save = winsaveview()
%s/\s\+$//e
call winrestview(l:save)
endfun