summaryrefslogtreecommitdiff
path: root/plugin/maps.vim
blob: b61e994fb83b27307d218a83cce235014710cfc6 (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
mapclear

let mapleader=' '

" clipboard
map <leader>cc :w !xclip -sel c<CR>

" normal
nnoremap <Leader>o : only<cr>
nnoremap - : b#<cr>
nnoremap <Leader>b : Buffers<cr>
nnoremap <Leader>n : bnext<cr>
nnoremap <Leader>p : bprev<cr>
nnoremap <Leader>z : FZF<cr>
nnoremap <Leader>l : Lines<cr>
nnoremap <Leader>e : Explore<cr>
nnoremap <Leader>t : call GetTabber()<cr>
nnoremap <Leader><ESC> : nohlsearch<cr>
nnoremap <C-l> :nohlsearch<cr>:diffupdate<cr>:syntax sync fromstart<cr><c-l>
nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]'


nnoremap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
            \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
            \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>

nnoremap <Leader>s <Plug>(leap-forward-to)
nnoremap <Leader>S <Plug>(leap-backward-to)

cmap w!! %!sudo -S tee > /dev/null %

" visual
vnoremap > >gv
vnoremap < <gv
vnoremap <silent> * :<C-U>
  \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
  \gvy/<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute(
  \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
  \gVzv:call setreg('"', old_reg, old_regtype)<CR>
vnoremap <silent> # :<C-U>
  \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
  \gvy?<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute(
  \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
  \gVzv:call setreg('"', old_reg, old_regtype)<CR>

" operator-pending
onoremap ax a`
onoremap ix i`

" visual block
xnoremap + g<C-a>
xnoremap - g<C-x>

" completions
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"