prompt-toolkit / pyvim

Pure Python Vim clone.
BSD 3-Clause "New" or "Revised" License
2.52k stars 161 forks source link

switching between splits not working #25

Open lunemec opened 9 years ago

lunemec commented 9 years ago

Vim has shortcut for switching between vertical and horizontal splits:

ctrl+h/l or ctrl+left/right ctrl+j/k or ctrl+up/down

These seem to be missing.

lunemec commented 9 years ago

:bd should close the split where you're at with cursor. Also not working.

jonathanslenders commented 9 years ago

About control h/l/j/k/ or arrows. Are you sure that is default Vim behaviour? Or do you have some custom bindings in your .vimrc?

lunemec commented 9 years ago

Ohhhh, sorry, I've got it in my .vimrc

" set moving between windows to ctrl+arrows
nnoremap <silent> <C-Right> <c-w>l
nnoremap <silent> <C-Left> <c-w>h
nnoremap <silent> <C-Up> <c-w>k
nnoremap <silent> <C-Down> <c-w>j

" set moving between windows to ctrl+hjkl
noremap <silent> <C-l> <c-w>l
noremap <silent> <C-h> <c-w>h
noremap <silent> <C-k> <c-w>k
noremap <silent> <C-j> <c-w>j
lunemec commented 9 years ago

But, this is a nice feature to have, I'd suggest to have this as default ... I don't even know how to switch between the splits without it :)

lunemec commented 9 years ago

I only suggest this, because vim is kinda complicated to setup correctly and user-friendly. It took me few years to create working and usable .vimrc .. it depends on where you want to head with this project.

jonathanslenders commented 9 years ago

I'll think about it. I like the shortcuts. They are easy to implement. But maybe I'll put them in an extension.

e12e commented 9 years ago

It's right there in your vimrc: ctrl-w (window) hkjl... perhaps mapping arrows to hjkl might make sense, if that's not already done. Please don't remap "prime" shortcuts like ctrl-"key" by default - it gors against the principle of "least surprise" (and runs the risk of conflicting with eg: window manager (xmonad...)/os shortcuts)! :-)

e12e commented 9 years ago

*goes (sorry, silly cellphone touch keyboard)

lunemec commented 9 years ago

Ok, I agree with you, this may interfere with WM/OS shortcuts. The problem is, moving between splits in vim has no keybindings. It is by default done by :wincmd hjkl and that is terrible.

e12e commented 9 years ago

I'm not sure what you mean, ctrl-w hjkl is bound as standard in vim? Granted it's two commands, but works well enough as a standard binding?

See eg: http://vimcasts.org/episodes/working-with-windows/

lunemec commented 9 years ago

Oh, I didn't know about this one :) guess you learn every day :). Ok, these are just fine.

lunemec commented 9 years ago

But these - ctrl+w hjkl doesn't seem to work in pyvim yet.

jonathanslenders commented 9 years ago

Probably I will implement ControlW + hjkl.

dragon788 commented 7 years ago

You can also jump windows by calling :wincmd and the key corresponding to the action you want to take, ie :wincmd h would move the focus to a window to the left of where your cursor currently is located. This is painful but I learned it by trying to use Vim in a browser terminal emulator where Ctrl+W closes the dang tab!