-
Notifications
You must be signed in to change notification settings - Fork 145
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
Configurations are only read once, so using vim.api.nvim_buf_get_name(0)
within a formatter config always returns the path to the first file opened when :FormatWrite
is called
#324
Comments
insidewhy
changed the title
Mar 17, 2024
vim.api.nvim_buf_get_name(0)
doesn't work when :FormatWrite called from file opened with :tabedit
vim.api.nvim_buf_get_name(0)
doesn't work when :FormatWrite
is called from file opened with :tabedit
insidewhy
changed the title
Mar 17, 2024
vim.api.nvim_buf_get_name(0)
doesn't work when :FormatWrite
is called from file opened with :tabedit
vim.api.nvim_buf_get_name(0)
always returns the path to the first file opened when :FormatWrite
is called
|
insidewhy
changed the title
Configurations are only read once, so using Mar 17, 2024
vim.api.nvim_buf_get_name(0)
always returns the path to the first file opened when :FormatWrite
is calledvim.api.nvim_buf_get_name(0)
within a formatter config always returns the path to the first file opened when :FormatWrite
is called
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I open a file via the command-line, then I can call
vim.api.nvim_buf_get_name(0)
within a formatter to get the current buffer name, it works.If I use
:tabedit
to or:edit
to open a file later, then it returns the empty string""
if neovim was opened with no file, or the path to the initially opened file.To reproduce:
nvim
without any files.:edit <file>
to open a new file whereutil.get_current_buffer_file_path()
is used in the formatting configuration.This is because the config setup is only run once.
The text was updated successfully, but these errors were encountered: