7 ms·
Athame – Full vim for bash and readline
- ah- 12y agoLooks interesting, how does it actually work? I'm quite surprised to see the --INSERT-- in the bottom left all the time. Also, ctrl-x-e
- a3n 12y agoNice. But full vi has been available from the cl with readline for a long time. Not quite as nice as athame, but very easy and serviceable. If you are in vi mode (set -o vi, or your .inputrc is so configured), then on the command line press esc to get out of insert mode and into normal mode, then type v. A full vim editor will open in the terminal, with whatever you've typed so far. Edit, :wq to execute the command. Delete the whole buffer and :wq if you don't want to execute anything. This won't work anywhere but the cl I don't think, so the bit about python in athame is nice.
- finnh 12y ago"v" just opens your $EDITOR, btw, not necessarily vim-in-terminal. It's basically the same as the bash built-in "fc" command, but operates on the current line instead of the last one.
- dllthomas 12y agoInterestingly, the readline command "edit-and-execute-command" does what it says on the tin (by recourse to fc) even if you're in a context where the line wouldn't usually be executed. If you try prompting for filenames with the read builtin, and turn on readline (-e) to get completions, and hit v (or, in emacs mode, C-x C-e) to open your editor, when you leave your editor it will execute whatever you typed as a line of bash. Unexpected.
- ZeroGravitas 12y agoOoh, thank you! That's exactly what I've been looking for. Basically the only time I feel the need for vi editing powers in bash is when one (or more) long complicated commands need edited and this fills that gap nicely. One of the Google results that most succinctly summed up what this command can do: http://htks.kylemilnes.com/2012/07/bash-fc-fix-command-cheatsheet.html http://htks.kylemilnes.com/2012/07/bash-fc-fix-command-cheat...
- motoboi 12y agoTo get deadline support on command-line programs that don't, one can use rlwrap. Ex: rlwrap openssl s_client -connect IMAP.google.com:993 rlwrap telnet google.com 443
- voltagex_ 12y agoI guessed that rlwrap used an LD_PRELOAD trick but a cursory glance at the source shows that it's much more complex. Can anyone explain? This might be worthy of its own HN post.
- tlb 12y agorlwrap just pipes terminal I/O through itself. It doesn't change anything about the child process except where stdin comes from.
- 4ydx 12y agoWow this is pure gold. I cannot understand why I have never run across this until now. Thank you for pointing this out!
- a3n 12y agoLike so many things, I found that by accident. I also found editing you command and search history in vim by accident. :q will quit the editor. q: will open a buffer with a history of your vim commands, which are navigable and editable. Edit a command, then enter and it's executed. In command history edit mode, :q to exit that mode. q/ works for searches.
- emidln 12y agoYes and no. readline's vi support is missing a bunch of random stuff. The thing that tends to irk me the most is the lack of the normal mode: ge This goes to the end of the previous word. There are other things, but I use this quite a bit and when it's not there, I become temporarily jarred trying to figure out if I'm mistyping.
- a3n 12y agoYou and I are talking about two different things. You're talking about command line editing, on the command line. And you're right, ge doesn't work there. vi mode at the command line is a small subset of vi. The next time you want to use ge or any other full vim feature, try this instead: - esc, to get into normal mode. - the single character 'v' (no quotes), to open a full vi (or vim, or $EDITOR). - the vim session will have your command line so far. - edit with the full power of vim or whatever opened. - :wq to execute the command. - or empty the buffer and then :wq to not execute anything.
- krick 12y agoLooks cool, but I doubt I'll use it: switching between modes when using shell isn't very comfy. Actually, every time when I see "vim-mode in <something>" (like shell, IPython Notebook) I wish for the opposite: <something> in vim. But stuff like Emacs or even Atom seems to be more flexible for that purpose, usually all these "<something> in vim" don't really work (or even couldn't be implemented due to inability to show graphics inside the vim (gvim) window). It's a shame.
- hammerandtongs 12y agoFrom my experience with people and their vim knowledge, not "set -o vi" on their shell is what holds them back from becoming truly good at vim. Yes it's uncomfortable but that's most likely a result of a person's disfluency in vim itself. If you are having problems with vi in bash its likely that you aren't using w W b B cw dw D a A regularly in vim either.
- sevensor 12y agoI found that I just couldn't get used to `set -o vi`, despite using vim exclusively for editing. I think my muscle memory for bash was too well-developed by the time I found out about `set -o vi`.
- krick 12y agoI guess I'm pretty damn fluent in vim. But I use emacs-style shortcuts in shell and don't imagine why I would ever switch.
- hammerandtongs 12y agoBecause esc-b esc-b esc-b is much more painful then esc b b b
- blux 12y agoI agree. Neovim brings promises to improve this situation drastically by separating the presentation logic from the editor core functionality, more easily allowing for embedding Vim functionality in 3rd party applications.
- Crito 12y agoI see this is using the +clientserver functionality of Vim. Is there any chance that this could be reimplemented using neovim's "vim as a library" functionality? Is that part of neovim ready yet? I ask because I've had +clientserver give me hassle in the past. Sometimes it seems to just not work for no apparent reason.
- blux 12y agoYes, seems like an excellent candidate application for that. By the way, what hassles did you experience with +clientserver? I use +clientserver by default for various reasons and it works flawlessly.
- Crito 12y agoI used to have an alias for `vim --remote` so that I could easily open files from the commandline in a permanently running gvim session. Usually it would work, but sometimes it would just do nothing and not print any sort of error. I guess I was probably doing something wrong, but I didn't really dig into it that much. After a while I just decided I liked vim in the terminal more anyway.
- weinzierl 12y agoWhat I really want is: "Full vim in the browser". I use "It's all text" which is good, but it's still only a crutch.
- blux 12y agoFrom the same author: https://github.com/ardagnir/pterosaur https://github.com/ardagnir/pterosaur
- otoburb 12y agoVimperator for Firefox[1] and Vrome for Chrome[2] try to fulfill this ideal without changing the current browsing experience too much. You should give them a try. They are very refreshing and may be what you're looking for beyond "It's all text" 'vim-in-textareas-only' functionality. [1] https://addons.mozilla.org/en-us/firefox/addon/vimperator/ https://addons.mozilla.org/en-us/firefox/addon/vimperator/ [2] https://chrome.google.com/webstore/detail/vrome/godjoomfiimiddapohpmfklhgmbfffjj?hl=en-US https://chrome.google.com/webstore/detail/vrome/godjoomfiimi...
- toolz 12y agopentadactyl is the best vim in browser experience I've had. Hands down better than vimperator and vimium last I've used them.
- greggyb 12y agoI use cVim on Chrome for all of my work computers, and DWB[0] on my personal (Linux) computer. DWB is the best in-browser Vim experience I've had, and quite light on resources in my experience. [0]http://portix.bitbucket.org/dwb/ http://portix.bitbucket.org/dwb/
- waitingkuo 12y agoI want "Full vim in gmail" Every time when I want to move the cursor in the browser's editor, I type esc and then hjkl...
- jbermudes 12y agoNow that vim is on github, I think it'd be cool if eventually the vim logic/model could be abstracted into a library that could then be used by any text editor to instantly provide the basic vim experience without all the edge cases that current reproductions tend to have.
- lugg 12y agoIt'd be cool to see native vim commands for browsing / email clients etc, not sure of the point behind adding it to a text editor. Seems like a good way to lose users to the real thing in a slow hurry.
- MetaCosm 12y agohttp://www.vimperator.org/vimperator http://www.vimperator.org/vimperator / http://www.vimperator.org/muttator http://www.vimperator.org/muttator
- finder83 12y agoneovim is trying to do just that via libuv -- https://github.com/neovim/neovim https://github.com/neovim/neovim
- dennyabraham 12y agoHonestly that's the most exciting part of neovim, but with the current milestone (https://github.com/neovim/neovim/milestones/libnvim https://github.com/neovim/neovim/milestones/libnvim), libnvim might be a few seasons away
- pwr 12y agoLooks good. Unfortunately nothing changed (neither in bash nor python repl) after i installed it. I followed the installation steps 1-3 on Ubuntu 14.04. Does anyone know what i'm missing?
- rhgraysonii 12y agoI'm having the exact same issue. Using ubuntu 14.04, zsh.