-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
194 lines (137 loc) · 4.29 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
" Vundle! ---------------------------------------------------- {{{
" Briefly turn off file type recognition
filetype off
" Use Vundle
set runtimepath+=~/.vim/bundle/vundle/
call vundle#rc()
" We find that it helps to install Vundle itself
Bundle 'gmarik/vundle'
" Also use these other plugins
Bundle 'jeffkreeftmeijer/vim-numbertoggle'
Bundle 'vim-scripts/CursorLineCurrentWindow'
Bundle 'fifthposition/columcille'
Bundle 'vim-scripts/TwitVim'
Bundle 'mileszs/ack.vim'
" }}}
" Overall settings of settificationness ---------------------- {{{
" Recognize file types; indent stuff
filetype plugin indent on
" Use 256 colors; we have them
set t_Co=256
" Set the colorscheme
colorscheme everywhere
" Set general leader ,
let mapleader=","
" Local leader: \
let maplocalleader="\\"
" Characters we use for window (etc.) separators
set fillchars=stl:-,stlnc:-,vert:│
" Highlight the 81st column
" call matchadd('ColorColumn', '\%81v', 100)
" set colorcolumn=81
" Turn on syntax highlighting
syntax on
" What we remember when we save a session
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
" Don't make backup files
set nobackup
" Don't even make backup files just for while we're editing
set nowritebackup
" Don't use swap files
set noswapfile
" Show incomplete commands as we're typing them
set showcmd
" Remember the last 50 commands we used
set history=50
" Jump to first search result
set incsearch
" Do not highlight the last search
set nohlsearch
" Highlight search results even when we're on the same line
" (Note: This is specific to our color scheme, and probably
" should be part of it.)
highlight Search term=none cterm=none ctermbg=199 ctermfg=125
highlight IncSearch term=none cterm=none ctermbg=199 ctermfg=125
" Only wrap lines at characters in `breakat`
set linebreak
" Where are we in the file? Show us in the status line.
set ruler
" BTW always show the status line
set laststatus=2
" Highlight the line the cursor's on
set cursorline
" Set the highlight colors for that line
" (Note: This is also specific to our color scheme, and
" probably should be part of it.)
highlight CursorLine term=none cterm=none ctermbg=125 ctermfg=169
highlight Visual term=none cterm=none ctermbg=125 ctermfg=169
" Tabs are two spaces; indent by two spaces
set tabstop=2 shiftwidth=2
" Convert all new tabs to spaces
set expandtab
" Do we have a mouse? We can use a mouse.
if has('mouse')
set mouse=a
endif
" }}}
" File settings and autocommands ---------------------------- {{{
" Set up an autocommand group
augroup yo_settings_etc
" Clear the group
autocmd!
" Try to have the cursor where we last had it in this file
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ execute "normal! g`\"" |
\ endif
autocmd InsertLeave *
\ if expand("%") != "" |
\ update |
\ endif
" End the group
augroup END
" If we're in a Vimscript file...
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}
" Re-mappings and commands ----------------------------------- {{{
" Use jk as escape sequence so we can avoid the distant <Esc> key
inoremap jk <Esc>
" Use jj in insert mode to escape and quit
inoremap jj <Esc>:q!<cr>
" In visual mode, use Y to copy to system clipboard
vnoremap Y "*y
" In normal mode, do the same with the current line
nnoremap Y "*yy
" Use <leader>d in normal mode to delete a line without yanking
nnoremap <leader>d "_dd
" Use it in visual mode to delete selection without yanking
vnoremap <leader>d "_d
" Switch colon and semicolon for faster commanding
nnoremap ; :
nnoremap : ;
" Switch `v` and `V`, because we usually want linewise visual
nnoremap v V
nnoremap V v
" Print the current file's path with Ctrl+p
noremap <c-p> :pwd<cr>
" Eliminate need for w in moving to other windows
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
" Allow save-and-quit even if we mistype :wq
cabbrev ew :wq
cabbrev qw :wq
" <leader>ev opens this file in a new vsplit to the right
nnoremap <leader>ev :vs<cr><c-w>l:e$MYVIMRC<cr>
" <leader>sv sources this file
nnoremap <leader>sv :so $MYVIMRC<cr>
" If we use any of the arrow keys in insert mode, ignore it
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <right> <nop>
inoremap <left> <nop>
" }}}