Revision | adef1bf66b7076f04818738fef3fd21a7b53d965 (tree) |
---|---|
Time | 2023-05-05 19:01:14 |
Author | Markus Prepens <markus.prepens@gmai...> |
Commiter | Markus Prepens |
RgFiles accepts 2nd parameter
@@ -118,10 +118,12 @@ export def CloseCb(ch: channel) | ||
118 | 118 | popup_create(done_str, g:WinoptsDone()) |
119 | 119 | else |
120 | 120 | var b = bufadd(d.name) |
121 | + lines = getbufinfo(b)[0].linecount | |
121 | 122 | execute "drop" d.name |
122 | - setline(line("$") + 1, [d.full_cmd] + getbufline(d.bufnr, 1, "$")) | |
123 | - setlocal buftype=nofile nomodified | |
124 | - | |
123 | + setlocal noreadonly | |
124 | + setline(lines + 1, ['# ' .. d.full_cmd] + getbufline(d.bufnr, 1, "$")) | |
125 | + setlocal buftype=nofile nomodified readonly | |
126 | + setpos(".", [b, lines + 1, 0, 0]) | |
125 | 127 | endif |
126 | 128 | |
127 | 129 | execute "silent bwipe" d.bufnr |
@@ -2,12 +2,12 @@ vim9script | ||
2 | 2 | # Vim plugin FIF - find in files |
3 | 3 | # Description: Some minor extensions to run ripgrep or Windows own findstr. |
4 | 4 | |
5 | -import autoload "run.vim" | |
6 | - | |
7 | 5 | if !executable("rg") |
8 | 6 | finish |
9 | 7 | endif |
10 | 8 | |
9 | +import autoload "run.vim" | |
10 | + | |
11 | 11 | g:rg_glob_patterns = { |
12 | 12 | c: '-g *.c -g *.h -g *.850 -g *.s', |
13 | 13 | cpp: '-tcpp -tc', |
@@ -43,10 +43,10 @@ enddef | ||
43 | 43 | set grepprg=rg\ --vimgrep\ $* |
44 | 44 | set grepformat=%f:%l:%c:%m |
45 | 45 | |
46 | -command! -complete=file -nargs=* RgFiles run.RunStart({cmd: "rg --files" .. g:RgGlobSwitch() .. join(split('<args>', " "), g:RgGlobSwitch() ), name: "RgFiles"}) | |
46 | +command! -complete=file -nargs=* RgFiles run.RunStart({cmd: "rg --files" .. g:RgGlobSwitch() .. ' <args>', name: "RgFiles"}) | |
47 | 47 | command! -complete=file -nargs=* Rg run.RunStart({cmd: 'rg --vimgrep ' .. ' <args> ' .. join(g:rg_paths, " "), regexp: &grepformat, no_popup: true}) |
48 | 48 | |
49 | -nnoremap <Leader>F :RgFiles **<Left> | |
49 | +nnoremap <Leader>F :RgFiles ** .<Left><Left><Left> | |
50 | 50 | nnoremap <Leader>R :Rg <C-r>=g:RgExcludes()<CR> <C-r>=RgIncludes(&ft)<CR> <C-r>=RgPattern()<CR> |
51 | 51 | nnoremap <silent> <Leader>r :Rg <C-r>=g:RgExcludes()<CR> <C-r>=RgIncludes(&ft)<CR> <C-r>=RgPattern()<CR><CR> |
52 | 52 |