mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +08:00
Add gd for help desc buffer && fix SPC p f
This commit is contained in:
parent
d042550b05
commit
f2a8ef04d6
@ -6,6 +6,8 @@ function! SpaceVim#layers#core#plugins() abort
|
|||||||
\ ]
|
\ ]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:filename = expand('<sfile>:~')
|
||||||
|
let s:lnum = expand('<slnum>') + 3
|
||||||
function! SpaceVim#layers#core#config() abort
|
function! SpaceVim#layers#core#config() abort
|
||||||
let g:rooter_silent_chdir = 1
|
let g:rooter_silent_chdir = 1
|
||||||
let g:vimproc#download_windows_dll = 1
|
let g:vimproc#download_windows_dll = 1
|
||||||
@ -14,11 +16,41 @@ function! SpaceVim#layers#core#config() abort
|
|||||||
call SpaceVim#layers#load('core#tabline')
|
call SpaceVim#layers#load('core#tabline')
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'], 'CtrlP', 'find files in current project', 1)
|
let lnum = expand('<slnum>') + s:lnum - 1
|
||||||
|
if has('python3')
|
||||||
|
let cmd = 'Denite file_rec'
|
||||||
|
elseif has('python')
|
||||||
|
let cmd = "exe 'LeaderfFile"
|
||||||
|
else
|
||||||
|
let cmd = "exe 'CtrlP"
|
||||||
|
endif
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
|
||||||
|
\ cmd,
|
||||||
|
\ ['find files in current project',
|
||||||
|
\ [
|
||||||
|
\ '[SPC p f] is to find files in the root of the current project',
|
||||||
|
\ 'vim with +python3 support will use denite',
|
||||||
|
\ 'vim with +python support will use leaderf',
|
||||||
|
\ 'otherwise will use ctrlp',
|
||||||
|
\ '',
|
||||||
|
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||||
|
\ ]
|
||||||
|
\ ]
|
||||||
|
\ , 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['q', 'q'], 'qa', 'prompt-kill-vim', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['q', 'q'], 'qa', 'prompt-kill-vim', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['q', 'Q'], 'qa!', 'kill-vim', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['q', 'Q'], 'qa!', 'kill-vim', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['q', 'R'], '', 'restart-vim(TODO)', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['q', 'R'], '', 'restart-vim(TODO)', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['q', 'r'], '', 'restart-vim-resume-layouts(TODO)', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['q', 'r'], '', 'restart-vim-resume-layouts(TODO)', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1)
|
||||||
|
call SpaceVim#mapping#gd#add('HelpDescribe', function('s:gotodef'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:gotodef() abort
|
||||||
|
let fname = get(b:, 'defind_file_name', '')
|
||||||
|
if !empty(fname)
|
||||||
|
close
|
||||||
|
exe 'edit ' . fname[0]
|
||||||
|
exe fname[1]
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -62,6 +62,7 @@ function! s:open_describe_buffer(desc) abort
|
|||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber nocursorline
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber nocursorline
|
||||||
set filetype=HelpDescribe
|
set filetype=HelpDescribe
|
||||||
call setline(1, a:desc)
|
call setline(1, a:desc)
|
||||||
|
let b:defind_file_name = split(a:desc[-1][12:], ':')
|
||||||
let lines = &lines * 30 / 100
|
let lines = &lines * 30 / 100
|
||||||
if lines < winheight(0)
|
if lines < winheight(0)
|
||||||
exe 'resize ' . lines
|
exe 'resize ' . lines
|
||||||
|
Loading…
x
Reference in New Issue
Block a user