ronakg / quickr-preview.vim Goto Github PK
View Code? Open in Web Editor NEWQuickly preview Quickfix results in vim without opening the file
Quickly preview Quickfix results in vim without opening the file
Currently it is a little bit annoying to disable the preview window without having to set another mapping, and remember this new mapping
Steps to reproduce:
:grep
)<Enter>
on a file and notice that it opens with readonly unset.p
one or more times on a file and then hit <Enter>
. That file will open with readonly
set.:verb set readonly?
)A) I suppose one solution would be:
B) Alternative solution: Completely :bwipeout
the buffer before opening it for editing. Then it should open with fresh settings.
(Of course we don't want to do that if the buffer was already open before we started previewing.)
My vim setting:
set completeopt=menuone,popup,longest
set previewpopup=height:10,width:60
According to #23 I also set
like let g:quickr_preview_position = 'popup'
Here my error (true in german .., sorry :( ) output when calling \leader space.
|| Fehler beim Ausführen von "function QFList":
|| Zeile 32:
|| E441: Es gibt kein Vorschaufenster
|| Zeile 44:
|| E366: Popup-Fenster zu betreten nicht erlaubt
This error is observable when using vim dispatch. When dispatching commands which don't search such as :Make lint
the following error is raised:
Error detected while processing function InvokeQFList:
line 1:
E108: No such variable: "b:quickr_preview_timer"
while search simbol with quickr_cscope, the quickr_preview whill show the messege as flowings:
"[Quickfix List]" line 1 of 5 --20%-- col 1
Error detected while processing BufDelete Autocommands for "<buffer=5>":
E788: Not allowed to edit another buffer now
Press ENTER or type command to continue
And then, I could noly select the first items in quickr_preview
system: Ubuntu 16.04.6 LTS \n \l
vim: compile with newest vim code(v8.1)
Except action:
quickr-preview.vim will visual select the whole line in preview window.
But in macvim, this is not work.
screenshot:
In terminal:
In macvim
macvim version:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 5 2017 04:42:50)
MacOS X (unix) version
Included patches: 1-1175
Compiled by [email protected]
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +comments +extra_search +jumplist +mouseshape +odbeditor +scrollbind +termresponse +wildmenu
+arabic +conceal +farsi +keymap +mouse_dec +packages +signs +textobjects +windows
+autocmd +cryptv +file_in_path +lambda -mouse_gpm +path_extra +smartindent +timers +writebackup
+balloon_eval +cscope +find_in_path +langmap -mouse_jsbterm +perl/dyn +startuptime +title -X11
+browse +cursorbind +float +libcall +mouse_netterm +persistent_undo +statusline +toolbar -xfontset
++builtin_terms +cursorshape +folding +linebreak +mouse_sgr +postscript -sun_workshop +transparency +xim
+byte_offset +dialog_con_gui -footer +lispindent -mouse_sysmouse +printer +syntax +user_commands -xpm
+channel +diff +fork() +listcmds +mouse_urxvt +profile +tag_binary +vertsplit -xsmp
+cindent +digraphs +fullscreen +localmap +mouse_xterm +python/dyn +tag_old_static +virtualedit -xterm_clipboard
+clientserver +dnd -gettext +lua/dyn +multi_byte +python3/dyn -tag_any_white +visual -xterm_save
+clipboard -ebcdic -hangul_input +menu +multi_lang +quickfix -tcl +visualextra
+cmdline_compl +emacs_tags +iconv +mksession -mzscheme +reltime +termguicolors +viminfo
+cmdline_hist +eval +insert_expand +modify_fname +netbeans_intg +rightleft +terminal +vreplace
+cmdline_info +ex_extra +job +mouse +num64 +ruby/dyn +terminfo +wildignore
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "/.vim/vimrc"/.vim/gvimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation:
clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE
I installed both https://github.com/stefandtw/quickfix-reflector.vim and https://github.com/ronakg/quickr-preview.vim plugins, I found when I grep and open quickfix window, I will get the following messages:
I have no idea what's going on. The only way to get rid of the error messages is to comment the following line:
" autocmd BufDelete <buffer> pclose
And change the close qf mapping to
nnoremap <silent> <plug>(quickr_preview_qf_close) :cclose<CR>:lclose<CR>:pclose<CR>
if you could spare some time to investigate this issue, that will be great.
Thanks.
like let g:quickr_preview_position = 'popup' and It's look nice
The current line lighting persists when closing the preview window. This is not usually an issue, unless the same buffer exists in another window; in that case highlighting remains in the other window.
This seems to be a common bug:
mileszs/ack.vim#150
vim-syntastic/syntastic#1489
For me, the issue occurs when I have NERDTree open; each time I close the preview window, the qf/loc window grows to fill the space that was previously filled by the preview window. This will continue to occur on each preview window close, until the qf/loc window takes up the entire screen.
If the lines displayed in the quick fix window are too long and wrap
option is set, quickr-preview does not show the right line in the preview window. A simple workaround is:
autocmd FileType qf set nowrap
upgrade vim from source, then
:help previewpopup
diff --git a/after/ftplugin/qf.vim b/after/ftplugin/qf.vim
index ac50894..2b45540 100644
--- a/after/ftplugin/qf.vim
+++ b/after/ftplugin/qf.vim
@@ -14,6 +14,7 @@ function! OpenPreviewWindow(bufname, linenr)
\ (g:quickr_preview_position =~? '\(left\|right\)') ? winwidth(0)/2 :
\ (&lines-winheight(0))/2
let l:orig_preview_height = &previewheight
+
execute 'set previewheight='.l:size
execute 'keepjumps '.g:quickr_preview_pedit_cmd.' +'.a:linenr.' '.a:bufname
execute 'set previewheight='.l:orig_preview_height
@@ -172,6 +173,7 @@ endif
"
function! QFList(linenr)
" Get the current entry and ensure it is valid
+ execute 'setlocal previewpopup=height:10'.',width:'.&columns.',border:off'
let l:entry = GetValidEntry(a:linenr)
if empty(l:entry)
return
@@ -187,13 +189,13 @@ function! QFList(linenr)
if GetPreviewWindow() && l:entry.bufnr == b:prvbufnr
" Go to preview window
set eventignore+=all
- keepjumps wincmd P
+ "keepjumps wincmd P
" Jump to the line of interest
execute 'keepjumps '.l:entry.lnum.' | normal! zz'
" Highlight the line of interest
execute 'match '.g:quickr_preview_line_hl.' /\%'.l:entry.lnum.'l^\s*\zs.\{-}\ze\s*$/'
" Go back to qf/loc window
- keepjumps wincmd p
+ "keepjumps wincmd p
set eventignore-=all
else
" Note if the buffer of interest is already listed
@@ -202,7 +204,7 @@ function! QFList(linenr)
call OpenPreviewWindow(bufname(l:entry.bufnr), l:entry.lnum)
" Go to preview window
set eventignore+=all
- keepjumps wincmd P
+ "keepjumps wincmd P
" Settings for preview window
execute 'setlocal '.g:quickr_preview_options
" Setting for unlisted buffers
@@ -214,7 +216,7 @@ function! QFList(linenr)
" Highlight the line of interest
execute 'match '.g:quickr_preview_line_hl.' /\%'.l:entry.lnum.'l^\s*\zs.\{-}\ze\s*$/'
" Go back to qf/loc window
- keepjumps wincmd p
+ "keepjumps wincmd p
set eventignore-=all
endif
let b:prvbufnr = l:entry.bufnr
I've got let g:quickr_preview_on_cursor = 1
set to open the preview automatically.
Naturally, is reverse possible?
Meaning is there a means to also have the preview automatically close on Quickfix List close instead of keeping an un-modifiable preview to stay open?
vim --version:
VIM - Vi IMproved 8.2 (2019 Dec 12, compilé Jan 08 2021 14:00:27)
Rustines incluses : 1-2311
config used:
let g:quickr_preview_keymaps = 0
let g:quickr_preview_position = 'above'
let g:quickr_preview_on_cursor = 1
let g:quickr_preview_exit_on_enter = 1
When I use :ltag <tagname>
followed by :lopen
, the preview always shown the begining of the file, but if press enter on a result, It jumps to the good line in the file.
I'm not sure my explanation is really clear, so feel free to ask if more clarity is needed.
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.