GithubHelp home page GithubHelp logo

vim-choosewin's Introduction

日本語はこちら

Animated GIF

gif

Navigate to the window you choose

This plugin aims to mimic tmux's display-pane feature, which enables you to choose a window interactively.

This plugin should be especially useful when working on high resolution displays since with wide displays you are likely to open multiple windows and moving around windows with vim is cumbersome.

This plugin simplifies window navigation with the following functionality:

  1. Displays window label on statusline or middle of each window (overlay).
  2. Accepts window selection from user.
  3. Navigates to the specified window.

Example configuration:

" invoke with '-'
nmap  -  <Plug>(choosewin)

Optional configuration:

" if you want to use overlay feature
let g:choosewin_overlay_enable = 1

More configuration options are explained in the help file. See :help choosewin.

Default keymapings in choosewin mode

Key Action Description
0 tab_first Select FIRST tab
[ tab_prev Select PREVIOUS tab
] tab_next Select NEXT tab
$ tab_last Select LAST tab
x tab_close Close current tab
; win_land Navigate to current window
- previous Naviage to previous window
s swap Swap windows #1
S swap_stay Swap windows but stay #1
<CR> win_land Navigate to current window
<NOP> Disable predefined keymap

*1 If you select 'swap' again, you will swap with the previous window's buffer ex) using the default keymap, typing double 's'(ss) swaps with the previous window.

Operational examples

Map - to invoke choosewin with the following command:

nmap - <Plug>(choosewin)

Move around tabs, and choose windows

