aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/.vim/rc/maps.vim
blob: 3d3b80a542a50909d5e034b422c93103ea766b3c (plain)
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
""" Maps """

nnoremap Y y$
nnoremap <leader>x :w<CR>:! ./%
inoremap <leader>w <Esc>:w<Enter>
inoremap <leader><leader> <Esc>/<++><Enter>"_cf>

" Showing tabs and trailing spaces
nnoremap <leader>l :set list!<CR>

" Clipboard
nnoremap <leader>p "+p
nnoremap <leader>y "+yy
vnoremap <leader>y "+y
nnoremap <leader>d "+dd
vnoremap <leader>d "+d

" Split navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <A-h> <C-w><
map <A-j> <C-w>+
map <A-k> <C-w>-
map <A-l> <C-w>>
map <A-H> <C-w>10<
map <A-J> <C-w>5+
map <A-K> <C-w>5-
map <A-L> <C-w>10>

" Open vimrc
nnoremap <leader>vrc :80vsp ~/.vimrc<CR>

" Open tmux panel
nnoremap <leader>S :!tmux split-window -l '40\%'<CR><CR>

" Open netrw
nnoremap <leader>f :40Vexplore<CR>
nnoremap <leader>F :40Lexplore<CR>

" Open buffer
nnoremap <C-b> :Buffers<Enter>

" Moving -here-
nnoremap <leader>h :cd %:h<CR>

" Spelling
nnoremap <leader>ss :set spell!<CR>
nnoremap <leader>sl :set spelllang=
nnoremap <leader>sL :setlocal spelllang=

" Open file under cursor
nnoremap go :!export SXIV_FLOAT=y; o <cfile> &<CR><CR>

nnoremap <C-n> :tabnew<CR>
"nnoremap <Tab> gt "Can't be set without also remapping <C-i>
"nnoremap <S-Tab> gT

" hlnext: Highlighting searches
nnoremap <silent> n n:call HLNext(0.1)<CR>
nnoremap <silent> N N:call HLNext(0.1)<CR>
function! HLNext(blinktime)
	set invcursorline
	redraw
	exec 'sleep'.float2nr(a:blinktime*400).'m'
	set invcursorline
	redraw
endfunction

" dragvisuals: dragging visual blocks
vmap  <expr>  <LEFT>   DVB_Drag('left')
vmap  <expr>  <RIGHT>  DVB_Drag('right')
vmap  <expr>  <DOWN>   DVB_Drag('down')
vmap  <expr>  <UP>     DVB_Drag('up')
vmap  <expr>  D        DVB_Duplicate()

" Search text that does not exist
nnoremap <leader>/ /grtfjx<CR>