-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps.vim
116 lines (88 loc) · 2.36 KB
/
maps.vim
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
" Keymaps
let mapleader = " "
map <C-n> :NERDTreeToggle<CR>
" Undo
nnoremap <Leader>z :ea<CR>
" Redo
nnoremap <Leader>y :lat<CR>
" abrir terminal
map <F2> :belowright terminal<CR>
" split navigations
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>
" split resize
nnoremap <Leader>> 10<C-w>>
nnoremap <Leader>< 10<C-w><
nnoremap <Leader>w :w<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>kp :let @"=expand("%")<CR>
" saltar al final de la linea
" inoremap <C-e> <C-o>$
" buffers
" map <Leader>ob :Buffers<cr>
" commentens = gc (visual mode) or with command:
" vnoremap <space>/ :Commentary<CR>
" airline
map <C-w> :bnext<CR>
map <C-x> :bdelete<CR>
" right terminal
set splitright
function! OpenTerminal()
execute "normal \<C-1>"
execute "normal \<C-1>"
execute "normal \<C-1>"
execute "normal \<C-1>"
let bufNum = bufnr("%")
let bufType = getbufvar(bufNum, "&buftype", "not found")
if bufType == "terminal"
" close existing terminal
execute "q"
else
" open terminal
execute "vsp term://zsh"
" turn off numbers
execute "set nonu"
execute "set nornu"
" toggle insert on enter/exit
silent au BufLeave <buffer> stopinsert!
silent au BufWinEnter,WinEnter <buffer> startinsert!
" set maps inside terminal buffer
execute "tnoremap <buffer> <C-h> <C-\\><C-n><C-w><C-h>"
execute "tnoremap <buffer> <C-t> <C-\\><C-n>:q<CR>"
execute "tnoremap <buffer> <C-\\><C-\\> <C-\\><C-n>"
startinsert!
endif
endfunction
nnoremap <C-t> :call OpenTerminal()<CR>
" down terminal
set splitbelow
function! OpenTerminal2()
execute "normal \<C-1>"
execute "normal \<C-1>"
execute "normal \<C-1>"
execute "normal \<C-1>"
let bufNum = bufnr("%")
let bufType = getbufvar(bufNum, "&buftype", "not found")
if bufType == "terminal"
" close existing terminal
execute "q"
else
" open terminal
execute "sp term://zsh"
execute "resize 20"
" turn off numbers
execute "set nonu"
execute "set nornu"
" toggle insert on enter/exit
silent au BufLeave <buffer> stopinsert!
silent au BufWinEnter,WinEnter <buffer> startinsert!
" set maps inside terminal buffer
execute "tnoremap <buffer> <C-h> <C-\\><C-n><C-w><C-h>"
execute "tnoremap <buffer> <C-b> <C-\\><C-n>:q<CR>"
execute "tnoremap <buffer> <C-\\><C-\\> <C-\\><C-n>"
startinsert!
endif
endfunction
nnoremap <C-b> :call OpenTerminal2()<CR>