Comments (8)
Hey, thanks for the submission.
I'm a little unsure of what you mean though. Could you maybe elaborate?
from goto-preview.
@rmagatti Okay. Here is a gif of what i mean:
You see after i close goto-preview window with a definition of the TEST
macro, previously loaded buffer common.h
is unloaded.
Files i use to reproduce:
init.vim
with clangd language server, vim-plug and lsp-config plugin
call plug#begin()
Plug 'neovim/nvim-lspconfig'
Plug 'rmagatti/goto-preview'
call plug#end()
lua << EOF
require'lspconfig'.clangd.setup{}
require('goto-preview').setup{}
EOF
nnoremap gf <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>
nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>
common.h
#define TEST 1
test.c
#include "common.h"
int main (int argc, char *argv[])
{
int a = 1 + TEST;
return 0;
}
neovim commit i pulled yesterday: b51b0aecc969040641da29dbd7cf28e419972f15
from goto-preview.
Assuming you're closing the preview window through the goto-preview mapping. This is what the documentation about the function I use to close it says.
-- Closes the window (like |:close| with a |window-ID|).
--- @param window window #Window handle, or 0 for current window
--- @param force boolean #Behave like `:close!` The last window of a
--- buffer with unwritten changes can be closed. The
--- buffer will become hidden, even if 'hidden' is
--- not set.
function vim.api.nvim_win_close(window, force) end
And this is how I'm calling it.
vim.api.nvim_win_close(win_handle, true)
I'm adding an option to not force close in a PR as I think this is likely the cause of what you're seeing, i.e I think your buffer is becoming hidden.
from goto-preview.
@0xRZ would you mind testing out the changes by installing with the branch of the PR linked here and setting force_close = false
in the setup?
from goto-preview.
@rmagatti i pulled add-force-close-option
, tried to set force_close = false
but it doesn't fix anything for me, <cmd>lua require('goto-preview').close_all_win()<CR>
still unloads buffer after preview window is closed
Im not really sure what this force
parameter of nvim_win_close
do, but i found out that https://github.com/rmagatti/goto-preview/blob/main/lua/goto-preview/lib.lua#L130 bufhidden
option can be changed from wipe
to hide
, that way existing buffer won't be unloaded, imo it seems to be the correct behaviour.
from goto-preview.
Oh interesting. Good find. I'll add an option for that to too.
from goto-preview.
@0xRZ added the option to change bufhidden too. Lmk if that works for you.
from goto-preview.
@rmagatti yeah, just pulled add-force-close-option
, when specifying bufhidden = "hide",
buffers are not lost. thx
from goto-preview.
Related Issues (20)
- Ability to modify file in floating window, without the need to full open it HOT 1
- [FEATURE] if reference is in current file, just jump to it HOT 3
- /lib.lua:225: attempt to index field 'lsp_configs' (a nil valu e) HOT 1
- [FEATURE] Press <Esc> while preview buffer is focused to close HOT 3
- Highlight group? HOT 2
- Different color theme in flat window HOT 3
- [BUG] Current buffer closes with preview if the preview and parent buffer are the same file HOT 2
- [FEATURE] Explain vim-plug setup HOT 3
- [FEATURE] Add a wiki for repo HOT 4
- [BUG] preview window triggers twice in vue 3 router file HOT 2
- [BUG] Fails if you haven't done regular go to definition first HOT 3
- [Suggestion] Remove vim.inspect HOT 2
- [FEATURE] Closing `n+1` preview should move the focus to the `n` preview HOT 4
- Can't use goto-preview while it is installed, how to troubleshoot it ? [BUG] HOT 4
- Keep the last directory structure after close the preview window HOT 7
- [FEATURE] Allow not to automatically initialize telescope HOT 1
- Change border color HOT 1
- How to close only one preview and how to open focused preview in current split but new buffer?
- Setting on `post_open_hook` will be shared if I split window? HOT 1
- [BUG] attempt to index field 'lsp_configs' (a nil value) HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goto-preview.