Deleting buffer without losing the split window
Hi all, I'm just curious how do you guys handle this case? I often have screen split with a couple of buffers and when I delete one of them, split got messed up. Vim have one cool trick for this: ':bp|bd #' and evil will only execute ':bp' part. Is it hard to add similar feature (this looks to me like piping the commands) or Emacs has something better under the belt? Regards, Sanel
You mean `*\C-xk*` would mess up the split window as well? In my case, another window would replace the killed window. I feel that evil does so little support for the window operations. For instance, the `Ctrl-w_v` in vim has not been emulated yet(the key is binded with `split-window-right`, which is defined in window.el). Everything goes all right until I have to split more windows with `Ctrl-w_v` and `Ctrl-w_s`, the size of the windows are now adjusted properly. Also evil has no support for multiple tabs, so we have to use other screen extensions like escreen/elscreen in Emacs and make some keybindings. Hongxu Chen On Fri, Mar 8, 2013 at 6:05 PM, Sanel Zukan <[email protected]> wrote:
Hi all,
I'm just curious how do you guys handle this case? I often have screen split with a couple of buffers and when I delete one of them, split got messed up.
Vim have one cool trick for this: ':bp|bd #' and evil will only execute ':bp' part. Is it hard to add similar feature (this looks to me like piping the commands) or Emacs has something better under the belt?
Regards, Sanel
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
On 2013-03-08, Hongxu Chen <[email protected]> wrote:
You mean `*\C-xk*` would mess up the split window as well? In my case, another window would replace the killed window.
I feel that evil does so little support for the window operations. For instance, the `Ctrl-w_v` in vim has not been emulated yet(the key is binded with `split-window-right`, which is defined in window.el). Everything goes all right until I have to split more windows with `Ctrl-w_v` and `Ctrl-w_s`, the size of the windows are now adjusted properly.
Hm, you're right, adjusting the windows sizes may be useful. I've always found the current behaviour, well, suboptimal, but I've always been too lazy to fix. And nobody else complained ... Maybe it's time to file a feature request ... ?
Also evil has no support for multiple tabs, so we have to use other screen extensions like escreen/elscreen in Emacs and make some keybindings.
It is very unlikely that Evil will ever support multiple tabs. The reason is that this is a feature of the environment (i.e. Emacs in this case) and has nothing to do with editing. Some people like elscreen, others might prefer tabbar-mode. But it any case, dealing with buffers, windows or tabs is different in Emacs than in Vim (e.g. buffers do not have numbers) and is something that another package should do. Then it should not be too difficult to provide appropriate key bindings for Evil, possibly as an additional plugin like `evil-elscreen.el` or something else. Adding tabs to evil would mean a lot of additional work, and it would mean to copy (more or less) what has already been implemented in other packages. Best regards, Frank
2013-03-08 10:05 Sanel Zukan:
I'm just curious how do you guys handle this case? I often have screen split with a couple of buffers and when I delete one of them, split got messed up.
Interesting, and thanks for pointing out that vim trick to work around it. I have just got so used to this annoyance (in vim, that is). In evil I had been using Emacs-style C-x k anyway, which doesn't have this problem.
Vim have one cool trick for this: ':bp|bd #' and evil will only execute ':bp' part. Is it hard to add similar feature (this looks to me like piping the commands) or Emacs has something better under the belt?
The pipe is somewhat misleading; here's what the vim help says: --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- '|' can be used to separate commands, so you can give multiple commands in one line. If you want to use '|' in an argument, precede it with '\'. --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- %< --- Cheers, Christoph -- Christoph Lange, http://www.facebook.com/ch.lange, Skype duke4701
On 2013-03-08, Sanel Zukan <[email protected]> wrote:
Hi all,
I'm just curious how do you guys handle this case? I often have screen split with a couple of buffers and when I delete one of them, split got messed up.
Vim have one cool trick for this: ':bp|bd #' and evil will only execute ':bp' part. Is it hard to add similar feature (this looks to me like piping the commands) or Emacs has something better under the belt?
The simplest approach is probably (evil-ex-define-cmd "bd[elete]" 'kill-buffer) i.e. the same C-x k. A little bit more sophisticated is (evil-define-command evil-delete-buffer-keep-windows (buffer &optional bang) (interactive "<b><!>") (with-current-buffer (or buffer (current-buffer)) (when bang (set-buffer-modified-p nil) (dolist (process (process-list)) (when (eq (process-buffer process) (current-buffer)) (set-process-query-on-exit-flag process nil)))) (if (and (fboundp 'server-edit) (boundp 'server-buffer-clients) server-buffer-clients) (server-edit) (kill-buffer nil)))) (evil-ex-define-cmd "bd[elete]" 'evil-delete-buffer-keep-windows) This function is exactly the same as `evil-delete-buffer` with the code that closes the windows deleted. Maybe we could add another parameter that determines whether the windows should be closed and defaults to some customization option. Frank
participants (4)
-
Christoph LANGE -
Frank Fischer -
Hongxu Chen -
Sanel Zukan