diff --git a/README.md b/README.md
index 3e570b3b..b0cdc1ac 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc.
- Written in Python.
- Support fuzzy and regex searching.
- Full-featured.
- - [Well-designed fuzzy matching algorithm](https://github.com/Yggdroot/testFuzzyMatch).
+ - Well-designed fuzzy matching algorithm.
- [Extensible](https://github.com/Yggdroot/LeaderF/wiki/Extensions).
Changelog
@@ -36,7 +36,7 @@ Requirements
- vim7.3 or higher. Only support 7.4.1126+ after [v1.01](https://github.com/Yggdroot/LeaderF/releases/tag/v1.01).
- Python2.7+ or Python3.1+.
- - To use the popup mode, neovim 0.42+ or vim 8.1.1615+ are required.
+ - To use the popup mode, neovim 0.5.0+ or vim 8.1.1615+ are required.
Installation
------------
@@ -75,7 +75,8 @@ Usage
usage: Leaderf[!] [-h] [--reverse] [--stayOpen] [--input | --cword]
[--top | --bottom | --left | --right | --belowright | --aboveleft | --fullScreen | --popup]
[--nameOnly | --fullPath | --fuzzy | --regexMode] [--nowrap] [--next | --previous]
- [--recall] [--popup-height ] [--popup-width ]
+ [--recall] [--popup-height ] [--popup-width ] [--no-sort]
+ [--case-insensitive] [--auto-preview | --no-auto-preview]
{file,tag,function,mru,searchHistory,cmdHistory,help,line,colorscheme,gtags,
self,bufTag,buffer,rg,filetype,command,window,quickfix,loclist,jumps}
@@ -108,6 +109,9 @@ optional arguments:
--popup-width
specifies the width of popup window, only available in popup mode.
--no-sort do not sort the result.
+ --case-insensitive fuzzy search case insensitively.
+ --auto-preview open preview window automatically.
+ --no-auto-preview don't open preview window automatically.
subcommands:
@@ -231,12 +235,6 @@ or add `--popup` after each subcommand, e.g.,
Leaderf file --popup
```
-It's better to set
-```vim
-let g:Lf_PreviewInPopup = 1
-```
-, so that you can also preview the result in a popup window.
-
Customization
-------------
@@ -293,7 +291,7 @@ Customization
" Show icons, icons are shown by default
let g:Lf_ShowDevIcons = 1
" For GUI vim, the icon font can be specify like this, for example
- let g:Lf_DevIconsFont = "DroidSansMono Nerd Font Mono"
+ let g:Lf_DevIconsFont = "DroidSansM Nerd Font Mono"
" If needs
set ambiwidth=double
```
@@ -310,7 +308,6 @@ let g:Lf_UseVersionControlTool = 0
let g:Lf_IgnoreCurrentBufferName = 1
" popup mode
let g:Lf_WindowPosition = 'popup'
-let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" }
let g:Lf_PreviewResult = {'Function': 0, 'BufTag': 0 }
diff --git a/autoload/leaderf.vim b/autoload/leaderf.vim
index aaa5996d..88927da5 100644
--- a/autoload/leaderf.vim
+++ b/autoload/leaderf.vim
@@ -11,9 +11,11 @@ if !exists("g:Lf_PythonVersion")
if has("python3")
let g:Lf_PythonVersion = 3
let g:Lf_py = "py3 "
+ let g:Lf_PyEval = function("py3eval")
elseif has("python")
let g:Lf_PythonVersion = 2
let g:Lf_py = "py "
+ let g:Lf_PyEval = function("pyeval")
else
echoe "Error: LeaderF requires vim compiled with +python or +python3"
finish
@@ -22,6 +24,7 @@ else
if g:Lf_PythonVersion == 2
if has("python")
let g:Lf_py = "py "
+ let g:Lf_PyEval = function("pyeval")
else
echoe 'LeaderF Error: has("python") == 0'
finish
@@ -29,6 +32,7 @@ else
else
if has("python3")
let g:Lf_py = "py3 "
+ let g:Lf_PyEval = function("py3eval")
else
echoe 'LeaderF Error: has("python3") == 0'
finish
@@ -67,10 +71,10 @@ function! s:InitDict(var, dict)
endfunction
call s:InitVar('g:Lf_WindowHeight', '0.5')
-call s:InitVar('g:Lf_TabpagePosition', 2)
+call s:InitVar('g:Lf_TabpagePosition', 3)
call s:InitVar('g:Lf_ShowRelativePath', 1)
call s:InitVar('g:Lf_DefaultMode', 'FullPath')
-call s:InitVar('g:Lf_CursorBlink', 1)
+call s:InitVar('g:Lf_CursorBlink', 0)
call s:InitVar('g:Lf_NeedCacheTime', '1.5')
call s:InitVar('g:Lf_NumberOfCache', 5)
call s:InitVar('g:Lf_UseMemoryCache', 1)
@@ -117,14 +121,15 @@ call s:InitVar('g:Lf_WorkingDirectoryMode', 'c')
call s:InitVar('g:Lf_WorkingDirectory', '')
call s:InitVar('g:Lf_ShowHidden', 0)
call s:InitDict('g:Lf_PreviewResult', {
- \ 'File': 0,
- \ 'Buffer': 0,
- \ 'Mru': 0,
- \ 'Tag': 0,
+ \ 'File': 1,
+ \ 'Buffer': 1,
+ \ 'Mru': 1,
+ \ 'Tag': 1,
\ 'BufTag': 1,
\ 'Function': 1,
- \ 'Line': 0,
+ \ 'Line': 1,
\ 'Colorscheme': 0,
+ \ 'Rg': 1,
\ 'Jumps': 1
\})
call s:InitDict('g:Lf_NormalMap', {})
@@ -137,6 +142,16 @@ call s:InitDict('g:Lf_GtagsfilesCmd', {
\ 'default': 'rg --no-messages --files'
\})
call s:InitVar('g:Lf_HistoryEditPromptIfEmpty', 1)
+call s:InitVar('g:Lf_PopupBorders', ["─","│","─","│","╭","╮","╯","╰"])
+call s:InitVar('g:Lf_GitFolderIcons', {
+ \ 'open': '',
+ \ 'closed': '',
+ \})
+call s:InitVar('g:Lf_GitKeyMap', {
+ \ 'previous_change': '[c',
+ \ 'next_change': ']c',
+ \ 'edit_file': '',
+ \})
let s:Lf_CommandMap = {
\ '': [''],
@@ -326,6 +341,17 @@ endfunction
call s:InitCommandMap('g:Lf_CommandMap', s:Lf_CommandMap)
+function! leaderf#execute(cmd)
+ if exists('*execute')
+ return execute(a:cmd)
+ else
+ redir => l:output
+ silent! execute a:cmd
+ redir END
+ return l:output
+ endif
+endfunction
+
function! leaderf#versionCheck()
if g:Lf_PythonVersion == 2 && pyeval("sys.version_info < (2, 7)")
echohl Error
@@ -363,21 +389,13 @@ function! leaderf#visual() abort
endfunction
function! leaderf#popupModePreviewFilter(winid, key) abort
- let key = get(g:Lf_KeyDict, get(g:Lf_KeyMap, a:key, a:key), a:key)
- if key ==? ""
- noautocmd call popup_close(a:winid)
- redraw
- return 0
- elseif key ==? ""
- noautocmd call popup_close(a:winid)
- " https://github.com/vim/vim/issues/5216
- "redraw
- return 0
- elseif key ==? ""
+ let key = get(g:Lf_KeyMap, a:key, a:key)
+ if key ==? ""
if exists("*getmousepos")
let pos = getmousepos()
if pos.winid == a:winid
call win_execute(pos.winid, "call cursor([pos.line, pos.column])")
+ redraw
return 1
endif
elseif has('patch-8.1.2266')
@@ -403,58 +421,20 @@ function! leaderf#popupModePreviewFilter(winid, key) abort
return 1
endif
endif
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3k")
- redraw
- return 1
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3j")
- redraw
- return 1
- endif
- return 0
-endfunction
-
-function! leaderf#normalModePreviewFilter(id, winid, key) abort
- let key = get(g:Lf_KeyDict, get(g:Lf_KeyMap, a:key, a:key), a:key)
- if key ==? ""
- noautocmd call popup_close(a:winid)
- redraw
- return 1
- elseif key ==? ""
- noautocmd call popup_close(a:winid)
- " https://github.com/vim/vim/issues/5216
- "redraw
- return 0
- elseif key ==? "" && has('patch-8.1.2266')
+ elseif key ==? "" && exists("*getmousepos")
let pos = getmousepos()
if pos.winid == a:winid
- call win_execute(pos.winid, "call cursor([pos.line, pos.column])")
+ call win_execute(a:winid, "norm! 3\")
+ redraw
return 1
- else
- noautocmd call popup_close(a:winid)
+ endif
+ elseif key ==? "" && exists("*getmousepos")
+ let pos = getmousepos()
+ if pos.winid == a:winid
+ call win_execute(a:winid, "norm! 3\")
redraw
- call win_execute(pos.winid, "call cursor([pos.line, pos.column])")
- exec g:Lf_py "import ctypes"
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
return 1
endif
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3k")
- redraw
- return 1
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3j")
- redraw
- return 1
- elseif key ==? ""
- call win_execute(a:winid, "norm! k")
- redraw
- return 1
- elseif key ==? ""
- call win_execute(a:winid, "norm! j")
- redraw
- return 1
endif
return 0
endfunction
@@ -463,23 +443,63 @@ function! leaderf#PopupFilter(winid, key) abort
return 0
endfunction
+function! leaderf#RemapKey(id, key) abort
+ exec g:Lf_py "import ctypes"
+
+ let normal_map = get(g:, 'Lf_NormalCommandMap', {})
+ let key_map = get(normal_map, '*', {})
+ let category = g:Lf_PyEval(printf("ctypes.cast(%d, ctypes.py_object).value._getExplorer().getStlCategory()", a:id))
+ for [old, new] in items(get(normal_map, category, {}))
+ let has_key = 0
+ for [k, v] in items(key_map)
+ if old =~ '\m<.\{-}>' && old ==? k
+ let key_map[k] = new
+ let has_key = 1
+ break
+ endif
+ endfor
+ if has_key == 0
+ let key_map[old] = new
+ endif
+ endfor
+
+ let key = a:key
+ let is_old = 0
+ let is_new = 0
+ for [old, new] in items(key_map)
+ if key =~ '\m<.\{-}>' && key ==? new || key ==# new
+ let key = old
+ let is_new = 1
+ endif
+ if key =~ '\m<.\{-}>' && key ==? old || key ==# old
+ let is_old = 1
+ endif
+ endfor
+
+ if is_old && is_new == 0
+ let key = ''
+ endif
+
+ return key
+endfunction
+
function! leaderf#NormalModeFilter(id, winid, key) abort
exec g:Lf_py "import ctypes"
- let key = get(g:Lf_KeyDict, get(g:Lf_KeyMap, a:key, a:key), a:key)
+ let key = leaderf#RemapKey(a:id, get(g:Lf_KeyMap, a:key, a:key))
if key !=# "g"
call win_execute(a:winid, printf("let g:Lf_%d_is_g_pressed = 0", a:id))
endif
if key ==# "j" || key ==? ""
- call win_execute(a:winid, "norm! j")
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.move('j')", a:id)
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
"redraw
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
elseif key ==# "k" || key ==? ""
- call win_execute(a:winid, "norm! k")
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.move('k')", a:id)
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
"redraw
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
@@ -518,10 +538,15 @@ function! leaderf#NormalModeFilter(id, winid, key) abort
elseif key ==? ""
if exists("*getmousepos")
let pos = getmousepos()
- call win_execute(pos.winid, "call cursor([pos.line, pos.column])")
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
- redraw
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
+ if pos.winid == a:winid
+ call win_execute(pos.winid, "call cursor([pos.line, pos.column])")
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
+ redraw
+ return 1
+ else
+ return 0
+ endif
elseif has('patch-8.1.2266')
call win_execute(a:winid, "exec v:mouse_lnum")
call win_execute(a:winid, "exec 'norm!'.v:mouse_col.'|'")
@@ -529,17 +554,31 @@ function! leaderf#NormalModeFilter(id, winid, key) abort
redraw
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
endif
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3k")
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
- redraw
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
- elseif key ==? ""
- call win_execute(a:winid, "norm! 3j")
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
- redraw
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
- elseif key ==# "q" || key ==? ""
+ elseif key ==? "" && exists("*getmousepos")
+ let pos = getmousepos()
+ if pos.winid == a:winid
+ call win_execute(a:winid, "norm! 3\")
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
+ redraw
+ return 1
+ else
+ return 0
+ endif
+ elseif key ==? "" && exists("*getmousepos")
+ let pos = getmousepos()
+ if pos.winid == a:winid
+ call win_execute(a:winid, "norm! 3\")
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._cli._buildPopupPrompt()", a:id)
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._getInstance().refreshPopupStatusline()", a:id)
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(False)", a:id)
+ redraw
+ return 1
+ else
+ return 0
+ endif
+ elseif key ==# "q"
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.quit()", a:id)
elseif key ==# "i" || key ==? ""
call leaderf#ResetPopupOptions(a:winid, 'filter', 'leaderf#PopupFilter')
@@ -552,12 +591,6 @@ function! leaderf#NormalModeFilter(id, winid, key) abort
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.accept('v')", a:id)
elseif key ==# "t"
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.accept('t')", a:id)
- elseif key ==# "s"
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.addSelections()", a:id)
- elseif key ==# "a"
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.selectAll()", a:id)
- elseif key ==# "c"
- exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.clearSelections()", a:id)
elseif key ==# "p"
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._previewResult(True)", a:id)
elseif key ==? ""
@@ -566,6 +599,8 @@ function! leaderf#NormalModeFilter(id, winid, key) abort
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._toUpInPopup()", a:id)
elseif key ==? ""
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value._toDownInPopup()", a:id)
+ elseif key ==? ""
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.closePreviewPopupOrQuit()", a:id)
endif
return 1
@@ -575,6 +610,7 @@ function! leaderf#PopupClosed(id_list, manager_id, winid, result) abort
" result is -1 if CTRL-C was pressed,
if a:result == -1
exec g:Lf_py "import ctypes"
+ exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.is_ctrl_c = True", a:manager_id)
exec g:Lf_py printf("ctypes.cast(%d, ctypes.py_object).value.quit()", a:manager_id)
for id in a:id_list
if id != a:winid
@@ -584,6 +620,18 @@ function! leaderf#PopupClosed(id_list, manager_id, winid, result) abort
endif
endfunction
+function! leaderf#Quit(manager_id) abort
+exec g:Lf_py "<< EOF"
+import ctypes
+manager = ctypes.cast(int(vim.eval("a:manager_id")), ctypes.py_object).value
+if manager.is_ctrl_c == False:
+ manager.is_autocmd = True
+ manager.quit()
+ manager.is_autocmd = False
+manager.is_ctrl_c = False
+EOF
+endfunction
+
function! leaderf#ResetPopupOptions(winid, option, value) abort
let opts = popup_getoptions(a:winid)
" https://github.com/vim/vim/issues/5081
diff --git a/autoload/leaderf/Any.vim b/autoload/leaderf/Any.vim
index cec62d01..72ff9e62 100644
--- a/autoload/leaderf/Any.vim
+++ b/autoload/leaderf/Any.vim
@@ -27,6 +27,16 @@ function! leaderf#Any#Maps(category)
nnoremap i :exec g:Lf_py b:Lf_AnyExplManager."input()"
nnoremap :exec g:Lf_py b:Lf_AnyExplManager."input()"
nnoremap :exec g:Lf_py b:Lf_AnyExplManager."toggleHelp()"
+ nnoremap p :exec g:Lf_py b:Lf_AnyExplManager."_previewResult(True)"
+ nnoremap j :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('j')"
+ nnoremap k :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('k')"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('Up')"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('Down')"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('PageUp')"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."moveAndPreview('PageDown')"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."_toUpInPopup()"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."_toDownInPopup()"
+ nnoremap :exec g:Lf_py b:Lf_AnyExplManager."closePreviewPopupOrQuit()"
if has_key(g:Lf_NormalMap, a:category)
for i in g:Lf_NormalMap[a:category]
exec 'nnoremap '.i[0].' '.i[1]
@@ -55,12 +65,18 @@ let g:Lf_Helps = {
\ "quickfix": "navigate quickfix",
\ "loclist": "navigate location list",
\ "jumps": "navigate jumps list",
+ \ "git": "use git",
+ \ "git-status": "show git status",
+ \ "git-log": "show the commit logs",
+ \ "git-diff": "show changes between commits, commit and working tree, etc",
+ \ "git-blame": "show what revision and author last modified each line of a file",
+ \ "coc": "execute coc's commands",
\ }
let g:Lf_Arguments = {
\ "file":[
\ [
- \ {"name": ["directory"], "nargs": "?", "help": "serarch files under "},
+ \ {"name": ["directory"], "nargs": "*", "help": "serarch files under "},
\ {"name": ["--file"], "nargs": "+", "help": "read file list from the specified file."},
\ ],
\ {"name": ["--no-ignore"], "nargs": 0, "help": "don't respect ignore files (.gitignore, .ignore, etc.)."},
@@ -70,8 +86,13 @@ let g:Lf_Arguments = {
\ {"name": ["--tabpage"], "nargs": 0, "help": "search buffers in current tabpage"},
\ ],
\ "mru":[
- \ {"name": ["--cwd"], "nargs": 0, "help": "search MRU in current working directory"},
+ \ [
+ \ {"name": ["--cwd"], "nargs": 0, "help": "search MRU in current working directory"},
+ \ {"name": ["--project"], "nargs": 0, "help": "search MRU in the project"},
+ \ ],
\ {"name": ["--no-split-path"], "nargs": 0, "help": "do not split the path"},
+ \ {"name": ["--absolute-path"], "nargs": 0, "help": "show absolute path"},
+ \ {"name": ["--frecency"], "nargs": 0, "help": "enable the frecency algorithm"},
\ ],
\ "tag":[],
\ "bufTag":[
@@ -93,9 +114,13 @@ let g:Lf_Arguments = {
\ {"name": ["-B", "--before-context"], "nargs": 1, "metavar": "", "help": "Show NUM lines before each match."},
\ {"name": ["-C", "--context"], "nargs": 1, "metavar": "", "help": "Show NUM lines before and after each match."},
\ {"name": ["--context-separator"], "nargs": 1, "metavar": "", "help": "The string used to separate non-contiguous context lines in the output."},
+ \ {"name": ["--crlf"], "nargs": 0, "help": "ripgrep will treat CRLF ('\r\n') as a line terminator instead of just '\n'."},
\ {"name": ["-e", "--regexp"], "action": "append", "metavar": "...",
\ "help": "A pattern to search for. This option can be provided multiple times, where all patterns given are searched."},
- \ {"name": ["-F", "--fixed-strings"], "nargs": 0, "help": "Treat the pattern as a literal string instead of a regular expression."},
+ \ [
+ \ {"name": ["-F", "--fixed-strings"], "nargs": 0, "help": "Treat the pattern as a literal string instead of a regular expression."},
+ \ {"name": ["--no-fixed-strings"], "nargs": 0, "help": "Treat the pattern as a regular expression."},
+ \ ],
\ {"name": ["-i", "--ignore-case"], "nargs": 0, "help": "Searches case insensitively."},
\ {"name": ["-L", "--follow"], "nargs": 0, "help": "Follow symbolic links while traversing directories."},
\ {"name": ["-P", "--pcre2"], "nargs": 0, "help": "When this flag is present, rg will use the PCRE2 regex engine instead of its default regex engine."},
@@ -104,6 +129,8 @@ let g:Lf_Arguments = {
\ {"name": ["-v", "--invert-match"], "nargs": 0, "help": "Invert matching. Show lines that do not match the given patterns."},
\ {"name": ["-w", "--word-regexp"], "nargs": 0, "help": "Only show matches surrounded by word boundaries. This is roughly equivalent to putting \\b before and after all of the search patterns."},
\ {"name": ["-x", "--line-regexp"], "nargs": 0, "help": "Only show matches surrounded by line boundaries."},
+ \ {"name": ["--binary"], "nargs": 0, "help": "Enabling this flag will cause ripgrep to search binary files."},
+ \ {"name": ["--column"], "nargs": 0, "help": "Show column numbers (1-based). This only shows the column numbers for the first match on each line."},
\ {"name": ["--hidden"], "nargs": 0, "help": "Search hidden files and directories. By default, hidden files and directories are skipped."},
\ {"name": ["--heading"], "nargs": 0, "help": "Prints the file path above clusters of matches from each file instead of printing the file path as a prefix for each matched line."},
\ {"name": ["--no-config"], "nargs": 0, "help": "Never read configuration files. When this flag is present, rg will not respect the RIPGREP_CONFIG_PATH environment variable."},
@@ -147,6 +174,7 @@ let g:Lf_Arguments = {
\ {"name": ["--append"], "nargs": 0, "help": "Append to the previous search results."},
\ {"name": ["--match-path"], "nargs": 0, "help": "Match the file path when fuzzy searching."},
\ {"name": ["--wd-mode"], "nargs": 1, "metavar": "", "help": "Specify the working directory mode, value has the same meaning as g:Lf_WorkingDirectoryMode."},
+ \ {"name": ["--live"], "nargs": 0, "help": "Perform the so called live grep. This option implies `-F`"},
\ ],
\ "gtags":[
\ [
@@ -189,6 +217,87 @@ let g:Lf_Arguments = {
\ "quickfix": [],
\ "loclist": [],
\ "jumps": [],
+ \ "git":{
+ \ "log": [
+ \ [
+ \ {"name": ["--current-file"], "nargs": 0, "help": "show logs of current file"},
+ \ {"name": ["--current-line"], "nargs": 0, "help": "show logs of current line"},
+ \ ],
+ \ [
+ \ {"name": ["--directly"], "nargs": 0, "help": "output the logs directly"},
+ \ {"name": ["--explorer"], "nargs": 0, "help": "view changed files of one commit in a tree explorer"},
+ \ ],
+ \ {"name": ["--position"], "nargs": 1, "choices": ["top", "right", "bottom", "left"], "metavar": "",
+ \ "help": "specifies the position of the logs window"},
+ \ {"name": ["--navigation-position"], "nargs": 1, "choices": ["top", "right", "bottom", "left"], "metavar": "",
+ \ "help": "specifies the position of the navigation panel"},
+ \ [
+ \ {"name": ["-s", "--side-by-side"], "nargs": 0, "help": "show diffs in a side-by-side view"},
+ \ {"name": ["-u", "--unified"], "nargs": 0, "help": "show diffs in a unified view"},
+ \ ],
+ \ {"name": ["-n", "--max-count"], "nargs": 1, "metavar": "", "help": "Limit the number of commits to output."},
+ \ {"name": ["--skip"], "nargs": 1, "metavar": "", "help": "Skip number commits before starting to show the commit output."},
+ \ {"name": ["--since", "--after"], "nargs": 1, "metavar": "", "help": "Show commits more recent than a specific date."},
+ \ {"name": ["--until", "--before"], "nargs": 1, "metavar": "", "help": "Show commits older than a specific date."},
+ \ {"name": ["--author"], "nargs": 1, "metavar": "", "help": "Limit the commits output to ones with author header lines that match the specified pattern (regular expression)."},
+ \ {"name": ["--committer"], "nargs": 1, "metavar": "", "help": "Limit the commits output to ones with committer header lines that match the specified pattern (regular expression)."},
+ \ {"name": ["--no-merges"], "nargs": 0, "help": "Do not print commits with more than one parent."},
+ \ {"name": ["--all"], "nargs": 0, "help": "Pretend as if all the refs in refs/, along with HEAD, are listed on the command line as ."},
+ \ {"name": ["--graph"], "nargs": 0, "help": "Draw a text-based graphical representation of the commit history on the left hand side of the output."},
+ \ {"name": ["--reverse-order"], "nargs": 0, "help": "Output the commits chosen to be shown in reverse order."},
+ \ {"name": ["--find-copies-harder"], "nargs": 0, "help": "This flag makes the command inspect unmodified files as candidates for the source of copy."},
+ \ {"name": ["extra"], "nargs": "*", "help": "extra arguments of git log"},
+ \ ],
+ \ "diff": [
+ \ {"name": ["--cached", "--staged"], "nargs": 0, "help": "run 'git diff --cached'"},
+ \ [
+ \ {"name": ["--directly"], "nargs": 0, "help": "output the diffs directly"},
+ \ {"name": ["--explorer"], "nargs": 0, "help": "view changed files in a tree explorer"},
+ \ ],
+ \ {"name": ["--position"], "nargs": 1, "choices": ["top", "right", "bottom", "left"], "metavar": "",
+ \ "help": "specifies the position of the diffs window"},
+ \ {"name": ["--navigation-position"], "nargs": 1, "choices": ["top", "right", "bottom", "left"], "metavar": "",
+ \ "help": "specifies the position of the navigation panel"},
+ \ [
+ \ {"name": ["-s", "--side-by-side"], "nargs": 0, "help": "show diffs in a side-by-side view"},
+ \ {"name": ["-u", "--unified"], "nargs": 0, "help": "show diffs in a unified view"},
+ \ ],
+ \ {"name": ["--current-file"], "nargs": 0, "help": "show diffs of current file"},
+ \ {"name": ["extra"], "nargs": "*", "help": "extra arguments of git diff"},
+ \ ],
+ \ "blame": [
+ \ {"name": ["-w"], "nargs": 0, "help": "Ignore whitespace when comparing the parent’s version and the child’s to find where the lines came from."},
+ \ {"name": ["--date"], "nargs": 1, "choices": ["relative", "local", "iso", "iso-strict", "rfc", "short", "default"],
+ \ "metavar": "", "help": "Specifies the format used to output dates. .i.e, git blame --date=. can be one of ['relative', 'local', 'iso', 'iso-strict', 'rfc', 'short', 'default']"},
+ \ {"name": ["--inline"], "nargs": 0, "help": "Display inline git blame information."},
+ \ ],
+ \ "status": [
+ \ {"name": ["--navigation-position"], "nargs": 1, "choices": ["top", "right", "bottom", "left"], "metavar": "",
+ \ "help": "specifies the position of the navigation panel"},
+ \ [
+ \ {"name": ["-s", "--side-by-side"], "nargs": 0, "help": "show diffs in a side-by-side view"},
+ \ {"name": ["-u", "--unified"], "nargs": 0, "help": "show diffs in a unified view"},
+ \ ],
+ \ ],
+ \ },
+ \ "coc":{
+ \ "definitions": [
+ \ {"name": ["--auto-jump"], "nargs": "?", "metavar": "", "help": "Jump to the target directly when there is only one match. can be 'h', 'v' or 't', which mean jump to a horizontally, vertically split window, or a new tabpage respectively. If is omitted, jump to a position in current window."},
+ \ ],
+ \ "declarations": [
+ \ {"name": ["--auto-jump"], "nargs": "?", "metavar": "", "help": "Jump to the target directly when there is only one match. can be 'h', 'v' or 't', which mean jump to a horizontally, vertically split window, or a new tabpage respectively. If is omitted, jump to a position in current window."},
+ \ ],
+ \ "implementations": [
+ \ {"name": ["--auto-jump"], "nargs": "?", "metavar": "", "help": "Jump to the target directly when there is only one match. can be 'h', 'v' or 't', which mean jump to a horizontally, vertically split window, or a new tabpage respectively. If is omitted, jump to a position in current window."},
+ \ ],
+ \ "typeDefinitions": [
+ \ {"name": ["--auto-jump"], "nargs": "?", "metavar": "", "help": "Jump to the target directly when there is only one match. can be 'h', 'v' or 't', which mean jump to a horizontally, vertically split window, or a new tabpage respectively. If is omitted, jump to a position in current window."},
+ \ ],
+ \ "references": [
+ \ {"name": ["--auto-jump"], "nargs": "?", "metavar": "", "help": "Jump to the target directly when there is only one match. can be 'h', 'v' or 't', which mean jump to a horizontally, vertically split window, or a new tabpage respectively. If is omitted, jump to a position in current window."},
+ \ {"name": ["--exclude-declaration"], "nargs": 0, "help": "Exclude declaration locations."},
+ \ ],
+ \ },
\}
let g:Lf_CommonArguments = [
@@ -223,6 +332,13 @@ let g:Lf_CommonArguments = [
\ {"name": ["--popup-height"], "nargs": 1, "help": "specifies the maximum height of popup window, only available in popup mode."},
\ {"name": ["--popup-width"], "nargs": 1, "help": "specifies the width of popup window, only available in popup mode."},
\ {"name": ["--no-sort"], "nargs": 0, "help": "do not sort the result."},
+ \ {"name": ["--case-insensitive"], "nargs": 0, "help": "fuzzy search case insensitively."},
+ \ [
+ \ {"name": ["--auto-preview"], "nargs": 0, "help": "open preview window automatically."},
+ \ {"name": ["--no-auto-preview"], "nargs": 0, "help": "don't open preview window automatically."},
+ \ ],
+ \ {"name": ["--quick-select"], "nargs": "?", "choices":[0, 1], "metavar": "", "help": "Enable quick-select mode or not. can be '1' or '0', which means 'true' or 'false' respectively. If is omitted, it means enable quick-select mode."},
+ \ {"name": ["--preview-position"], "nargs": 1, "choices": ["top", "topleft", "topright", "right", "bottom", "left", "cursor"], "metavar": "", "help": "Specify where to place the preview window."},
\]
" arguments is something like g:Lf_CommonArguments
@@ -317,6 +433,21 @@ function! leaderf#Any#parseArguments(argLead, cmdline, cursorPos) abort
else
let arguments = []
endif
+
+ if type(arguments) == type({})
+ if argNum == 2 || argNum == 3 && a:argLead != ""
+ return filter(keys(arguments), "s:Lf_FuzzyMatch(a:argLead, v:val)")
+ else
+ let arguments = arguments[argList[2]]
+ endif
+ endif
+
+ if argNum > 3 && argList[1] == "git" && argList[2] == "blame"
+ if get(existingOptions, -1, "") == "--date"
+ return ["relative", "local", "iso", "iso-strict", "rfc", "short", "default"]
+ endif
+ endif
+
let argDict = s:Lf_GenDict(arguments + g:Lf_CommonArguments)
for opt in s:Lf_Refine(arguments + g:Lf_CommonArguments)
if type(opt) == type([])
diff --git a/autoload/leaderf/BufTag.vim b/autoload/leaderf/BufTag.vim
index 96f5eb4a..fdbbf10e 100644
--- a/autoload/leaderf/BufTag.vim
+++ b/autoload/leaderf/BufTag.vim
@@ -27,17 +27,15 @@ function! leaderf#BufTag#Maps()
nnoremap :exec g:Lf_py "bufTagExplManager.input()"
nnoremap :exec g:Lf_py "bufTagExplManager.toggleHelp()"
nnoremap p :exec g:Lf_py "bufTagExplManager._previewResult(True)"
- nnoremap j j:exec g:Lf_py "bufTagExplManager._previewResult(False)"
- nnoremap k k:exec g:Lf_py "bufTagExplManager._previewResult(False)"
- nnoremap :exec g:Lf_py "bufTagExplManager._previewResult(False)"
- nnoremap :exec g:Lf_py "bufTagExplManager._previewResult(False)"
- nnoremap :exec g:Lf_py "bufTagExplManager._previewResult(False)"
- nnoremap :exec g:Lf_py "bufTagExplManager._previewResult(False)"
- if has("nvim")
- nnoremap :exec g:Lf_py "bufTagExplManager._toUpInPopup()"
- nnoremap :exec g:Lf_py "bufTagExplManager._toDownInPopup()"
- nnoremap :exec g:Lf_py "bufTagExplManager._closePreviewPopup()"
- endif
+ nnoremap j :exec g:Lf_py "bufTagExplManager.moveAndPreview('j')"
+ nnoremap k :exec g:Lf_py "bufTagExplManager.moveAndPreview('k')"
+ nnoremap :exec g:Lf_py "bufTagExplManager.moveAndPreview('Up')"
+ nnoremap :exec g:Lf_py "bufTagExplManager.moveAndPreview('Down')"
+ nnoremap :exec g:Lf_py "bufTagExplManager.moveAndPreview('PageUp')"
+ nnoremap :exec g:Lf_py "bufTagExplManager.moveAndPreview('PageDown')"
+ nnoremap :exec g:Lf_py "bufTagExplManager._toUpInPopup()"
+ nnoremap :exec g:Lf_py "bufTagExplManager._toDownInPopup()"
+ nnoremap :exec g:Lf_py "bufTagExplManager.closePreviewPopupOrQuit()"
if has_key(g:Lf_NormalMap, "BufTag")
for i in g:Lf_NormalMap["BufTag"]
exec 'nnoremap '.i[0].' '.i[1]
diff --git a/autoload/leaderf/Buffer.vim b/autoload/leaderf/Buffer.vim
index 7675139c..3f1d5462 100644
--- a/autoload/leaderf/Buffer.vim
+++ b/autoload/leaderf/Buffer.vim
@@ -28,11 +28,16 @@ function! leaderf#Buffer#Maps()
nnoremap :exec g:Lf_py "bufExplManager.toggleHelp()"
nnoremap d :exec g:Lf_py "bufExplManager.deleteBuffer(1)"
nnoremap D :exec g:Lf_py "bufExplManager.deleteBuffer()"
- if has("nvim")
- nnoremap :exec g:Lf_py "bufExplManager._toUpInPopup()"
- nnoremap :exec g:Lf_py "bufExplManager._toDownInPopup()"
- nnoremap :exec g:Lf_py "bufExplManager._closePreviewPopup()"
- endif
+ nnoremap p :exec g:Lf_py "bufExplManager._previewResult(True)"
+ nnoremap j :