-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
181 lines (143 loc) · 4.92 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
set nocompatible
" PLUGINS
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
call arpeggio#load()
" CUSTOM
set backup " keep a backup file (restore to previous version)
set undofile " keep an undo file (undo changes after closing)
set showcmd " display incomplete commands
syntax on " switch syntax highlighting on
set hlsearch " highlight the last used search pattern
set mouse=a " enable mouse
set number " Show line numbers
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
set list " Show invisible characters
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set clipboard=unnamed " Use the system clipboard
set noshowmode " Hide insert mode display - handled by theme
" Spell check
autocmd FileType mail setlocal spell spelllang=en_us
autocmd BufRead COMMIT_EDITMSG setlocal spell spelllang=en_us
autocmd BufNewFile,BufRead *.md,*.mkd,*.markdown set spell spelllang=en_us
" Force to use underline for spell check results
augroup SpellUnderline
autocmd!
autocmd ColorScheme *
\ highlight SpellBad
\ cterm=Underline
\ ctermfg=NONE
\ ctermbg=NONE
\ term=Reverse
\ gui=Undercurl
\ guisp=Red
autocmd ColorScheme *
\ highlight SpellCap
\ cterm=Underline
\ ctermfg=NONE
\ ctermbg=NONE
\ term=Reverse
\ gui=Undercurl
\ guisp=Red
autocmd ColorScheme *
\ highlight SpellLocal
\ cterm=Underline
\ ctermfg=NONE
\ ctermbg=NONE
\ term=Reverse
\ gui=Undercurl
\ guisp=Red
autocmd ColorScheme *
\ highlight SpellRare
\ cterm=Underline
\ ctermfg=NONE
\ ctermbg=NONE
\ term=Reverse
\ gui=Undercurl
\ guisp=Red
augroup END
" Set backup directories
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//
set listchars=trail:\ ,tab:\ \ ,precedes:«,extends:»
let mapleader = ","
let maplocalleader = "\\"
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;
Arpeggio inoremap jk <Esc>
Arpeggio vnoremap jk <Esc>
let g:EasyClipAlwaysMoveCursorToEndOfPaste = 1
let g:EasyClipShareYanks = 1
let g:EasyClipUseSubstituteDefaults = 1
nmap M <Plug>MoveMotionEndOfLinePlug
" Don't use Ex mode, use Q for formatting
map Q gq
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" http://vim.wikia.com/wiki/Always_start_on_first_line_of_git_commit_message
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
" format the entire file
nnoremap <leader>fef :normal! gg=G``<CR>
" upper/lower word
nmap <leader>u mQviwU`Q
nmap <leader>l mQviwu`Q
" upper/lower first char of word
nmap <leader>U mQgewvU`Q
nmap <leader>L mQgewvu`Q
" cd to the directory containing the file in the buffer
nmap <silent> <leader>cd :lcd %:h<CR>
" Create the directory containing the file in the buffer
nmap <silent> <leader>md :!mkdir -p %:p:h<CR>
" find merge conflict markers
nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" Map the arrow keys to be based on display lines, not physical lines
map <Down> gj
map <Up> gk
" Map command-[ and command-] to indenting or outdenting
" while keeping the original selection in visual mode
vmap <A-]> >gv
vmap <A-[> <gv
nmap <A-]> >>
nmap <A-[> <<
omap <A-]> >>
omap <A-[> <<
imap <A-]> <Esc>>>i
imap <A-[> <Esc><<i
" Use a line cursor within insert mode and a block cursor everywhere else.
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" THEME
set background=dark " tell vim we're using a dark background
colorscheme disco
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'relativepath', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"x":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ }
\ }