-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
153 lines (126 loc) · 5.24 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
" plugins
set nocompatible " break backwards compatibility
set backspace=2
" install all plugins in bundle folder
execute pathogen#infect()
filetype plugin on " enable vim files on a filetype basis (see ftplugin folder)
" colors
colorscheme Tomorrow" set color scheme to bad solarized
set background=light " use a dark color theme
let g:solarized_termcolors = 16 " use 16 color solarized
let g:solarized_termtrans = 0 " disable compability
let g:solarized_degrade = 0 " disable compatibility
let g:solarized_bold = 1 " enable bold fonts
let g:solarized_underline = 1 " enable underline fonts
let g:solarized_italic = 1 " enable italic fonts
let g:solarized_contrast = "normal" " default contrast for text
let g:solarized_visibility= "normal" " dfault visibility for text
syntax on " enable syntax highlighting
set title " display doc name in terminal title
set showcmd " show command in bottom bar
set ttyfast " force fast tty (should enable by default on urxvt)
set cmdheight=2
" temp files
set nobackup " don't write backup files since I use git
set nowb " don't write backup files since I use git
set noswapfile " dont write swap files
inoremap jk <Esc>| " remap pressing jk in insert mode to exiting insert mode
" formatting
set tabstop=8 " number of visual spaces per TAB
set softtabstop=0 " number of spaces in tab when editing
set expandtab " tabs are spaces
filetype indent on " load filetype-specific indent settings
set shiftwidth=4
set smarttab " smart tab indenting as you edit code
" movement
nnoremap B ^| " move to beginning of line
nnoremap E $| " move to end of line
nnoremap dB d^| " also remap delete
nnoremap dE d$| " also remap delete
vnoremap B ^| " also remap visual mode
vnoremap E $| " also remap visual mode
nnoremap j gj| " move by visual line
nnoremap k gk| " move by visual line
nnoremap K <C-B> " page up
nnoremap J <C-F> " page down
let mapleader="," " map leader from \ to ,
nnoremap <C-h> <C-w>h| " move window left
nnoremap <C-j> <C-w>j| " move window down
nnoremap <C-k> <C-w>k| " move window up
nnoremap <C-l> <C-w>l| " move window right
nmap <Space> i_<Esc>r| " use space to insert one char
set scrolloff=2 " keep two lines on screen when scrolling
nnoremap <tab> %
vnoremap <tab> %
" swap marker keys
nnoremap ' `
nnoremap ` '
" Next quickfix
nnoremap [l :lprev<CR><CR>| " go to previous
nnoremap ]l :lnext<CR><CR>| " go to previous
" Revert Git hunk
nnoremap <leader>g :GitGutterRevertHunk<CR>
" Search
nnoremap <leader>a :Ag
set viminfo='10,\"100,:20,%,n~/.viminfo " remember where in a file we were when we closed
nnoremap ; :| " map the ; to do the same as pressing SHIFT+;
" clipboard
let g:clipbrdDefaultReg = '+' " use xwindow clipboard for cutting and pasting
" search
set ignorecase " ignore case when searching
set smartcase " only use case if not all lower case in search
set hlsearch " highight search terms
set incsearch " show search results as you type
nmap <silent> ,/ :nohlsearch<CR>| " disable highlighting easily
set pastetoggle=<F2> " easy way to toggle paste mode if needed
set mouse=a " mouse support to avoid having to toggle paste mode
set number " line numbers
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
set laststatus=2
set shortmess=I
" status line
let g:airline_powerline_fonts = 1 " enable powerline symbols for status
let g:promptline_preset = {
\'a' : [ promptline#slices#host() ],
\'c' : [ promptline#slices#cwd() ],
\'x' : [ promptline#slices#git_status() ],
\'y' : [ promptline#slices#vcs_branch() ],
\'warn' : [ promptline#slices#last_exit_code() ]}
let g:airline#extensions#whitespace#enabled = 0 " disable whitespace detection on status line
" tagbar
nnoremap <leader>t :TagbarOpenAutoClose<CR>| " command to open tagbar
let g:tagbar_compact = 1 " remove the help item
let g:tagbar_sort = 0 " sort by order in file
noremap <F1> <Esc>| " Avoid accidental hits of <F1> while aiming for <Esc>
nnoremap Q <nop>| " Turn off Q
" python-mode
let g:pymode_folding = 0 " disable folding
let g:pymode_lint_on_write = 1 " enable lint on write (run manually)
let g:pymode_doc_bind = '' " disable doc key since it is used for page up
let g:pymode_lint_cwindow = 0 " disable open window for errors
" eclim
let g:EclimCompletionMethod = 'omnifunc' " use YouCompleteMe for eclim completion
noremap <leader>o <C-w>z| " close all buffers but this one and preview window
autocmd VimEnter * :EclimDisable
autocmd VimEnter *.java :EclimEnable
autocmd BufRead *.java :EclimEnable
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
set autochdir " Switch our directory to current open file
so ~/.vim/autoload/WatchForChanges.vim
:nnoremap <leader>s a<C-X><C-S>| "use <leader>s to get spelling suggestions
" easytags
let g:easytags_suppress_report = 1
nnoremap <C-l> :redraw!<CR>| " force redraw
let g:ycm_filetype_specific_completion_to_disable = {
\ 'gitcommit': 1,
\}
" gvim
:set guioptions-=m "remove menu bar
:set guioptions-=T "remove toolbar
:set guioptions-=r "remove right-hand scroll bar
:set guioptions-=L "remove left-hand scroll bar