First of all, open multiple windows and tabs.
Invoke choosewin by typing - in normal mode.
Then you can move around tabs by ] and [, or you cand choose the target tab directly by typing the number labeled in the tabline.
After you chose a target tab, you can choose a target window by typing the letter which is labeled in the statusline and in the middle of each window (if you have enabled the overlay feature).

Choose the previous window

Type - again to invoke choosewin, then input - again to choose the previous window. The previous window you were on before you choose the current window.

Swap windows

Type - to invoke choosewin, then type s to swap windows.
Then type the label of a window to swap content(=buffer) of that window with your current window.
After you chose, the current window's buffer is swapped with the buffer shown in the window you chose.
By combining "swap" and "previous window" features, you can easily swap any window with the previous window like so: -s-, invoking choosewin itself(-) then entering swapping mode(s), then instructing choosewin to swap the target window with the previous(-) window. Congratulations!

NERDTree open file

If working with several windows, it is useful to be able to select a specific window when open a file from inside NERDTree. As default behavior NERDTree use Vims last window, that is often not the favored one. The NERDTree_choosewin-plugin provide this feature to select a window. Furthermore if the user has installed this Choosewin plugin as well, it is able to detect this and use it instead of the default behavior.

vim-choosewin's People

Contributors

captbaritone avatar crote avatar faceleg avatar gomlgs avatar hovsater avatar lkdjiin avatar malob avatar nicoder avatar omrisarig13 avatar rafi avatar rapan931 avatar t9md avatar tao12345666333 avatar weilbith avatar wikimatze avatar wsdjeg avatar yous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-choosewin's Issues

NERDTree Choosewin Plugin

Hey!
I love your plugin and I wrote a really simple NERDTree extenstion which use this to open files into a selected window. In fact having this plugin installed in parallel is the advanced scenario of this extension.
Maybe you like to reference this in your description, if you like. ✌️

choosewin: Vim(let):E117: Unknown function: uniq

Hi, thanks for your awesome plugin!

I found a slight error that says "choosewin: Vim(let):E117: Unknown function: uniq", when starting to display window labels.
I'm not sure about vim script. But the following modify seems to work well.

autoload/choosewin/overlay.vim|161|

  • let render_lines = uniq(b:choosewin.render_lines)
  • let render_lines = s:_.uniq(b:choosewin.render_lines)

Please confirm it.

Integration with status line plugins

Is it possible to do some kind of integration with status line plugins (powerline, vim-airline, lightline, etc)? So the jump character are always shown.

Clean-up error after trying to draw overlay on unmodifiable (terminal) buffer

Hi,
the terminal that was introduced in vim 8 apparently gives Plugins like yours a headache when they try to draw on the buffer. In the case of vim-choosewin, the error is handled kind of gracefully and switching still works, just on the terminal buffer, no overlay is drawn, and an error appears below in a non-intrusive mesage. Cheers -- that is handled better by far than the popular "easymotion" plugin.

Still, the status bars of the windows retain the "A"to"Z" markers after this error occured. some error handling or buffer type checking is needed. I am sorry to say that I don't know the first thing about it as I just started with vim.

Thanks again for the great plugin.

This plugin is so so awesome!!

Thanks a million!! I almost use tmux to split & swap vim instances before using this plugin.
Without this plugin, I don't want to use vim native windows at all. It's so awful for using more than two windows or tabs.

Ignore Filetype By Hook Doesn't Work

I copied the [Example] instructions from the documentation at choosewin-hook_point. For completion I copy it here:

let s:ignore_filtype = ["unite", "vimfiler", "vimshell", "nerdtree"]

let g:choosewin_hook = {}
function! g:choosewin_hook.filter_window(winnums)
   return filter(a:winnums,
	\ 'index(s:ignore_filtype,
	\   getwinvar(v:val, "&filetype")) == -1' )
endfunction

Unfortunately this does not work for me. Instead of just resource my runtime configuration, I spawn a complete new Vim instance and try it out. I opened a NerdTree window window first and than called :ChooseWin. The NerdTree window still get labeled.

Possible to have mapping to go to last window?

I'm wondering if there is a mapping where you can go to your last window. So say I have numerous splits in a complex layout and I'm going back and forth between B and D. Would it possible to have a mapping that goes to the last active window?

Swapping buffer with window from another tab does not work

Hi; great Plugin!!
I am a happy user and it's just easy going. But I did not manage to do one thing: swap buffers between windows of different tabs.

Config:

nmap  <C-w>;  <Plug>(choosewin)
  • I am in tab 1, window 'A' (2 more are open in this tab)
  • then I open the choosing mode C-w ;
  • then go into swap mode s
  • then press 2 for viewing tab 2 (red prompt "[swap] choose >" below still waiting for input )
  • then press b for completing my selection of swap target "Window b in tab 2"

Result: Focus is now in Window b, tab 2, but nothing was swapped.

Not working on vim 7.2

Hi

Iam using this plugin on vim 7.2, but not working, i got error like this..

choosewin: Vim(call):E355: Unknown option: conceallevel

error image
vim version

don't unfold all when choosewin

this is the current behavior, when use ChooseWin, code in all panes is unfolded:

asciicast

this can sometimes be distracting, hope there's an option to keep all folding while showing the pane numbers.

New release

The last release is over one year ago, and I recently learned about :ChooseWinSwap command. Would be great if there would be a new release.

Best

Matthias

Pressing 'Ctrl-c' should be gracefully handled

First of all. Thank you for this plugin. It's awesome and very well written. 👍

I noticed that pressing C-c (CTRL+c) causes a Vim:Interrupt message to be displayed and the statusline is not reverted back to its previous value. Pressing C-c should close choosewin and revert the statusline to its previous value.

trailing white space highlighted can't disable when syn match is used

function! TrailingWS()
  highlight TrailingWS term=underline ctermbg=Red guibg=Red
  syntax match TrailingWS '\s\+$' display containedin=ALL
endf
augroup TrailingWS  
  autocmd!
  autocmd BufNew,BufRead * call TrailingWS()
augroup END

Reported in linger, can't overrule even if pass high priority to matchadd().

  • One work around is provide hook and user manually disable this type of highlight
  • Other work around is use char other than white space(' ') for padding such like '_'. this worked my quick hack but its affect syntax highlight so its not feasible choose.

[Feature Request] Some way to edit the "overlay" hotkeys

I'd love to change the overlay hotkeys for windows from "A,B,C" etc. to keys in a row on the keyboard eg "Z,X,C" or "Q,W,E" etc.
I'd be happy to work on this if someone could point me in the right direction , I can't figure out where to start.

Unable to switch to window 'A'

I can't seem to be able to switch to 'A' window.
The only change I have is:

nmap F <Plug>(choosewin)
let g:choosewin_overlay_enable = 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.