mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:00:04 +08:00
Fix cursor position when open item
This commit is contained in:
parent
07d7169e5f
commit
26f48076ff
@ -10,7 +10,7 @@ let s:MPT._prompt.mpt = '➭ '
|
|||||||
" files: files for grep, @buffers means listed buffer.
|
" files: files for grep, @buffers means listed buffer.
|
||||||
" dir: specific a directory for grep
|
" dir: specific a directory for grep
|
||||||
function! SpaceVim#plugins#flygrep#open(agrv) abort
|
function! SpaceVim#plugins#flygrep#open(agrv) abort
|
||||||
rightbelow split __flygrep__
|
noautocmd rightbelow split __flygrep__
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
|
||||||
let save_tve = &t_ve
|
let save_tve = &t_ve
|
||||||
setlocal t_ve=
|
setlocal t_ve=
|
||||||
@ -224,9 +224,10 @@ function! s:open_item() abort
|
|||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let filename = fnameescape(split(line, ':\d\+:')[0])
|
let filename = fnameescape(split(line, ':\d\+:')[0])
|
||||||
let linenr = matchstr(line, ':\d\+:')[1:-2]
|
let linenr = matchstr(line, ':\d\+:')[1:-2]
|
||||||
q
|
let colum = matchstr(line, '\(:\d\+\)\@<=:\d\+:')[1:-2]
|
||||||
|
noautocmd q
|
||||||
exe 'e ' . filename
|
exe 'e ' . filename
|
||||||
exe linenr
|
call cursor(linenr, colum)
|
||||||
redraw!
|
redraw!
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -5,4 +5,4 @@ let b:current_syntax = "SpaceVimFlyGrep"
|
|||||||
syntax case ignore
|
syntax case ignore
|
||||||
|
|
||||||
hi def link FileName Comment
|
hi def link FileName Comment
|
||||||
call matchadd('FileName', '[^:]*:\d\+:', 2)
|
call matchadd('FileName', '[^:]*:\d\+:\d\+:', 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user