-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
122 lines (93 loc) · 3.43 KB
/
vimrc
File metadata and controls
122 lines (93 loc) · 3.43 KB
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
call pathogen#infect()
call pathogen#helptags()
let mapleader = ','
syntax on
syntax enable
filetype plugin indent on
scriptencoding utf-8
set hlsearch
set nobackup
set nowritebackup
set noswapfile
set fencs=utf-8
set mouse=
" switch between buffers without errors
set hidden
" indentations
vnoremap > >gv
vnoremap < <gv
set pastetoggle=<F2>
" Turn off search highlights
map <Leader>nn :ohlsearch<CR>
set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
" after 3 spaces and pressing tab it will be 4 spaces - not 5
set shiftround
autocmd FileType make setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
autocmd FileType yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType ruby setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType erlang setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
autocmd BufNewFile,BufRead *.app,*.app.src setfiletype erlang
autocmd FileType html setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType haml setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType css setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType sass setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType scss setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType coffee setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd BufRead,BufNewFile *.gitconfig setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd Filetype gitcommit setlocal textwidth=72
autocmd Filetype gitcommit setlocal spell
nnoremap <silent> <F6> :g/^$/d<CR>
nnoremap <silent> <F5> :call <SID>StripTrailingSpaces()<CR>
function! <SID>StripTrailingSpaces()
" save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" strip trailing spaces
%s/\s\+$//e
" restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
augroup StripTrailingSpaces
autocmd!
autocmd BufWritePre *.erl,*.rb,*.py,*.yml,*.yaml call <SID>StripTrailingSpaces()
augroup END
set nu
" ignore these
set wildignore=*.dll,*.o,*.obj,*.bak,*.pyc,*.swp
" Plugins
" NERDTree
map <silent> <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
let g:NERDTreeShowHidden=1
let g:NERDTreeIgnore=['\.DS_Store$', '\.git$']
" Start NERDTree when Vim is started without file arguments.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
" Colors
autocmd VimEnter * highlight NERDTreeDir guifg=NONE ctermfg=cyan
autocmd VimEnter * highlight NERDTreeFile guifg=NONE ctermfg=NONE
autocmd VimEnter * highlight NERDTreeLinkTarget guifg=NONE ctermfg=NONE
autocmd VimEnter * highlight NERDTreeLinkFile guifg=NONE ctermfg=magenta
autocmd VimEnter * highlight NERDTreeExecFile guifg=NONE ctermfg=red
" shortcut to rapidly toggle `set list`
nmap <C-l> :set list!<CR>
set listchars=tab:▸\ ,eol:¬,nbsp:¶
" Colors!
" invisible character colors
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
" highlight the 80th column
highlight OverLength ctermbg=darkred ctermfg=white guibg=#FFD9D9
match OverLength /\%>80v.\+/
nnoremap ; :
" Cheat!
command! -complete=file -nargs=+ Cheat call Cheat(<q-args>)
function! Cheat(command)
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
execute 'silent $read !cheat '.escape(a:command,'%#')
setlocal nomodifiable
endfunction