-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc
More file actions
151 lines (107 loc) · 3.27 KB
/
vimrc
File metadata and controls
151 lines (107 loc) · 3.27 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
""""""""""""""""" COMPATABILITY
" disable vi compatibility (emulation of old bugs)
set nocompatible
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
""""""""""""""""" PLUGINS
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'w0ng/vim-hybrid'
call vundle#end()
" load filetype-specific indent files
filetype plugin indent on
""""""""""""""""" ctags support
" Recursively search parent directories for tags file
set tags=./tags;
""""""""""""""""" COLORS
" Add support for 256-colors for iTerm2
set t_Co=256
"Use https://github.com/w0ng/vim-hybrid colorscheme
:colorscheme hybrid
" enable syntax processing
syntax enable
""""""""""""""""" SPACES AND TABS
" Fix vim backspace
set backspace=indent,eol,start
" number of visual spaces per tab
set tabstop=4
" number of spaces in tab when editing
set softtabstop=4
" (not exactly sure what this does, but it fixed an issue where vim was
" indenting with an extra tab after a code block start)
set shiftwidth=4
" tabs are spaces
set expandtab
" use indentation of previous line
set autoindent
" Indentation optimized for C/C++
" set cindent
" Wrap words visually on line breaks
set wrap
" Only wrap around specific characters (i.e. not letters)
set linebreak
" List disables linebreak
set nolist
" Prevent vim from automatically inserting line breaks in newly entered text
set textwidth=0
set wrapmargin=0
"""""""""""""""" UI CONFIG
" Set insert mode cursors to be straight line
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" Hack to get rid of delay when cursor is switching into escape mode
inoremap <special> <Esc> <Esc>hl
" show line numbers
set number
" show last command entered in bottom right
set showcmd
" highlight current line
set cursorline
" show column line at 81 character mark
set colorcolumn=81
" visual autocomplete for command menu
set wildmenu
" redraw screen only when necessary (boosting macro speed)
set lazyredraw
" highlight matching [{()}]
set showmatch
" Show as much as possible of a wrapped last line, not just "@".
set display=lastline
" Show file name at bottom of editor
set laststatus=2
"""""""""""""""" SEARCHING
" search as characters are entered
set incsearch
" highlight matches
set hlsearch
" search words are case insensitive ...
set ignorecase
" ... Unless they contain at least 1 capital letter
set smartcase
"""""""""""""""" KEY REMAPPING
let mapleader=","
" Adds '_' to the list of word boundaries so that w will stop at underscores
set iskeyword-=_
" Ensures that navigation is by visual line rather than by physical line
nnoremap k gk
nnoremap j gj
nnoremap gk k
nnoremap gj j
"""""""""""""""" MISC
" Set spellcheck
set spell
" Autosaves when window loses focus
autocmd BufLeave,FocusLost * silent! wall
" Autocompile latex on save
"command PdfLatex execute ":!pdflatex -interaction=nonstopmode % ; pdflatex -interaction=nonstopmode %; rm -f *.{log,aux,out}"
"Command taken from .vim/ftplugin
autocmd BufWritePost *.tex :BuildAndViewTexPdf
"Autocompile graphviz with dot
command PdfDot execute ":silent !dot -Tpdf % -o $(basename % .gv).pdf"
autocmd BufWritePost *.gv :PdfDot