Skip to content
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

请教如何关闭当前已打开的文件,但不关闭当前 buffer 呢 #399

Closed
fengxuway opened this issue Jan 4, 2023 · 21 comments
Closed
Labels
usage User-specific issues

Comments

@fengxuway
Copy link

Feature description

刚接触 neovim,有些快捷键不太了解。如图这样的关闭当前文件,或关闭非当前文件有快捷键吗?
image

我试过执行

:q

:close 

这几个都会将当前 buffer 关闭导致 nvim 退出。

另外这套配置有快捷键参考列表嘛,对萌新更友好一些

Additional information

No response

@fengxuway fengxuway added the enhancement New feature or request label Jan 4, 2023
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Jan 4, 2023

刚接触 neovim,有些快捷键不太了解。如图这样的关闭当前文件,或关闭非当前文件有快捷键吗?

Close current buffer: <A-q>

另外这套配置有快捷键参考列表嘛,对萌新更友好一些

You can check the wiki or use <C-p> in neovim instances.

Open vscode like command panel: <C-p>

For prefixes such as <A-*>, refer to :h key-notation for more information

@Jint-lzxy Jint-lzxy added usage User-specific issues and removed enhancement New feature or request labels Jan 4, 2023
@fengxuway
Copy link
Author

嗯啊,多谢解答~

@Saton-anger
Copy link

I have tried to close the recent buffer using the keybinding <A-q>, but it just did not have any response. However, I can do close the whole window pressing <A-S-q>. I am quite confused about that.

@ayamir
Copy link
Owner

ayamir commented Jul 22, 2023

I have tried to close the recent buffer using the keybinding , but it just did not have any response.

["n|<A-q>"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"),

However, I can do close the whole window pressing .

["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),

@Saton-anger
Copy link

this is the current state of my key mapping settings
截屏2023-07-23 01 15 01
截屏2023-07-23 01 18 12
Looks like there is nothing wrong with the settings.

@Jint-lzxy
Copy link
Collaborator

What u mean by "just did not have any response"? And what did u do before this (how to reproduce this)?

@Saton-anger
Copy link

Sorry for the vague description.

'just did not have any response' means when I pressed <A-q>, it did not close the current buffer as expected.

To reproduce the results, the app I use is iTerm2, and my device is M1 pro macbook pro, first of all, I type nvim and opened several python files, when I was trying to close one of the files (I guess it is called 'buffer', so this action can be called 'close the current buffer'?) by typing <A-q>, I found that the current file was not closed. I also tried other key bindings like <A-S-q> to test whether my Alt key works, and it turned out that <A-S-q> do close the current window, which means my Alt key works well.

@Jint-lzxy
Copy link
Collaborator

@Saton-anger Did you make any modifications to these files externally? Any move or deletion will invalidate the file handle held by the current buffer, leading to failures in closing such buffers.

Added to that, what you see when using :BufDel! in those buffers?

@Saton-anger
Copy link

I had modified them with vscode. But when I saved the files, quit the vscode to make sure no external modificaitons to those files and reopen those files with terminal and nvim, I still can not close the current buffer using <A-q>, however, I can do close them using :BufDel! or BufDel.

@Jint-lzxy
Copy link
Collaborator

Did you close this buffer (via <A-q>) in normal mode?

@Saton-anger
Copy link

seems like this is the normal mode,

截屏2023-07-23 14 48 33

I tried to close the current buffer using <A-q> in this mode.

@Jint-lzxy
Copy link
Collaborator

Does clicking on the close button of this buffer in bufferline help?

@Saton-anger
Copy link

Actually it closed the whole window.
截屏2023-07-23 14 52 00

@Saton-anger
Copy link

which means both of the two buffers were closed.

@Jint-lzxy
Copy link
Collaborator

Hmm this is strange... Can you provide a complete repro (with detailed steps, including those corresponding files if possible)? I can't reproduce this with iTerm2.

@Jint-lzxy
Copy link
Collaborator

And did u follow #344 to setup ur profile correctly?

@Saton-anger
Copy link

This is the settings of my profile and I use the left option:
截屏2023-07-23 15 02 31
截屏2023-07-23 14 52 00

@Jint-lzxy
Copy link
Collaborator

Thanks for the info! But a complete repro is still necessary, otherwise we don't know where the problem lies.

@Saton-anger
Copy link

Ok, thanks. Should I open a new issue to proffer a complete repro?

@Jint-lzxy
Copy link
Collaborator

That would be appreciated, cause this sounds like a bug somewhere.

@Saton-anger
Copy link

OK, thanks again for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage User-specific issues
Projects
None yet
Development

No branches or pull requests

4 participants