-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc.local
69 lines (66 loc) · 1.91 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
" Mappings ------- {{{
inoremap jk <esc>
nnoremap + ddkP
nnoremap - ddp
inoremap <c-u> <esc>viwUea
inoremap <c-v> <c-r>"
" Open this file in a new pane
nnoremap <leader>ev :vsplit ~/.vimrc.local<cr>
" Highlight trailing whitespace
nnoremap <leader>w :match Error /\v\s+$/<cr>
nnoremap <leader>W :match Error ""<cr>
" Always search in very magic mode (ie normal regex)
nnoremap / /\v
nnoremap <leader><space> i<space><esc>l
" Search for current word with silver searcher
nnoremap <leader>G :Ag<cr>
" Toggle booleans
nnoremap <leader>! :call ToggleBoolean(expand("<cword>"))<cr>
function! ToggleBoolean(bool)
if a:bool ==# 'true'
execute "normal! ciwfalse"
elseif a:bool ==# 'false'
execute "normal! ciwtrue"
endif
endfunction
" }}}
" Abbreviations ------- {{{
iabbrev funciton function
iabbrev fucniton function
" " }}}
" Ruby abbeviations ------- {{{
augroup filetype_ruby
autocmd!
autocmd FileType ruby :iabbrev <buffer> debugger binding.pry
augroup END
" }}}
" Python abbreviations ------- {{{
augroup filetype_python
autocmd!
" copy the name of the current module to clipboard (relative to pwd)
if has("mac") || has("gui_macvim") || has("gui_mac")
autocmd FileType python :nnoremap <silent> <leader>P :let @*=join(split(expand("%:r"), "/"), ".")<CR>
endif
if has("gui_gtk") || has("gui_gtk2") || has("gui_gnome") || has("unix")
autocmd FileType python :nnoremap <silent> <leader>P :let @+=join(split(expand("%:r"), "/"), ".")<CR>
endif
augroup END
" }}}
" Vimscript file settings --------- {{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup end
" }}}
" General -------- {{{
set noswapfile
nnoremap <silent> <Leader>c :let @+ = expand("%")<CR>
nnoremap <silent> <Leader>C :let @+ = expand("%") . ":" . line(".")<CR>
if has('gui_running')
if getcwd() =~ '/backend-python'
colorscheme atom
elseif getcwd() =~ '/apps/react'
colorscheme molokai
endif
endif
" }}}