Skip to content

Commit a2a1d3f

Browse files
committed
cleaned up vimrc a little and added some small things
1 parent 8aaf6a3 commit a2a1d3f

File tree

1 file changed

+57
-26
lines changed

1 file changed

+57
-26
lines changed

vimrc

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ set hidden " Useful for auto setting hidden buffers
2121
syntax enable " Enable syntax highlighting
2222
set nostartofline " Don't reset cursor to start of line when moving around
2323
set ttyfast
24+
set history=1000
2425

2526
" Searching/Moving {{{2
2627
" nnoremap / /\v
@@ -35,30 +36,25 @@ nnoremap k gk
3536
3637
" Appearance {{{2
3738
" set number " Always show line numbers
38-
set listchars=tab:\ ,trail:·,eol " Use new symbols for tabstops and EOLs
39+
set listchars=tab:\|\ ,trail:·,eol " Use new symbols for tabstops and EOLs
3940
set ts=2 sts=2 sw=2 noexpandtab " Default tab stops
41+
set backspace=indent,eol,start
4042
set showcmd " Shows incomplete command
4143
set novb noeb " Turn off visual bell and remove error beeps
4244
set splitbelow " New window goes below
4345
set splitright " New windows goes right
44-
set wildignore+=*.jpg,*.jpeg,*.gif,*.png,*.gif,*.psd,*.o,*.obj,*.min.js
45-
set wildignore+=*/smarty/*,*/vendor/*,*/node_modules/*,*/.git/*,*/.hg/*,*/.svn/*,*/.sass-cache/*,*/log/*,*/tmp/*,*/build/*,*/ckeditor/*
4646
set wildmenu " Enhance command-line completion
4747
set wildmode=longest:full,full
48+
set wildignore+=*.jpg,*.jpeg,*.gif,*.png,*.gif,*.psd,*.o,*.obj
49+
set wildignore+=*/smarty/*,*/vendor/*,*/node_modules/*,*/.git/*,*/.hg/*,*/.svn/*,*/.sass-cache/*,*/log/*,*/tmp/*,*/build/*,*/ckeditor/*,*.DS_Store
4850
set encoding=utf-8
4951
set cursorline " Highlight current line
5052
set laststatus=2 " Always show the statusline
5153
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
52-
set backspace=indent,eol,start
5354

5455
" Colors and Theme {{{2
5556
set background=dark
5657
colorscheme badwolf
57-
58-
" Do I need this
59-
if &t_Co > 2 || has("gui_running")
60-
syntax on" Enable syntax highlighting
61-
endif
6258
" Auto Commands {{{1
6359
" Auto source vimrc on save {{{2
6460
augroup reload_vimrc " {
@@ -77,6 +73,8 @@ endif
7773

7874
" Save on losing focus {{{2
7975
au FocusLost * :wa
76+
" Resize splits when window is resized {{{2
77+
au VimResized * exe "normal! \<c-w>="
8078
" Clean up nasty wysiwig html {{{2
8179
" Install pandoc first
8280
" https://code.google.com/p/pandoc/downloads/list
@@ -97,31 +95,49 @@ if has("autocmd")
9795
autocmd FileType html setlocal formatexpr=FormatprgLocal(pandoc_pipeline)
9896
endif
9997
" Mappings {{{1
100-
inoremap <C-c> <ESC>" Just smart
101-
inoremap jj <ESC>:w<CR>
102-
98+
" Stuff {{{2
10399

104100
command! W w" Remap :W to :w
105101

106102
nnoremap Y y$ " Yank to end of line with Y
107-
108-
" Visually select the text that was last edited/pasted
109-
nmap gV `[v`]
103+
nnoremap D d$ " Delete to end of line with D
110104
111105
" like gv but for pasted text
112106
" nnoremap <leader>v V`]
113107

114108
" Not sure about this one quite yet
115109
" nnoremap ; :
116110

117-
nmap fq :q!<CR>
111+
" :Wrap to wrap lines command! -nargs=* Wrap set wrap linebreak nolist
112+
113+
" Visual Selection {{{2
114+
115+
" Fix linewise visual selection of various text objects
116+
nnoremap Vat vatV
117+
nnoremap Vab vabV
118+
nnoremap VaB vaBV
119+
120+
" Don't move on *
121+
nnoremap * *<c-o>
122+
123+
" Visually select the text that was last edited/pasted
124+
nmap gV `[v`]
125+
126+
" Searching {{{2
127+
118128
" Control space to search mode
119129
nnoremap <Nul> /
120130
121-
" :Wrap to wrap lines command! -nargs=* Wrap set wrap linebreak nolist
131+
" Keep search matches in the middle of the window
132+
nnoremap n nzzzv
133+
nnoremap N Nzzzv
134+
" Escaping {{{2
135+
inoremap <C-c> <ESC>" Just smart
136+
inoremap jj <ESC>:w<CR>
137+
138+
" Force quit that bitch
139+
nmap fq :q!<CR>
122140
123-
" Toggle errors
124-
nmap <leader>st :SyntasticToggleMode<cr>
125141
" Filetype {{{2
126142
nmap _ht :set ft=html<CR>
127143
nmap _ph :set ft=php<CR>
@@ -136,6 +152,9 @@ nmap _vi :set ft=vim<CR>
136152
nnoremap <Space> za
137153
" nnoremap <Space> /
138154

155+
" Use ,z to "focus" the current fold
156+
nnoremap <leader>z zMzvzz
157+
139158
" Bubble single lines {{{2
140159
nmap <C-Up> [e
141160
nmap <C-Down> ]e
@@ -160,13 +179,13 @@ nnoremap <C-e> 3<C-e> " Speed up viewport scrolling
160179
nnoremap <C-y> 3<C-y>
161180
162181
" Syntax highlighting groups for word under cursor {{{2
163-
nmap <C-S-P> :call <SID>SynStack()<CR>
164-
function! <SID>SynStack()
165-
if !exists("*synstack")
166-
return
167-
endif
168-
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
169-
endfunc
182+
" nmap <C-S-P> :call <SID>SynStack()<CR>
183+
" function! <SID>SynStack()
184+
" if !exists("*synstack")
185+
" return
186+
" endif
187+
" echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
188+
" endfunc
170189

171190
" Awesome fucking pasting {{{2
172191
function! WrapForTmux(s)
@@ -338,6 +357,16 @@ endfunction
338357
" run test runner
339358
map <leader>t :call RunTestFile()<cr>
340359
map <leader>T :call RunNearestTest()<cr>
360+
" Visual Mode */# from Scrooloose {{{2
361+
function! s:VSetSearch()
362+
let temp = @@
363+
norm! gvy
364+
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
365+
let @@ = temp
366+
endfunction
367+
368+
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o>
369+
341370
" Plugins {{{1
342371
" Easy-motion {{{2
343372
" let g:EasyMotion_leader_key = '<Leader>'
@@ -375,6 +404,8 @@ let g:rbpt_loadcmd_toggle = 0
375404
" Syntastic {{{2
376405
let g:syntastic_auto_loc_list = 1
377406
let g:syntastic_loc_list_height = 5
407+
" Toggle errors
408+
nmap <leader>st :SyntasticToggleMode<cr>
378409
" Tabularize {{{2
379410
if exists(":Tabularize")
380411
nmap <Leader>a= :Tabularize /=<CR>

0 commit comments

Comments
 (0)