1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-12 17:55:41 +08:00

Add clever f (#1460)

This commit is contained in:
Wang Shidong 2018-03-14 21:23:52 +08:00 committed by GitHub
parent 5dfee3ce93
commit dac04f3e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 353 additions and 491 deletions

View File

@ -69,7 +69,7 @@ let g:spacevim_windows_leader = 's'
""
" Unite work flow leader of SpaceVim. Default is `f`.
" Set to empty to disable this feature, or you can set to another char.
let g:spacevim_unite_leader = 'f'
let g:spacevim_unite_leader = '\f'
""
" Denite work flow leader of SpaceVim. Default is `F`.
" Set to empty to disable this feature, or you can set to another char.
@ -614,12 +614,6 @@ function! SpaceVim#end() abort
if !empty(g:spacevim_windows_leader)
call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader)
endif
if !empty(g:spacevim_unite_leader)
call SpaceVim#mapping#leader#defindUniteLeader(g:spacevim_unite_leader)
endif
if !empty(g:spacevim_denite_leader)
call SpaceVim#mapping#leader#defindDeniteLeader(g:spacevim_denite_leader)
endif
call SpaceVim#mapping#g#init()
call SpaceVim#mapping#z#init()
call SpaceVim#mapping#leader#defindglobalMappings()

View File

