diff --git a/README.md b/README.md index ce74f65..8f7f44b 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ Commands | `Buffers` | Open buffers | | `Colors` | Color schemes | | `Ag [PATTERN]` | [ag][ag] search result (`ALT-A` to select all, `ALT-D` to deselect all) | -| `Lines` | Lines in loaded buffers | -| `BLines` | Lines in the current buffer | +| `Lines [QUERY]` | Lines in loaded buffers | +| `BLines [QUERY]` | Lines in the current buffer | | `Tags [QUERY]` | Tags in the project (`ctags -R`) | | `BTags [QUERY]` | Tags in the current buffer | | `Marks` | Marks | diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 12fb4eb..f3510c9 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -259,11 +259,13 @@ endfunction function! fzf#vim#lines(...) let [display_bufnames, lines] = fzf#vim#_lines(1) let nth = display_bufnames ? 3 : 2 + let [query, args] = (a:0 && type(a:1) == type('')) ? + \ [a:1, a:000[1:]] : ['', a:000] return s:fzf(fzf#vim#wrap({ \ 'source': lines, \ 'sink*': s:function('s:line_handler'), - \ 'options': '+m --tiebreak=index --prompt "Lines> " --ansi --extended --nth='.nth.'.. --reverse --tabstop=1' - \}), a:000) + \ 'options': '+m --tiebreak=index --prompt "Lines> " --ansi --extended --nth='.nth.'.. --reverse --tabstop=1'.s:q(query) + \}), args) endfunction " ------------------------------------------------------------------ @@ -289,11 +291,13 @@ function! s:buffer_lines() endfunction function! fzf#vim#buffer_lines(...) + let [query, args] = (a:0 && type(a:1) == type('')) ? + \ [a:1, a:000[1:]] : ['', a:000] return s:fzf(fzf#vim#wrap({ \ 'source': s:buffer_lines(), \ 'sink*': s:function('s:buffer_line_handler'), - \ 'options': '+m --tiebreak=index --prompt "BLines> " --ansi --extended --nth=2.. --reverse --tabstop=1' - \}), a:000) + \ 'options': '+m --tiebreak=index --prompt "BLines> " --ansi --extended --nth=2.. --reverse --tabstop=1'.s:q(query) + \}), args) endfunction " ------------------------------------------------------------------ @@ -575,7 +579,7 @@ function! s:btags_sink(lines) endfunction function! s:q(query) - return ' --query "'.escape(a:query, '"').'"' + return ' --query "'.escape(a:query, '"\').'"' endfunction " query, [[tag commands], options] diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index b8d82e7..9248fb1 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -80,8 +80,8 @@ COMMANDS *fzf-vim-commands* `Buffers` | Open buffers `Colors` | Color schemes `Ag [PATTERN]` | {ag}{5} search result (ALT-A to select all, ALT-D to deselect all) - `Lines` | Lines in loaded buffers - `BLines` | Lines in the current buffer + `Lines [QUERY]` | Lines in loaded buffers + `BLines [QUERY]` | Lines in the current buffer `Tags [QUERY]` | Tags in the project ( `ctags -R` ) `BTags [QUERY]` | Tags in the current buffer `Marks` | Marks diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 53eed62..fd843b4 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -45,8 +45,8 @@ call s:defs([ \'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(, s:w(0))', \'command! -bang -nargs=? GitFiles call fzf#vim#gitfiles(, s:w(0))', \'command! -bang Buffers call fzf#vim#buffers(s:w(0))', -\'command! -bang Lines call fzf#vim#lines(s:w(0))', -\'command! -bang BLines call fzf#vim#buffer_lines(s:w(0))', +\'command! -bang -nargs=* Lines call fzf#vim#lines(, s:w(0))', +\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(, s:w(0))', \'command! -bang Colors call fzf#vim#colors(s:w(0))', \'command! -bang -nargs=1 -complete=dir Locate call fzf#vim#locate(, s:w(0))', \'command! -bang -nargs=* Ag call fzf#vim#ag(, s:w(0))',