else
var bnr: number = fname->bufnr()
if bnr != -1
- if &modified || &buftype != ''
+ # Reuse an existing buffer. If the current buffer has unsaved changes
+ # and 'hidden' is not set or if the current buffer is a special
+ # buffer, then open the buffer in a new window.
+ if (&modified && !&hidden) || &buftype != ''
exe 'sbuffer ' .. bnr
else
exe 'buf ' .. bnr
endif
else
- if &modified || &buftype != ''
- # if the current buffer has unsaved changes, then open the file in a
- # new window
+ if (&modified && !&hidden) || &buftype != ''
+ # if the current buffer has unsaved changes and 'hidden' is not set,
+ # or if the current buffer is a special buffer, then open the file
+ # in a new window
exe 'split ' .. fname
else
exe 'edit ' .. fname
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 8.2.2342 and above
-Last change: Feb 17, 2022
+Last change: Mar 8, 2022
==============================================================================
*lsp-license*
*:LspGotoDefinition*
:LspGotoDefinition Jumps to the definition of the symbol under the
- cursor. If the file is already present in a window,
- then jumps to that window. Otherwise, opens the file
- in a new window. If the jump is successful, then the
- current cursor location is pushed onto the tag stack.
- Also the |``| mark is set to the position before the
- jump.
+ cursor. If the file is already present in a window,
+ then jumps to that window. Otherwise, opens the file
+ in a new window. If the current buffer is modified
+ and 'hidden' is not set or if the current buffer is a
+ special buffer, then a new window is opened. If the
+ jump is successful, then the current cursor location
+ is pushed onto the tag stack. The |CTRL-T| command
+ can be used to go back up the tag stack. Also the
+ |``| mark is set to the position before the jump.
*:LspGotoDeclaration*
:LspGotoDeclaration Jumps to the declaration of the symbol under the