@ -17,13 +17,18 @@ function! SpaceVim#layers#core#plugins() abort
call add(plugins, ['Shougo/vimproc.vim', {'build' : ['make']}])
endif
call add(plugins, ['benizi/vim-automkdir'])
call add(plugins, ['rhysd/clever-f.vim'])
call add(plugins, ['andymass/vim-matchup'])
return plugins
endfunction
let s:filename = expand('<sfile>:~')
let s:lnum = expand('<slnum>') + 2
function! SpaceVim#layers#core#config() abort
let g:matchup_matchparen_status_offscreen = 0
" Unimpaired bindings
" Quickly add empty lines
nnoremap <silent> [<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
@ -211,9 +216,9 @@ function! SpaceVim#layers#core#config() abort
if has('python3')
let cmd = 'Denite file_rec'
elseif has('python')
let cmd = "LeaderfFile"
let cmd = 'LeaderfFile'
else
let cmd = "CtrlP"
let cmd = 'CtrlP'
endif
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
\ cmd,
@ -340,7 +345,7 @@ function! s:previous_window() abort
endfunction
function! s:split_string(newline) abort
let syn_name = synIDattr(synID(line("."), col("."), 1), "name")
let syn_name = synIDattr(synID(line('.'), col('.'), 1), 'name')
if syn_name == &filetype . 'String'
let c = col('.')
let sep = ''
@ -367,7 +372,7 @@ function! s:split_string(newline) abort
endfunction
function! s:is_string(l,c) abort
return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String'
return synIDattr(synID(a:l, a:c, 1), 'name') == &filetype . 'String'
endfunction
" function() wrapper

View File

@ -40,10 +40,6 @@ function! SpaceVim#layers#git#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['g', 'A'], 'Gita add .', 'stage all files', 1)
call SpaceVim#mapping#space#def('nnoremap', ['g', 'b'], 'Gina blame', 'view git blame', 1)
endif
nmap <leader>hj <plug>(signify-next-hunk)
nmap <leader>hk <plug>(signify-prev-hunk)
nmap <leader>hJ 9999<leader>gj
nmap <leader>hK 9999<leader>gk
augroup spacevim_layer_git
autocmd!
autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR>

View File

@ -81,7 +81,6 @@ function! SpaceVim#layers#lang#c#plugins() abort
else
call add(plugins, ['bbchung/clighter', { 'if' : has('python')}])
endif
call add(plugins, ['lyuts/vim-rtags', { 'if' : has('python')}])
return plugins
endfunction

View File

@ -0,0 +1,18 @@
"=============================================================================
" leaderf.vim --- leaderf layer for SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
function! SpaceVim#layers#leaderf#plugins() abort
let plugins = []
call add(plugins,
\ ['Yggdroot/LeaderF', { 'on_cmd' : 'LeaderfFile',
\ 'loadconf' : 1,
\ 'merged' : 0}])
return plugins
endfunction

View File

@ -15,9 +15,6 @@ function! SpaceVim#layers#tools#plugins() abort
\ ['junegunn/goyo.vim', { 'on_cmd' : 'Goyo',
\ 'loadconf' : 1}],
\ ['junegunn/limelight.vim', { 'on_cmd' : 'Limelight'}],
\ ['Yggdroot/LeaderF', { 'on_cmd' : 'LeaderfFile',
\ 'loadconf' : 1,
\ 'merged' : 0}],
\ ['MattesGroeger/vim-bookmarks', { 'on_map' : '<Plug>Bookmark',
\ 'on_cmd' : 'BookmarkShowAll',
\ 'loadconf_before' : 1}],
@ -82,14 +79,12 @@ function! SpaceVim#layers#tools#config() abort
let g:rainbow#pairs = [['(', ')'], ['[', ']'],['{','}']]
" List of colors that you do not want. ANSI code or #RRGGBB
let g:rainbow#blacklist = [233, 234]
nnoremap <Leader>fz :FZF<CR>
if maparg('<C-_>', 'v') ==# ''
vnoremap <silent> <C-_> <Esc>:Ydv<CR>
endif
if maparg('<C-_>', 'n') ==# ''
nnoremap <silent> <C-_> <Esc>:Ydc<CR>
endif
map <Leader>td <Plug>TaskList
noremap <silent> <F8> :TlistToggle<CR>
if g:spacevim_filemanager ==# 'nerdtree'
noremap <silent> <F3> :NERDTreeToggle<CR>

View File

@ -91,8 +91,293 @@ function! SpaceVim#layers#unite#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['p', '!'], 'call call('
\ . string(s:_function('s:run_shell_cmd_project')) . ', [])',
\ 'shell cmd(project root)', 1)
let g:_spacevim_mappings.f = {'name' : '+Fuzzy Finder'}
call s:defind_fuzzy_finder()
endfunction
let s:file = expand('<sfile>:~')
let s:unite_lnum = expand('<slnum>') + 3
function! s:defind_fuzzy_finder() abort
nnoremap <silent> <Leader>fr
\ :<C-u>Unite -buffer-name=resume resume<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings.f.r = ['Unite -buffer-name=resume resume',
\ 'resume unite window',
\ [
\ '[Leader f r ] is to resume unite window',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
return
if has('nvim')
nnoremap <silent> [unite]f
\ :<C-u>Unite file_rec/neovim<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.f = ['Unite file_rec/neovim',
\ 'file_rec',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
else
nnoremap <silent> [unite]f
\ :<C-u>Unite file_rec/async<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.f = ['Unite file_rec/async',
\ 'file_rec',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
endif
nnoremap <silent> [unite]i
\ :<C-u>Unite file_rec/git<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.i = ['Unite file_rec/git',
\ 'git files',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]g
\ :<C-u>Unite grep<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.g = ['Unite grep',
\ 'unite grep',
\ [
\ '[UNITE g ] is to open unite grep source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]u
\ :<C-u>Unite source<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.u = ['Unite source',
\ 'unite source',
\ [
\ '[UNITE u ] is to open unite source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]t
\ :<C-u>Unite tag<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.t = ['Unite tag',
\ 'unite tag',
\ [
\ '[UNITE t ] is to open unite tag source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]T
\ :<C-u>Unite tag/include<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.T = ['Unite tag/include',
\ 'unite tag/include',
\ [
\ '[UNITE T ] is to open unite tag/include source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]l
\ :<C-u>Unite locationlist<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.l = ['Unite locationlist',
\ 'unite locationlist',
\ [
\ '[UNITE l ] is to open unite locationlist source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]q
\ :<C-u>Unite quickfix<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.q = ['Unite quickfix',
\ 'unite quickfix',
\ [
\ '[UNITE q ] is to open unite quickfix source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]e :<C-u>Unite
\ -buffer-name=register register<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.e = ['Unite register',
\ 'unite register',
\ [
\ '[UNITE l ] is to open unite locationlist source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]j
\ :<C-u>Unite jump<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.j = ['Unite jump',
\ 'unite jump',
\ [
\ '[UNITE j ] is to open unite jump source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]h
\ :<C-u>Unite history/yank<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.h = ['Unite history/yank',
\ 'unite history/yank',
\ [
\ '[UNITE h ] is to open unite history/yank source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]<C-h>
\ :<C-u>UniteWithCursorWord help<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['<C-h>'] = ['UniteWithCursorWord help',
\ 'unite with cursor word help',
\ [
\ '[UNITE <c-h> ] is to open unite help source for cursor word',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]s
\ :<C-u>Unite session<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.s = ['Unite session',
\ 'unite session',
\ [
\ '[UNITE s ] is to open unite session source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]o :<C-u>Unite -buffer-name=outline
\ -start-insert -auto-preview -split outline<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.o = ['Unite outline',
\ 'unite outline',
\ [
\ '[UNITE o ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
" menu
nnoremap <silent> [unite]ma
\ :<C-u>Unite mapping<CR>
nnoremap <silent> [unite]me
\ :<C-u>Unite output:message<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 6
let g:_spacevim_mappings_unite.m = {'name' : '+Menus',
\ 'a' : ['Unite mapping', 'unite mappings',
\ [
\ '[UNITE m a ] is to open unite mapping menu',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ],
\ 'e' : ['Unite output:message', 'unite messages',
\ [
\ '[UNITE o ] is to open unite message menu',
\ '',
\ 'Definition: ' . s:file . ':' . (lnum + 2),
\ ]
\ ]
\ }
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir
\ -buffer-name=files buffer bookmark file<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.c =
\ ['UniteWithCurrentDir -buffer-name=files buffer bookmark file',
\ 'unite files in current dir',
\ [
\ '[UNITE c ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir
\ -buffer-name=files -prompt=%\ buffer bookmark file<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.b =
\ ['UniteWithBufferDir -buffer-name=files' .
\ ' buffer bookmark file',
\ 'unite files in current dir',
\ [
\ '[UNITE b ] is to open unite buffer and bookmark source with cursor',
\ 'word',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]n
\ :<C-u>Unite session/new<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.n = ['Unite session/new',
\ 'unite session/new',
\ [
\ '[UNITE n ] is to create new vim session',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]/
\ :Unite grep:.<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['/'] = ['Unite grep:.',
\ 'unite grep with preview',
\ [
\ '[UNITE / ] is to open unite grep source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]w
\ :<C-u>Unite -buffer-name=files -no-split
\ jump_point file_point buffer_tab
\ file_rec:! file file/new<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 6
let g:_spacevim_mappings_unite.w= ['Unite -buffer-name=files -no-split' .
\ ' jump_point file_point buffer_tab file_rec:! file file/new',
\ 'unite all file and jump',
\ [
\ '[UNITE w ] is to open unite jump_point file_point and buffer_tab',
\ 'source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17
\ -start-insert menu:CustomKeyMaps<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['[SPC]'] = ['Unite -silent -ignorecase' .
\ ' -winheight=17 -start-insert menu:CustomKeyMaps',
\ 'unite customkeymaps',
\ [
\ '[UNITE o ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
endfunction
function! s:run_shell_cmd() abort
let cmd = input('Please input shell command:', '', 'customlist,SpaceVim#plugins#bashcomplete#complete')
if !empty(cmd)

View File

@ -619,15 +619,6 @@ else
\ 'g:_spacevim_mappings_space')
call SpaceVim#plugins#help#regist_root({'SPC' : g:_spacevim_mappings_space})
endif
call SpaceVim#mapping#guide#register_prefix_descriptions(
\ g:spacevim_unite_leader,
\ 'g:_spacevim_mappings_unite')
call SpaceVim#plugins#help#regist_root({'[unite]' : g:_spacevim_mappings_unite})
call SpaceVim#mapping#guide#register_prefix_descriptions(
\ g:spacevim_denite_leader,
\ 'g:_spacevim_mappings_denite')
call SpaceVim#plugins#help#regist_root({'[denite]' : g:_spacevim_mappings_denite})
call SpaceVim#mapping#guide#register_prefix_descriptions(
\ g:spacevim_windows_leader,
\ 'g:_spacevim_mappings_windows')

View File

@ -13,46 +13,18 @@ function! SpaceVim#mapping#leader#defindglobalMappings() abort
inoremap <silent> <Leader><Tab> <C-r>=MyLeaderTabfunc()<CR>
endif
"for buftabs
noremap <silent><Leader>bp :bprev<CR>
noremap <silent><Leader>bn :bnext<CR>
"background
noremap <silent><leader>bg :call ToggleBG()<CR>
"numbers
noremap <silent><leader>nu :call ToggleNumber()<CR>
" yark and paste
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
xnoremap <Leader>y "+y
xnoremap <Leader>d "+d
nnoremap <Leader>p "+p
nnoremap <Leader>P "+P
xnoremap <Leader>p "+p
xnoremap <Leader>P "+P
cnoremap <Leader><C-F> <C-F>
"When pressing <leader>cd switch to the directory of the open buffer
map <Leader>cd :cd %:p:h<CR>:pwd<CR>
" Fast saving
call SpaceVim#mapping#def('nnoremap', '<Leader>w', ':w<CR>',
\ 'Save current file',
\ 'w',
\ 'Save current file')
call SpaceVim#mapping#def('vnoremap', '<Leader>w', '<Esc>:w<CR>',
\ 'Save current file',
\ 'w',
\ 'Save current file')
let g:_spacevim_mappings.t = {'name' : 'Toggle editor visuals'}
nmap <Leader>ts :setlocal spell!<cr>
nmap <Leader>tn :setlocal nonumber! norelativenumber!<CR>
nmap <Leader>tl :setlocal nolist!<CR>
nmap <Leader>th :nohlsearch<CR>
nmap <Leader>tw :setlocal wrap! breakindent!<CR>
" Location list movement
let g:_spacevim_mappings.l = {'name' : 'Location list movement'}
let g:_spacevim_mappings.l = {'name' : '+Location movement'}
call SpaceVim#mapping#def('nnoremap', '<Leader>lj', ':lnext<CR>',
\ 'Jump to next location list position',
\ 'lnext',
@ -67,7 +39,7 @@ function! SpaceVim#mapping#leader#defindglobalMappings() abort
\ 'Close location list window')
" quickfix list movement
let g:_spacevim_mappings.q = {'name' : 'Quickfix list movement'}
let g:_spacevim_mappings.q = {'name' : '+Quickfix movement'}
call SpaceVim#mapping#def('nnoremap', '<Leader>qj', ':cnext<CR>',
\ 'Jump to next quickfix list position',
\ 'cnext',
@ -84,41 +56,6 @@ function! SpaceVim#mapping#leader#defindglobalMappings() abort
\ 'Toggle recording',
\ '',
\ 'Toggle recording mode')
" Duplicate lines
nnoremap <Leader>d m`YP``
vnoremap <Leader>d YPgv
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader><C-c>',
\ ':<c-u>call zvim#util#CopyToClipboard(1)<cr>',
\ 'Yank the github link of current file to X11 clipboard',
\ 'call zvim#util#CopyToClipboard(1)')
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader><C-l>',
\ ':<c-u>call zvim#util#CopyToClipboard(2)<cr>',
\ 'Yank the github link of current line to X11 clipboard',
\ 'call zvim#util#CopyToClipboard(2)')
call SpaceVim#mapping#def('vnoremap <silent>', '<Leader><C-l>',
\ ':<c-u>call zvim#util#CopyToClipboard(3)<cr>',
\ 'Yank the github link of current selection to X11 clipboard',
\ 'call zvim#util#CopyToClipboard(3)')
call SpaceVim#mapping#def('vnoremap', '<Leader>S',
\ "y:execute @@<CR>:echo 'Sourced selection.'<CR>",
\ 'Sourced selection.',
\ "echo 'Use <leader>S to sourced selection.'")
call SpaceVim#mapping#def('nnoremap', '<Leader>S',
\ "^vg_y:execute @@<CR>:echo 'Sourced line.'<CR>",
\ 'Source line',
\ "echo 'Use <leader>S to sourced line.'")
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader>sv',
\ ':call SpaceVim#mapping#split_previous_buffer()<CR>',
\ 'Open previous buffer in split window',
\ 'call SpaceVim#mapping#split_previous_buffer()',
\ 'Split previout buffer')
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader>sg',
\ ':call SpaceVim#mapping#vertical_split_previous_buffer()<CR>',
\ 'Open previous buffer in vsplit window' ,
\ 'call SpaceVim#mapping#vertical_split_previous_buffer()')
endfunction
let s:lnum = expand('<slnum>') + 3
@ -284,297 +221,6 @@ function! SpaceVim#mapping#leader#defindDeniteLeader(key) abort
endif
endfunction
let s:unite_lnum = expand('<slnum>') + 3
function! SpaceVim#mapping#leader#defindUniteLeader(key) abort
if !empty(a:key)
if a:key ==# 'f'
nnoremap <leader>f f
endif
" The prefix key.
exe 'nnoremap <silent><nowait> [unite] :<c-u>LeaderGuide "' .
\ a:key . '"<CR>'
exe 'nmap ' .a:key . ' [unite]'
let g:_spacevim_mappings_unite = {}
nnoremap <silent> [unite]r
\ :<C-u>Unite -buffer-name=resume resume<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.r = ['Unite -buffer-name=resume resume',
\ 'resume unite window',
\ [
\ '[UNITE r ] is to resume unite window',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
if has('nvim')
nnoremap <silent> [unite]f
\ :<C-u>Unite file_rec/neovim<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.f = ['Unite file_rec/neovim',
\ 'file_rec',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
else
nnoremap <silent> [unite]f
\ :<C-u>Unite file_rec/async<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.f = ['Unite file_rec/async',
\ 'file_rec',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
endif
nnoremap <silent> [unite]i
\ :<C-u>Unite file_rec/git<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.i = ['Unite file_rec/git',
\ 'git files',
\ [
\ '[UNITE f ] is to open unite file_rec source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]g
\ :<C-u>Unite grep<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.g = ['Unite grep',
\ 'unite grep',
\ [
\ '[UNITE g ] is to open unite grep source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]u
\ :<C-u>Unite source<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.u = ['Unite source',
\ 'unite source',
\ [
\ '[UNITE u ] is to open unite source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]t
\ :<C-u>Unite tag<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.t = ['Unite tag',
\ 'unite tag',
\ [
\ '[UNITE t ] is to open unite tag source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]T
\ :<C-u>Unite tag/include<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.T = ['Unite tag/include',
\ 'unite tag/include',
\ [
\ '[UNITE T ] is to open unite tag/include source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]l
\ :<C-u>Unite locationlist<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.l = ['Unite locationlist',
\ 'unite locationlist',
\ [
\ '[UNITE l ] is to open unite locationlist source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]q
\ :<C-u>Unite quickfix<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.q = ['Unite quickfix',
\ 'unite quickfix',
\ [
\ '[UNITE q ] is to open unite quickfix source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]e :<C-u>Unite
\ -buffer-name=register register<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.e = ['Unite register',
\ 'unite register',
\ [
\ '[UNITE l ] is to open unite locationlist source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]j
\ :<C-u>Unite jump<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.j = ['Unite jump',
\ 'unite jump',
\ [
\ '[UNITE j ] is to open unite jump source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]h
\ :<C-u>Unite history/yank<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.h = ['Unite history/yank',
\ 'unite history/yank',
\ [
\ '[UNITE h ] is to open unite history/yank source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]<C-h>
\ :<C-u>UniteWithCursorWord help<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['<C-h>'] = ['UniteWithCursorWord help',
\ 'unite with cursor word help',
\ [
\ '[UNITE <c-h> ] is to open unite help source for cursor word',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]s
\ :<C-u>Unite session<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.s = ['Unite session',
\ 'unite session',
\ [
\ '[UNITE s ] is to open unite session source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]o :<C-u>Unite -buffer-name=outline
\ -start-insert -auto-preview -split outline<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.o = ['Unite outline',
\ 'unite outline',
\ [
\ '[UNITE o ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
" menu
nnoremap <silent> [unite]ma
\ :<C-u>Unite mapping<CR>
nnoremap <silent> [unite]me
\ :<C-u>Unite output:message<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 6
let g:_spacevim_mappings_unite.m = {'name' : '+Menus',
\ 'a' : ['Unite mapping', 'unite mappings',
\ [
\ '[UNITE m a ] is to open unite mapping menu',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ],
\ 'e' : ['Unite output:message', 'unite messages',
\ [
\ '[UNITE o ] is to open unite message menu',
\ '',
\ 'Definition: ' . s:file . ':' . (lnum + 2),
\ ]
\ ]
\ }
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir
\ -buffer-name=files buffer bookmark file<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.c =
\ ['UniteWithCurrentDir -buffer-name=files buffer bookmark file',
\ 'unite files in current dir',
\ [
\ '[UNITE c ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir
\ -buffer-name=files -prompt=%\ buffer bookmark file<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.b =
\ ['UniteWithBufferDir -buffer-name=files' .
\ ' buffer bookmark file',
\ 'unite files in current dir',
\ [
\ '[UNITE b ] is to open unite buffer and bookmark source with cursor',
\ 'word',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]n
\ :<C-u>Unite session/new<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite.n = ['Unite session/new',
\ 'unite session/new',
\ [
\ '[UNITE n ] is to create new vim session',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]/
\ :Unite grep:.<cr>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['/'] = ['Unite grep:.',
\ 'unite grep with preview',
\ [
\ '[UNITE / ] is to open unite grep source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent> [unite]w
\ :<C-u>Unite -buffer-name=files -no-split
\ jump_point file_point buffer_tab
\ file_rec:! file file/new<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 6
let g:_spacevim_mappings_unite.w= ['Unite -buffer-name=files -no-split' .
\ ' jump_point file_point buffer_tab file_rec:! file file/new',
\ 'unite all file and jump',
\ [
\ '[UNITE w ] is to open unite jump_point file_point and buffer_tab',
\ 'source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17
\ -start-insert menu:CustomKeyMaps<CR>
let lnum = expand('<slnum>') + s:unite_lnum - 4
let g:_spacevim_mappings_unite['[SPC]'] = ['Unite -silent -ignorecase' .
\ ' -winheight=17 -start-insert menu:CustomKeyMaps',
\ 'unite customkeymaps',
\ [
\ '[UNITE o ] is to open unite outline source',
\ '',
\ 'Definition: ' . s:file . ':' . lnum,
\ ]
\ ]
endif
endfunction
function! SpaceVim#mapping#leader#getName(key) abort
if a:key == g:spacevim_unite_leader
@ -598,10 +244,6 @@ endfunction
function! SpaceVim#mapping#leader#defindKEYs() abort
let g:_spacevim_mappings_prefixs = {}
let g:_spacevim_mappings_prefixs[g:spacevim_unite_leader] = {'name' : '+Unite prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_unite_leader], g:_spacevim_mappings_unite)
let g:_spacevim_mappings_prefixs[g:spacevim_denite_leader] = {'name' : '+Denite prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_denite_leader], g:_spacevim_mappings_denite)
let g:_spacevim_mappings_prefixs[g:spacevim_windows_leader] = {'name' : '+Window prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_windows_leader], g:_spacevim_mappings_windows)
let g:_spacevim_mappings_prefixs['g'] = {'name' : '+g prefix'}

View File

@ -153,13 +153,6 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space[';'] = ['call feedkeys("\<Plug>CommentOperator")', 'comment operator']
nmap <silent> [SPC]; <Plug>CommentOperator
" in nerdcomment if has map to <plug>... the default mapping will be
" disable, so we add it for compatibility
nmap <Leader>cc <Plug>NERDCommenterComment
xmap <Leader>cc <Plug>NERDCommenterComment
nmap <Leader>ci <Plug>NERDCommenterInvert
xmap <Leader>ci <Plug>NERDCommenterInvert
let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'}
let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'}
if g:spacevim_relativenumber

View File

@ -7,6 +7,7 @@ scriptencoding utf-8
" Add extra space around delimiters when commenting, remove them when
" uncommenting
let g:NERDSpaceDelims = 1
let g:NERDCreateDefaultMappings = 0
" Always remove the extra spaces when uncommenting regardless of whether
" NERDSpaceDelims is set

View File

@ -185,8 +185,6 @@ let g:unite_source_menu_menus.StatusCodeDefinitions.command_candidates = [
\['➤ 505 HTTP Version Not Supported ',
\ 'echo "HTTP Version Not Supported"'],
\]
nnoremap <silent><leader>sc :Unite -silent -winheight=17
\ -start-insert menu:StatusCodeDefinitions<CR>
let g:unite_source_grep_max_candidates = get(g:,
\ 'unite_source_grep_max_candidates', 200)
if executable('hw')
@ -238,12 +236,6 @@ let g:unite_source_rec_async_command = get(g:,
\ 'unite_source_rec_async_command',
\ ['ag', '--follow', '--nocolor', '--nogroup',
\ '--hidden', '-g', ''])
nnoremap <silent><leader>ufa :<C-u>Unite -no-split
\ -buffer-name=Mixed -start-insert file file_mru file_rec buffer<cr>
nnoremap <silent><leader>ufr :<C-u>Unite
\ -buffer-name=files file_rec/async:!<cr>
nnoremap <silent><leader>ufg :<C-u>Unite
\ -buffer-name=git-repo file_rec/git<cr>
call unite#custom#profile('file_rec/async,file_rec/git', 'context', {
\ 'start_insert' : 1,
\ 'quit' : 1,
@ -253,42 +245,11 @@ call unite#custom#profile('file_rec/async,file_rec/git', 'context', {
\ })
call unite#custom#source('file_rec/async,file_rec/neovim', 'ignore_globs',
\ ['*.png','.git/','*.ttf', '*.eot', '*.woff', '*.svg'])
nnoremap <silent><leader>uf :<C-u>Unite
\ -no-split -buffer-name=files -start-insert file<cr>
nnoremap <silent><leader>ufm :<C-u>Unite
\ -no-split -buffer-name=mru -start-insert file_mru<cr>
nnoremap <silent><leader>ubf :<C-u>Unite
\ -buffer-name=buffer buffer<cr>
nnoremap <silent><leader>utb :<C-u>Unite
\ -buffer-name=buffer_tab buffer_tab<cr>
call unite#custom#profile('buffer,buffer_tab', 'context', {
\ 'start_insert' : 0,
\ 'quit' : 1,
\ 'keep_focus' : 1,
\ })
nnoremap <silent><leader>um :<C-u>Unite -start-insert mapping<CR>
"" grep dictionay
""" For searching the word in the cursor in the current directory
nnoremap <silent><leader>v :Unite
\ -auto-preview -no-split grep:.::<C-R><C-w><CR>
""" For searching the word handin
nnoremap <silent><leader>vs :Unite -auto-preview -no-split grep:.<CR>
""" For searching the word in the cursor in the current buffer
noremap <silent><leader>vf :Unite
\ -auto-preview -no-split grep:%::<C-r><C-w><CR>
""" For searching the word in the cursor in all opened buffer
noremap <silent><leader>va :Unite
\ -auto-preview -no-split grep:$buffers::<C-r><C-w><CR>
nnoremap <silent><Leader>bl :<C-u>Unite
\ -start-insert -buffer-name=buffer buffer<cr>
nnoremap <silent><Leader>ta :<C-u>Unite -start-insert -buffer-name=tag tag<cr>
" search plugin
" :Unite neobundle/search
"for Unite menu{
nnoremap <silent><leader>ugg :Unite -silent -start-insert menu:git<CR>
nnoremap <silent><leader>ugf :UniteWithCursorWord file_rec/async<CR>
nnoremap <silent><leader>ugt :UniteWithCursorWord tag<CR>
nnoremap <silent><Leader>ls :call <SID>view_github_starred_repos()<CR>
function! s:view_github_starred_repos() abort
if empty(g:unite_source_menu_menus.MyStarredrepos.command_candidates)
if UpdateStarredRepos()
@ -298,8 +259,6 @@ function! s:view_github_starred_repos() abort
Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos
endif
endfunction
nnoremap <silent><Leader>lm :Unite
\ -silent -ignorecase -winheight=17 -start-insert menu:MpvPlayer<CR>
call zvim#util#loadMusics()
augroup unite_buffer_feature
autocmd FileType unite call s:unite_my_settings()

View File

@ -1,7 +0,0 @@
nmap <Leader>m <Plug>BookmarkToggle
nmap <Leader>mi <Plug>BookmarkAnnotate
nmap <Leader>ma <Plug>BookmarkShowAll
nmap <Leader>mj <Plug>BookmarkNext
nmap <Leader>mk <Plug>BookmarkPrev
nmap <Leader>mc <Plug>BookmarkClear
nmap <Leader>mx <Plug>BookmarkClearAll

View File

@ -30,7 +30,6 @@ description: "General documentation about how to using SpaceVim, including the q
- [File Operations](#file-operations)
- [Editor UI](#editor-ui)
- [Native functions](#native-functions)
- [Plugin: Unite](#plugin-unite)
- [Plugin: Bookmarks](#plugin-bookmarks)
- [Completion](#completion)
- [Unite/Denite](#unitedenite)
@ -305,14 +304,6 @@ Move Text Transient State:
## Differences between vim/neovim and SpaceVim
- The `f` key does find char on the right, but in SpaceVim it is the `Unite` key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of `f`, you can use an empty string to disable this feature.
the option is `g:spacevim_unite_leader`, default value is `f`.
- The `F` key does find char on the left, but in SpaceVim it is the `Denite` key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of `F`, you can use an empty string to disable this feature.
the option is `g:spacevim_denite_leader`, default value is `F`.
- The `s` key does replace cursor char, but in SpaceVim it is the `Window` key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of `s`, you can use an empty string to disable this feature.
the option is `g:spacevim_windows_leader`, default value is `s`.
@ -668,35 +659,6 @@ can be get by <kbd><leader> q r</kbd>
| `<leader>` + `qr?` | Normal | Same as native `q?`, open cmdwin |
| `<leader>` + `qr:` | Normal | Same as native `q:`, open cmdwin |
### Plugin: Unite
| Key | Mode | Action |
| ------------------- | :-----------: | ---------------------------------------------------------- |
| `[unite]` | Normal | unite leader, default is `f`, `:h g:spacevim_unite_leader` |
| `[unite]`+`r` | Normal | Resumes Unite window |
| `[unite]`+`f` | Normal | Opens Unite file recursive search |
| `[unite]`+`i` | Normal | Opens Unite git file search |
| `[unite]`+`g` | Normal | Opens Unite grep with ag (the_silver_searcher) |
| `[unite]`+`u` | Normal | Opens Unite source |
| `[unite]`+`t` | Normal | Opens Unite tag |
| `[unite]`+`T` | Normal | Opens Unite tag/include |
| `[unite]`+`l` | Normal | Opens Unite location list |
| `[unite]`+`q` | Normal | Opens Unite quick fix |
| `[unite]`+`e` | Normal | Opens Unite register |
| `[unite]`+`j` | Normal | Opens Unite jump, change |
| `[unite]`+`h` | Normal | Opens Unite history/yank |
| `[unite]`+`s` | Normal | Opens Unite session |
| `[unite]`+`n` | Normal | Opens Unite session/new |
| `[unite]`+`o` | Normal | Opens Unite outline |
| `[unite]`+`c` | Normal | Opens Unite buffer bookmark file in current directory |
| `[unite]`+`b` | Normal | Opens Unite buffer bookmark file in buffer directory |
| `[unite]`+`ma` | Normal | Opens Unite mapping |
| `[unite]`+`<space>` | Normal | Opens Unite menu:CustomKeyMaps |
| `[unite]`+`me` | Normal | Opens Unite output messages |
| `<leader>`+`bl` | Normal | Opens Unite buffers, mru, bookmark |
| `<leader>`+`ta` | Normal | Opens Unite tab |
| `<leader>`+`ugf` | Normal | Opens Unite file with word at cursor |
| `<leader>`+`ugt` | Normal/visual | Opens Unite tag with word at cursor |
### Plugin: Bookmarks

View File

@ -13,4 +13,33 @@ This layer is a heavily customized warpper for unite.vim and unite sources.
## Configuration
SpaceVim use `f` as the default customized key bindings prefix for unite layer.
This is a fuzzy finder layer for SpaceVim, and it is based on unite.vim. In SpaceVim all fuzzy finder layer use same key bindings:
## Key bindings
| Key | Mode | Action |
| ------------------- | :-----------: | ---------------------------------------------------------- |
| `[unite]`+`r` | Normal | Resumes Unite window |
| `[unite]`+`f` | Normal | Opens Unite file recursive search |
| `[unite]`+`i` | Normal | Opens Unite git file search |
| `[unite]`+`g` | Normal | Opens Unite grep with ag (the_silver_searcher) |
| `[unite]`+`u` | Normal | Opens Unite source |
| `[unite]`+`t` | Normal | Opens Unite tag |
| `[unite]`+`T` | Normal | Opens Unite tag/include |
| `[unite]`+`l` | Normal | Opens Unite location list |
| `[unite]`+`q` | Normal | Opens Unite quick fix |
| `[unite]`+`e` | Normal | Opens Unite register |
| `[unite]`+`j` | Normal | Opens Unite jump, change |
| `[unite]`+`h` | Normal | Opens Unite history/yank |
| `[unite]`+`s` | Normal | Opens Unite session |
| `[unite]`+`n` | Normal | Opens Unite session/new |
| `[unite]`+`o` | Normal | Opens Unite outline |
| `[unite]`+`c` | Normal | Opens Unite buffer bookmark file in current directory |
| `[unite]`+`b` | Normal | Opens Unite buffer bookmark file in buffer directory |
| `[unite]`+`ma` | Normal | Opens Unite mapping |
| `[unite]`+`<space>` | Normal | Opens Unite menu:CustomKeyMaps |
| `[unite]`+`me` | Normal | Opens Unite output messages |
| `<leader>`+`bl` | Normal | Opens Unite buffers, mru, bookmark |
| `<leader>`+`ta` | Normal | Opens Unite tab |
| `<leader>`+`ugf` | Normal | Opens Unite file with word at cursor |
| `<leader>`+`ugt` | Normal/visual | Opens Unite tag with word at cursor |

View File

@ -49,6 +49,6 @@ The easist way is to download [install.cmd](https://spacevim.org/install.cmd) an
## Learning SpaceVim
- [SpaceVim Documentation](documentation/). Also known as "The Book", The SpaceVim Documentation will introduce
- [SpaceVim Documentation](documentation). Also known as "The Book", The SpaceVim Documentation will introduce
you to the main topics important to using SpaceVim. The book is the primary official document of the language.
- [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Tell you how to hack SpaceVim.