-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.local
118 lines (103 loc) · 3.69 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
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
au BufEnter * inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
au BufEnter * inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
autocmd BufWritePost *.hs GhcModCheckAndLintAsync
let g:nerdtree_tabs_open_on_gui_startup = 0
let g:nerdtree_tabs_open_on_console_startup = 0
" --- BClose code follows
" From: http://vim.wikia.com/wiki/Deleting_a_buffer_without_closing_the_window
" " Delete buffer while keeping window layout (don't close buffer's windows).
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
if !exists('bclose_multiple')
let bclose_multiple = 1
endif
" Display an error message.
function! s:Warn(msg)
echohl ErrorMsg
echomsg a:msg
echohl NONE
endfunction
" Command ':Bclose' executes ':bd' to delete buffer in current window.
" The window will show the alternate buffer (Ctrl-^) if it exists,
" or the previous buffer (:bp), or a blank buffer if no previous.
" Command ':Bclose!' is the same, but executes ':bd!' (discard changes).
" An optional argument can specify which buffer to close (name or number).
function! s:Bclose(bang, buffer)
if empty(a:buffer)
let btarget = bufnr('%')
elseif a:buffer =~ '^\d\+$'
let btarget = bufnr(str2nr(a:buffer))
else
let btarget = bufnr(a:buffer)
endif
if btarget < 0
call s:Warn('No matching buffer for '.a:buffer)
"return
endif
if empty(a:bang) && getbufvar(btarget, '&modified')
call s:Warn('No write since last change for buffer '.btarget.' (use :Bclose!)')
return
endif
" Numbers of windows that view target buffer which we will delete.
let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget')
if !g:bclose_multiple && len(wnums) > 1
call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")')
return
endif
let wcurrent = winnr()
for w in wnums
execute w.'wincmd w'
let prevbuf = bufnr('#')
if prevbuf > 0 && buflisted(prevbuf) && prevbuf != w
buffer #
else
bprevious
endif
if btarget == bufnr('%')
" Numbers of listed buffers which are not the target to be deleted.
let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget')
" Listed, not target, and not displayed.
let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0')
" Take the first buffer, if any (could be more intelligent).
let bjump = (bhidden + blisted + [-1])[0]
if bjump > 0
execute 'buffer '.bjump
else
execute 'enew'.a:bang
endif
endif
endfor
"execute 'bdelete'.a:bang.' '.btarget
execute ':confirm :bdelete '.btarget
execute wcurrent.'wincmd w'
endfunction
command! -bang -complete=buffer -nargs=? Bclose call s:Bclose('<bang>', '<args>')
nmap <silent> <Leader>x :Bclose<CR>
nmap <silent> <Leader>f :LustyFilesystemExplorerFromHere<CR>
nmap <silent> <Leader>b :LustyBufferExplorer<CR>
nmap <silent> <leader>t :CtrlP<CR>
nmap <silent> <leader>r :CtrlPMRU<CR>
imap <silent> <C-a> <Home>
imap <silent> <C-e> <End>
imap <silent> <C-k> <C-o>D
cmap <silent> <C-a> <Home>
cmap <silent> <C-e> <End>
imap <silent> <C-f> <Right>
imap <silent> <C-b> <Left>
" if filereadable(expand("~/.vim/bundle/vim-colors-solarized/colors/solarized.vim"))
" let g:solarized_termcolors=256
" color solarized " load a colorscheme
" endif
" let g:solarized_termtrans=1
" let g:solarized_contrast="high"
" let g:solarized_visibility="high"
" set background=light
" colorscheme proton
autocmd FileType ruby set shiftwidth=2
autocmd FileType ruby set tabstop=2
set background=dark
" colorscheme Tomorrow-Night
colorscheme base16-ocean
let g:Powerline_symbols = 'fancy'
if has('gui_macvim')
set transparency=0 " Make the window slightly transparent
endif