-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore NERDTree window and others #139
Comments
I don't understand what your exact request is. |
What if you have more than two windows, how to know in which window the selected file should be opend? |
This is also a problem for tagbar. If there is anything that can be done from the tagbar (or NERDtree) side of things let us know. I don't know exactly how to handle the case of multiple open panes besides these utility panes, but somehow the utility panes know where to send you back when you open a file or navigate to a header from inside them, so it should be possible to capture or pass that information to Clap so it can open files in the correct target pane as well. |
First we need a list from all windows in the current tab. So we can get the filetype for each window and ignore if the window appears in the ignored list. So on the Clap return it can change the focus for the first window on the new list. The follow filetypes can be ignored I think:
|
You still can't guarantee the first one of new list is desired. |
The only way that I think is by precedence. By position would be better, but I don't know if its possible. |
Actually the position is not a clear rule, e.g., some people like the window on the right side, while some may prefer the one on the left or at the bottom. I'm not interested in this feature myself, but I can accept PR :(. |
Related in some way weirongxu/coc-explorer@6fa5a3d |
I think this is highly controversial. If it is implemented it should be based on a list of buffers that the user specifies. I use Neovim terminal a lot, as well as Startify, Quick Fix, Vista and FileBeagle. When I open a file with Clap I expect it to be open in the window with focus, even if it is one the above list. |
Stale issue message |
Surprised that this was closed out; I'm very interested in this feature, since it always throws me for a loop when my file drawer (in this case, NERDTree) is taken over by a file I was trying to open. FWIW, there are a variety of solutions that folks came up with in this thread for FZF; I'm still really not good with vimscript so it's a bit tough for me to figure out how to make it apply to vim-clap. Maybe someone in this thread knows? junegunn/fzf#453 |
This issue should be reopened. That bot should be shut down. |
Yeah, also find it a bit of annoying. |
Try #653, you can change the focus to other windows when opening clap as follows: autocmd User ClapOnInitialize call TryStartFromOtherWindow()
function! TryStartFromOtherWindow() abort
" Filter the windows you want to ignore
if bufname('%') ==# 'NERD_tree' || &filetype ==# 'coc-explorer'
" Move the focus on the window you prefer.
noautocmd wincmd l
" Reset the start window of clap.
let g:clap.start.bufnr = bufnr('')
let g:clap.start.winid = win_getid()
let g:clap.start.old_pos = getpos('.')
endif
endfunction |
That's looking promising (haven't test driven it yet, but the concept looks about right). But I would argue this should be included by default. I would think it vanishingly rare that anybody would want their special purpose panes taken over by Clap. My guess is the expected behavior 99% of the time is going to be to use whatever the most recent buffer in the buffer history is that does not match one of the ignore list. Such a list could be prepopulated with at least a dozen or so of the more popular plugins that create special panes. |
We can reach some consensus about the ignore list, but which window we prefer in this scenario is not pretty standard, we can see there are various user requests in junegunn/fzf#453, so my opinion is just to let people themselves decide the list that should be ignored and what to do when they ignore them. |
* Add ClapOnInitialize hook Close #139 * Update doc
* initial commit * updated formatting * added links * updated node link * updated repo location * updated readme * Update konomi-milestone-1.md Co-authored-by: willesxm <willeslau@gmail.com>
I use NERDTree a lot on my workflow. Always that the focus is on it and I call Clap choosing a file the file is opened on the NERDTree's window.
Would be nice if it was possible to ignore the NERDTree window, and others, opening the file only on the allowed window.
For now I close the NERDTree's window and I open again after the file been opened. I think it's possible to solve with
ClapOnEnter
andClapOnExit
autocommands, but I still didn't have time to test.The text was updated successfully, but these errors were encountered: