-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
152 lines (109 loc) · 3.35 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
" Be iMproved! (Or, enable all features.)
set nocompatible
" Tab length
set tabstop=2
" Upon <BS>, remove a tab's worth of spaces.
set softtabstop=2
" (Auto)indent tab length
set shiftwidth=2
" Insert spaces instead of tab character.
set expandtab
" Set text width to 80 characters.
set tw=79
" This option copies indent from current line when starting a new line.
set autoindent
" Enable syntax highlighting.
syntax on
" Show the line & column number of the cursor position, separated by a comma.
set ruler
" Print the line number in front of each line.
set number
" Enable mouse input for all modes.
set mouse=a
" Enable 256-color color schemes
let &t_Co=256
" Set 0 to ^
noremap 0 ^
" Set colorscheme. From w0ng/vim-hybrid.
set background=dark
colorscheme hybrid
" set leader key to ,
:let mapleader = ","
" Strip trailing whitespace on buffer save.
" source: http://vimcasts.org/episodes/tidying-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
" Call StripTrailingWhitespaces upon saving Scala, Python, Java, C, C++, and Objective-C files.
autocmd BufWritePre *.scala,*.py,*.java,*.c,*.h,*.m,*.cpp,*.sh : call <SID>StripTrailingWhitespaces()
" Airline configuration
set laststatus=2
let g:airline_theme='base16'
" Directories for swp files. This doesn't pollute the working directories.
set backupdir=~/.vim/backup
set directory=~/.vim/backup
" Tagbar activation
nmap <leader>b :TagbarToggle<CR>
" Move between windows with <C-hjkl> and <C-Tab>
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
map <C-Tab> <C-W>w
" NERDTree configuration
nnoremap <Leader>v :let NERDTreeQuitOnOpen = 1<bar>NERDTreeToggle<CR>
nnoremap <Leader>V :let NERDTreeQuitOnOpen = 0<bar>NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.o$']
let NERDTreeMapOOpenInTab='\r'
" Open vsplits to right and splits to bottom
set splitbelow
set splitright
" Set line spacing to 3
set lsp=3
" Highlight search results
set hlsearch
" Disable folding in vim markdown
let g:vim_markdown_folding_disabled = 1
" Press Space to turn off highlighting and clear any message already displayed.
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
""""""""""""""""""""""
" Plug Configuration "
" NOTE: To install new plugins, run :PlugInstall "
""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" *** UTILITY PLUGINS ***
"" Activate NERDTree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Tab completion in vim
Plug 'ervandew/supertab'
" Autoformat tabs
Plug 'godlygeek/tabular'
" Browse tags in current file
Plug 'majutsushi/tagbar'
" Enhanced status/tabline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Show git diff in gutter of file
Plug 'airblade/vim-gitgutter'
" Simplifies modifying 'surroundings'
Plug 'tpope/vim-surround'
" Automatically close parens, quotes, etc.
Plug 'cohama/lexima.vim'
" *** LANGUAGE-SPECIFIC PLUGINS ***
" Go syntax highlighting in vim
Plug 'fatih/vim-go'
" Markdown syntax highlighting for vim
Plug 'plasticboy/vim-markdown'
" Scala syntax highlighting for vim
Plug 'derekwyatt/vim-scala'
" Automatic pep8 indenting
Plug 'Vimjas/vim-python-pep8-indent'
call plug#end()