|
@@ -3,11 +3,6 @@ execute pathogen#infect()
|
|
|
Helptags
|
|
Helptags
|
|
|
filetype plugin indent on
|
|
filetype plugin indent on
|
|
|
|
|
|
|
|
-"""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
-" Some Basics
|
|
|
|
|
-" Note : vim-sensible does some of these
|
|
|
|
|
-" settings already
|
|
|
|
|
-"""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
set encoding=utf-8
|
|
set encoding=utf-8
|
|
|
|
|
|
|
|
" Search settings
|
|
" Search settings
|
|
@@ -30,26 +25,22 @@ set nofoldenable
|
|
|
set foldmethod=indent
|
|
set foldmethod=indent
|
|
|
set foldnestmax=10
|
|
set foldnestmax=10
|
|
|
set viewoptions=cursor,folds,slash,unix
|
|
set viewoptions=cursor,folds,slash,unix
|
|
|
-" let g:skipview_files = ['*\.vim']
|
|
|
|
|
-
|
|
|
|
|
-" Line numbers
|
|
|
|
|
-set number
|
|
|
|
|
-
|
|
|
|
|
-" Line Wrapping
|
|
|
|
|
-set nowrap
|
|
|
|
|
-
|
|
|
|
|
-" Automatically update externally updated files
|
|
|
|
|
-set autoread
|
|
|
|
|
|
|
|
|
|
" Command expiration
|
|
" Command expiration
|
|
|
set timeout
|
|
set timeout
|
|
|
set ttimeoutlen=15
|
|
set ttimeoutlen=15
|
|
|
|
|
|
|
|
-" New window split settings
|
|
|
|
|
-set splitright
|
|
|
|
|
|
|
+" Set font for (m|g)vim
|
|
|
|
|
+set guifont=Meslo\ LG\ S\ for\ Powerline:h11
|
|
|
|
|
+set guioptions=ce
|
|
|
|
|
|
|
|
-" Remember buffer info on close
|
|
|
|
|
-set viminfo^=%
|
|
|
|
|
|
|
+set number " Line numbers
|
|
|
|
|
+set nowrap " Line Wrapping
|
|
|
|
|
+set hidden " Just hide buffer when :bd'ing
|
|
|
|
|
+set autoread " Automatically update externally updated files
|
|
|
|
|
+set cc=80 " Which line is the 80th column?
|
|
|
|
|
+set splitright " New window split settings
|
|
|
|
|
+set viminfo^=% " Remember buffer info on close
|
|
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
|
" Keybinds
|
|
" Keybinds
|
|
@@ -62,20 +53,15 @@ nnoremap j gj
|
|
|
nnoremap k gk
|
|
nnoremap k gk
|
|
|
|
|
|
|
|
" Set CTRL+S to save becuase I smack that every 10 seconds on whatever application I use
|
|
" Set CTRL+S to save becuase I smack that every 10 seconds on whatever application I use
|
|
|
-" browse is only available in gvim
|
|
|
|
|
-command -nargs=0 -bar Update if &modified
|
|
|
|
|
- \| if empty(bufname('%'))
|
|
|
|
|
- \| browse confirm write
|
|
|
|
|
- \| else
|
|
|
|
|
- \| confirm write
|
|
|
|
|
- \| endif
|
|
|
|
|
|
|
+command! -nargs=0 -bar Save if &modified
|
|
|
|
|
+ \| confirm write
|
|
|
\|endif
|
|
\|endif
|
|
|
nnoremap <silent> <C-s> :Update<CR>
|
|
nnoremap <silent> <C-s> :Update<CR>
|
|
|
inoremap <C-s> <C-o>:Update<CR>
|
|
inoremap <C-s> <C-o>:Update<CR>
|
|
|
vnoremap <C-s> <C-o>:Update<CR>
|
|
vnoremap <C-s> <C-o>:Update<CR>
|
|
|
|
|
|
|
|
" CTRL+w to close the current buffer
|
|
" CTRL+w to close the current buffer
|
|
|
-nnoremap <silent> <C-w> :call CloseWindow()<CR>
|
|
|
|
|
|
|
+nnoremap <silent> <C-w> :bd<CR>
|
|
|
|
|
|
|
|
" Buffer magic
|
|
" Buffer magic
|
|
|
nnoremap <leader>l :ls<CR>:b<space>
|
|
nnoremap <leader>l :ls<CR>:b<space>
|
|
@@ -107,11 +93,10 @@ vnoremap <A-d> y<C-o>p
|
|
|
inoremap <A-d> <C-o>:yank<CR><C-o>:put<CR>
|
|
inoremap <A-d> <C-o>:yank<CR><C-o>:put<CR>
|
|
|
|
|
|
|
|
" Open new files in new buffer or new windows
|
|
" Open new files in new buffer or new windows
|
|
|
-nnoremap <C-o> :e<space>
|
|
|
|
|
nnoremap <C-p> :sp<space>
|
|
nnoremap <C-p> :sp<space>
|
|
|
nnoremap <A-p> :vs<space>
|
|
nnoremap <A-p> :vs<space>
|
|
|
|
|
|
|
|
-" Move lines of text via Alt+[jk] (Like sublime!)
|
|
|
|
|
|
|
+" Move lines of text via Cmd+[jk]
|
|
|
nnoremap <A-j> :m+1<CR>==
|
|
nnoremap <A-j> :m+1<CR>==
|
|
|
nnoremap <A-k> :m-2<CR>==
|
|
nnoremap <A-k> :m-2<CR>==
|
|
|
vnoremap <A-j> :m '>+1<CR>gv=gv
|
|
vnoremap <A-j> :m '>+1<CR>gv=gv
|
|
@@ -124,8 +109,22 @@ nnoremap <silent> <C-i> :nohlsearch<CR>
|
|
|
set backupdir=~/.vim/tmp/backup//
|
|
set backupdir=~/.vim/tmp/backup//
|
|
|
set directory=~/.vim/tmp/swap//
|
|
set directory=~/.vim/tmp/swap//
|
|
|
set undodir=~/.vim/tmp/undo//
|
|
set undodir=~/.vim/tmp/undo//
|
|
|
|
|
+set viewdir=~/.vim/tmp/view//
|
|
|
set undofile
|
|
set undofile
|
|
|
|
|
|
|
|
|
|
+map <S-k> <nop>
|
|
|
|
|
+map <S-q> <nop>
|
|
|
|
|
+
|
|
|
|
|
+"""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
+" vim-rspec
|
|
|
|
|
+"""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
+
|
|
|
|
|
+map <silent> <leader>t :call RunCurrentSpecFile()<CR>
|
|
|
|
|
+map <silent> <leader>a :call RunAllSpecs()<CR>
|
|
|
|
|
+map <silent> <leader>s :call RunNearestSpec()<CR>
|
|
|
|
|
+map <silent> <leader>k :call RunLastSpec()<CR>
|
|
|
|
|
+let g:rspec_command = "bundle exec spec {spec}"
|
|
|
|
|
+
|
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
|
" Ctrl-P Settings
|
|
" Ctrl-P Settings
|
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
"""""""""""""""""""""""""""""""""""""""""
|
|
@@ -226,15 +225,18 @@ while c <= 'z'
|
|
|
let c = nr2char(1+char2nr(c))
|
|
let c = nr2char(1+char2nr(c))
|
|
|
endw
|
|
endw
|
|
|
|
|
|
|
|
-" Close current window or vim if no unsaved windows are open.
|
|
|
|
|
-fun! CloseWindow()
|
|
|
|
|
- if &modified
|
|
|
|
|
- echo "Save first or manual exit."
|
|
|
|
|
- else
|
|
|
|
|
- if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
|
|
|
|
- q
|
|
|
|
|
- else
|
|
|
|
|
- :bd
|
|
|
|
|
- endif
|
|
|
|
|
|
|
+" Close current window or quit vim if no active windows
|
|
|
|
|
+autocmd BufDelete * if len(filter(range(1, bufnr('$')), '!empty(bufname(v:val)) && buflisted(v:val)')) == 1 | q | endif
|
|
|
|
|
+
|
|
|
|
|
+" For auto-aligning Cucumber tables
|
|
|
|
|
+inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
|
|
|
|
|
+function! s:align()
|
|
|
|
|
+ let p = '^\s*|\s.*\s|\s*$'
|
|
|
|
|
+ if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
|
|
|
|
|
+ let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
|
|
|
|
|
+ let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
|
|
|
|
|
+ Tabularize/|/l1
|
|
|
|
|
+ normal! 0
|
|
|
|
|
+ call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
|
|
endif
|
|
endif
|
|
|
endfunction
|
|
endfunction
|