forked from aziz/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.local
75 lines (65 loc) · 2 KB
/
vimrc.local
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
set t_Co=256
set background=dark
color grb256
if has("gui_running")
set guifont=Menlo:h12
endif
if has("gui_macvim")
let macvim_hig_shift_movement = 1
endif
let mapleader=","
set noerrorbells
set visualbell
set t_vb=
set mouse=a " enable mouse support in console
set showmatch " show matching brackets.
set showcmd " shows what you're typing as a command
" set virtualedit=all " easier cursor control
set guioptions=aAce " no scrollbars
set incsearch " do incremental searching
set autoread " watch for file changes
set noswapfile " disable swapfiles
set nobackup " disable backups
inoremap jj <Esc>hh " remap jj to escape in insert mode. You'll never type jj anyway!
nmap <Leader>v :tabedit $MYVIMRC<CR>
nmap <Leader>vl :tabedit $MYVIMRC.local<CR>
nmap <Leader>gv :tabedit $MYGVIMRC<CR>
nmap <Leader>s :source $MYVIMRC<CR>
if has("folding")
set foldenable
set foldmethod=syntax
set foldlevel=1
set foldnestmax=2
set foldtext=strpart(getline(v:foldstart),0,50).'\ ...\ '.substitute(getline(v:foldend),'^[\ #]*','','g').'\ '
endif
" it will allow you to use :w!! to write to a file using sudo if you forgot to
" sudo vim file (it will prompt for sudo password when writing)
cmap w!! %!sudo tee > /dev/null %
function StripTrailingWhitespace()
if !&binary && &filetype != 'diff'
normal mz
normal Hmy
%s/\s\+$//e
normal 'yz<CR>
normal `z
endif
endfunction
map <Leader>strip :call StripTrailingWhitespace()<CR>
" Leader shortcuts for Rails commands
" map <Leader>m :Rmodel
" map <Leader>c :Rcontroller
" map <Leader>v :Rview
" map <Leader>u :Runittest
" map <Leader>f :Rfunctionaltest
" map <Leader>tm :RTmodel
" map <Leader>tc :RTcontroller
" map <Leader>tv :RTview
" map <Leader>tu :RTunittest
" map <Leader>tf :RTfunctionaltest
" map <Leader>sm :RSmodel
" map <Leader>sc :RScontroller
" map <Leader>sv :RSview
" map <Leader>su :RSunittest
" map <Leader>sf :RSfunctionaltest
" command! Rroutes :e config/routes.rb
" command! Rschema :e db/schema.rb