6 ms·
Maybe it's just me, but as an Emacs user since 1988, I've often found that the commands there were composable (to use the author's term), but in a different way
by reuven 12y ago
Maybe it's just me, but as an Emacs user since 1988, I've often found that the commands there were composable (to use the author's term), but in a different ways. I can kill to the end of a line (C-k), sentence (M-k), or sexp (C-M-k). And if I want to do it more than one time, I use the prefix argument.
I realize that Emacs and vi are different in many ways. And despite my love for Emacs, it's obviously not everyone's cup of tea. But if the argument here is that vi's keystrokes are such that learning one lets you learn many others, I think that the default keybindings in Emacs actually do a pretty good job on this front, once you get over the (admittedly very high) learning curve.
- agumonkey 12y agoThat's not 'real' composability. In Emacs, each keybindings (C-k M-k C-M-k) will run a different elisp function. They just decorated a single key with control ones. In vi 'd' is one operation that takes a 'region' (line, word, char,...). Whatever the region, 'd' will always be a single piece of code. The irony is that lisp being heavily function based, often orients toward composability in code, but that didn't translate into emacs keybindings at the time.
- lispm 12y agoEmacs. c-w will kill the active region.
- agumonkey 12y agoIrrelevant, they're still separate logic for each kind of kill. See: 10 matches for "^(defun kill-" in buffer: simple.el.gz 3218:(defun kill-new (string &optional replace yank-handler) 3270:(defun kill-append (string before-p &optional yank-handler) 3340:(defun kill-region (beg end &optional yank-handler) 3411:(defun kill-ring-save (beg end) 3605:(defun kill-forward-chars (arg) 3611:(defun kill-backward-chars (arg) 3679:(defun kill-line (&optional arg) 3734:(defun kill-whole-line (&optional arg) 5049:(defun kill-visual-line (&optional arg) 5354:(defun kill-word (arg) Vi as one notion of deletion that is parameterized by a region(or movement in vi slang I believe), which is bound to a set of keys.
- lispm 12y agoIt's not irrelevant. For most uses, mark the point, move, kill-region. I vastly prefer doing operations over explicit regions, instead of composing editing operations as in vi. Especially since this maps better to other forms of editing.
- bluetech 12y agovim allows you to select a region and operate on it. It sometimes necessary, but in practice, people use the compositional commands. They are faster and mentally easier. So empirically it seems your preference is different than most. Also, what do you mean, maps better to other forms of editing?
- Gravityloss 12y agoI think you're getting close to some important points. I think Sublime Text's multiple-cursor editing is nice because I can see where the focus is and get immediate feedback, much better than "replace-all" even if the end result would be the same. Bret Victor style. So most of the real complexity in the interface is about region-selection, and the operations are actually trivial. Of course, you need to first select regions (like interesting lines), then select other regions within those, others within those etc. How to chain it all in a natural way?
- agumonkey 12y agoThe multiple-cursor is a nice blend between stateful things like regexp-replace and the purely stateless isolated ones likes vi :s/foo/bar/g Sometimes you want feedback without leaving the declarative paradigm.
- pmoriarty 12y agoBoth vim and emacs have multiple-cursor plugins.[1][2][3] [1] - http://www.vim.org/scripts/script.php?script_id=4523 http://www.vim.org/scripts/script.php?script_id=4523 [2] - http://emacsrocks.com/e13.html http://emacsrocks.com/e13.html [3] - https://github.com/magnars/multiple-cursors.el https://github.com/magnars/multiple-cursors.el
- swah 12y agoMine is the pain of loving emacs and not using because of wrist pain.