-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
128 lines (102 loc) · 2.4 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
set nocompatible
source ~/.vim/vundlerc
source ~/.vim/vundles
" UI
syntax enable
colorscheme ir_black
set background=dark
set clipboard=unnamed
set colorcolumn=80
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set lazyredraw
set list
set listchars=tab:▸\ ,eol:¬
set magic
set nowrap
set number
set pastetoggle=<F4>
set relativenumber
set ruler
set scrolloff=5
set showmatch
set smartcase
set splitright
set ttyfast
set wildignore+=.git
set wildmenu
set wildmode=list:full
" force terminal colors
set t_Co=256
if has("gui_macvim")
set guifont=Monaco:h12
endif
if has("gui_running")
" removes toolbars from gui
set guioptions=egrt
endif
" editing
set autoindent
set backspace=indent,eol,start
set encoding=utf-8
set expandtab
set shiftround
set shiftwidth=4
set softtabstop=4
set tabstop=4
" file types
autocmd BufNewFile,BufRead *.yaml,*.yml setf yaml
autocmd BufNewFile,BufRead *.clj setf clojure
autocmd BufNewFile,BufRead *.go setf go
autocmd BufNewFile,BufRead *.ejs setf html
autocmd BufNewFile,BufRead *.slim setf slim
autocmd BufNewFile,BufRead *.md setf markdown
autocmd BufNewFile,BufRead *.json setf markdown
autocmd BufNewFile,BufRead Gemfile,Thorfile,Capfile setf ruby
autocmd BufNewFile,BufRead *.blade.php setf blade
" keeps information between sessions
set backup
set backupdir=~/.vim/tmp
set directory=~/.vim/tmp
set modelines=0
set undodir=~/.vim/tmp
set undofile
set writebackup
set viminfo='10,\"30,:20,%,n~/.viminfo
au BufReadPost * if line("'\"")|execute("normal `\"")|endif
" mappings
vnoremap S :sort<cr>
nmap <tab> %
vmap <tab> %
nmap <C-e> :e#<CR>
" very magic search regex
nnoremap / /\v
vnoremap / /\v
" clears last search's highlight
nnoremap <silent> <cr> :nohlsearch<cr>
" strips trailing whitespaces
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<cr>
" converts tabs to spaces
nnoremap <leader>T :%s/\t/ /g<cr>:let @/=''<cr>
" converts quotes between simple and double
nnoremap <leader>' :s/"/'/g<cr>:let @/=''<cr>
nnoremap <leader>" :s/'/"/g<cr>:let @/=''<cr>
" disables arrows
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap jk <ESC>
" redraws screen.
nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
" sudo a write
cmap w!! w !sudo tee % >/dev/null
" plugins
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']