Skip to content

goto: use current window; respect / use 'switchbuf' setting in general #408

@blueyed

Description

@blueyed

I find it irritating, when "goto" goes to another/existing window (in another tab), via _newtab.

I think that jedi-vim should use Vim's switchbuf setting in general:

'switchbuf' 'swb'   string  (default "") global {not in Vi}

  This option controls the behavior when switching between buffers.
  Possible values (comma separated list):

     useopen    If included, jump to the first open window that
      contains the specified buffer (if there is one).
      Otherwise: Do not examine other windows.
      This setting is checked with |quickfix| commands, when
      jumping to errors (":cc", ":cn", "cp", etc.).  It is
      also used in all buffer related split commands, for
      example ":sbuffer", ":sbnext", or ":sbrewind".

     usetab Like "useopen", but also consider windows in other tab
      pages.

     split  If included, split the current window before loading
      a buffer for a |quickfix| command that display errors.
      Otherwise: do not split, use current window.

     newtab Like "split", but open a new tab page.  Overrules
      "split" when both are present.

Using switchbuf could eliminate some of the settings (g:jedi#use_tabs_not_buffers and g:jedi#use_splits_not_buffers), or rather could derive their defaults from it (g:jedi#use_splits_not_buffers allows for providing left, right etc.)

I find jedi#use_tabs_not_buffers (enabled by default) an odd setting by itself: e.g. for the quickfix list for the usages, there should be no extra handling, just use the standard quickfix mechanisms (which uses switchbuf).

Apart from that, goto should just use the window where it was called from, at least by default.

Some concrete questions:

  • should "rename" open new buffers? Probably yes, because these files have been changed.
  • :Pyimport should behave like "goto", i.e. not open a new buffer by default (according to switchbuf)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions