forked from giggio/vimfiles
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.vimrc
198 lines (175 loc) · 6.97 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
" Disable beep
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
" Based on @mislav post http://mislav.uniqpath.com/2011/12/vim-revisited/
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" My customizations
set ls=2 " always show status bar
set number " show line numbers
set cursorline " display a marker on current line
colorscheme railscasts " set colorscheme
set completeopt=menuone,longest,preview " simple autocomplete for anything
set wildmode=list:longest,full " autocomplete for paths and files
set wildignore+=.git " ignore these extensions on autocomplete
set hidden " change buffers without warnings even when there are unsaved changes
set backupdir=/tmp " directory used to save backup files
set directory=/tmp " directory used to save swap files
if has("win32")
set backupdir=$TEMP
set directory=$TEMP
endif
set nobackup
set nowritebackup
set t_Co=256 " forces terminal to use 256 colors
if has("gui_running")
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=Menlo\ Regular:h14
elseif has("gui_win32")
set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI,Consolas:h11:cANSI,Courier:h12:cANSI
endif
endif
map <F2> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1
:set guioptions+=m "add menu bar
:set guioptions-=T "remove toolbar
:set guioptions-=r "remove right-hand scroll bar
"function! Smart_TabComplete()
" let line = getline('.') " current line
"
" let substr = strpart(line, -1, col('.')+1) " from the start of the current
" " line to one character right
" " of the cursor
" let substr = matchstr(substr, "[^ \t]*$") " word till cursor
" if (strlen(substr)==0) " nothing to match on empty string
" return "\<tab>"
" endif
" let has_period = match(substr, '\.') != -1 " position of period, if any
" let has_slash = match(substr, '\/') != -1 " position of slash, if any
" if (!has_period && !has_slash)
" return "\<C-X>\<C-P>" " existing text matching
" elseif ( has_slash )
" return "\<C-X>\<C-F>" " file matching
" else
" return "\<C-X>\<C-O>" " plugin matching
" endif
"endfunction
"inoremap <tab> <c-r>=Smart_TabComplete()<CR>
let g:loaded_syntastic_typescript_tsc_checker = 1 "don't do syntax checking
let g:syntastic_coffee_coffeelint_args = "--csv --file ~/.vim/coffeeLintConfig.json"
command -nargs=1 C CoffeeCompile | :<args>
nmap <F8> :TagbarToggle<CR>
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : '--include-vars',
\ 'kinds' : [
\ 'f:functions',
\ 'o:object',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object',
\ }
\ }
endif
let vimlocal = expand("%:p:h") . "/.vimrc.local"
if filereadable(vimlocal)
execute 'source '.vimlocal
endif
map <S-A-l> :NERDTreeFind<CR>
imap jj <Esc>
nmap oo o<Esc>k
nmap OO O<Esc>j
au GUIEnter * simalt ~x
nmap <F9> :mksession! <cr> " Quick write session with F9
nmap <F10> :source Session.vim <cr> " And load session with F10
set switchbuf+=usetab,newtab
set wrapscan
if has("win32")
let g:slime_target = "tmux"
endif
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#close_symbol = ''
let g:airline#extensions#tabline#buffer_nr_format = 'b%s: '
"let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline#extensions#tabline#fnamecollapse = 1
let g:airline_theme='dark'
" remap split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" open splits in a more natural way:
set splitbelow
set splitright
set number relativenumber
set diffopt=filler,vertical
au BufReadPost fugitive:* set bufhidden=delete
fun! QuitPrompt(cmd)
if tabpagenr("$") == 1 && winnr("$") == 1
let choice = confirm("Close?", "&yes\n&no", 1)
if choice == 1 | return a:cmd | endif
return ""
else | return a:cmd | endif
endfun
cnoreabbrev <expr> q getcmdtype() == ":" && getcmdline() == 'q' ? QuitPrompt(getcmdline()) : 'q'
cnoreabbrev <expr> wq getcmdtype() == ":" && getcmdline() == 'wq' ? QuitPrompt(getcmdline()) : 'wq'
cnoreabbrev <expr> x getcmdtype() == ":" && getcmdline() == 'x' ? QuitPrompt(getcmdline()) : 'x'
" highlight trailing white spaces:
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
let g:SuperTabDefaultCompletionType = 'context'
let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
let g:SuperTabClosePreviewOnPopupClose = 1
set completeopt=longest,menuone,preview
" this setting controls how long to wait (in ms) before fetching type / symbol information.
set updatetime=500
" Remove 'Press Enter to continue' message when type information is longer than one line.
set cmdheight=2
" Enable snippet completion, requires completeopt-=preview
" would need to instal ultisnips, which could conflict with other snippets plugins
"let g:OmniSharp_want_snippet=1
" Easymotion config:
" let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
" nmap s <Plug>(easymotion-overwin-f)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
" nmap s <Plug>(easymotion-overwin-f2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
" map <Leader>j <Plug>(easymotion-j)
" map <Leader>k <Plug>(easymotion-k)
"
set mouse=a