Added nvim function to README docs (Issue #64)#116
Open
ruifm wants to merge 1 commit intojhawthorn:masterfrom
Open
Added nvim function to README docs (Issue #64)#116ruifm wants to merge 1 commit intojhawthorn:masterfrom
ruifm wants to merge 1 commit intojhawthorn:masterfrom
Conversation
Contributor
|
For Vim 8.1 and higher (with function! s:completed(winid, filename, action, ...) abort
bdelete!
call win_gotoid(a:winid)
if filereadable(a:filename)
let lines = readfile(a:filename)
if !empty(lines)
exe a:action . ' ' . lines[0]
endif
call delete(a:filename)
endif
endfunction
function! FzyCommand(choice_command, vim_command)
let file = tempname()
let winid = win_getid()
let cmd = split(&shell) + split(&shellcmdflag) + [a:choice_command . ' | fzy > ' . file]
let F = function('s:completed', [winid, file, a:vim_command])
botright 10 new
if has('*termopen')
call termopen(cmd, {'on_exit': F})
else
call term_start(cmd, {'exit_cb': F, 'curwin': 1})
endif
startinsert
endfunction |
Contributor
|
@jhawthorn probably worth merging this, it works great for neovim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From this discussion.
Tested it on both neovim 0.3.7 and vim 8.1.1-1467.