Btw, zsh users can get an equivalent mode by putting `bindkey -v` in their zshrc, IIRC.
@vison3607 жыл бұрын
There is fish_vi_key_bindings for Fish shell too.
@leberkassemmel7 жыл бұрын
Daniel Lewan Nice! I like fish!
@jfkd28127 жыл бұрын
zsh doesn't use readline IIRC
@jamesrustler20757 жыл бұрын
What about the ultra hipsters of us that use Fish?
@spikespiangel6 жыл бұрын
by default bash is in emacs mode which is "set -o emacs" try some emacs command to navigate your command line
@BillSteinhauser Жыл бұрын
Nice description of "set -o vi" cmd line editing Luke... Korn shell was the first Unix shell to have "vi" style editing on the command line, from the latter 1980s. The bourne shell did Not have command line editing at all... you just had to backspace and retype if you needed to change/correct anything before pressing enter. I have been using unix+ksh+shell since before bash shell or Linux existed. The command line editing features from Ksh were re-written & added to bash shell using library code called "readline" to make bash shell nicer to use. The reason you find command line editing when using "sh" on Linux, is that /bin/sh on Linux is actually running /bin/bash binary executable (via fs link) with a Bourne compatibility mode, but "readline" is still active. Some vim key editing combinations are not available, like "ciw" or "ca)" because command line editing supports the original "vi" editing features from about 1977, and not "vim" features from around 1998. When you type the "bind -P" command, you are getting a response back from the readline library code used by bash. (just to clarify some shell history, and details on command line edit functionality)
@harshallele83097 жыл бұрын
Thanks for showing all the vim commands that I didn't know about. I basically use vim like I use nano. I don't know most of the features, I just use it to convince myself that I'm cool
@tibfulv7 жыл бұрын
Nano has features? :D
@harshallele83097 жыл бұрын
Well, so speaking of vim, I updated vim on my raspberry pi just now, and now it segfaults lol
@tibfulv7 жыл бұрын
+Harshal Lele Copy the current version to your home directory, and install its sources. Then install the previous version so you have a usable vim. Now you can see why it segfaults with _gdb_ or one of the IDEs. Especially if you got the core file. Cool project if you know C/C++ or want to learn. I fixed vixie-cron that way twenty years ago.
@harshallele83097 жыл бұрын
Hmm, i actually do know basic C++, but yeah, can't really be bothered. But thanks for reminding me about the downgrade, had the previous version in the pacman cache
@jonathanwarner18446 жыл бұрын
Nano is cool?
@tttt-tj4rg7 жыл бұрын
you can enable the mode globally, meaning not just for the bash shell but also for the other programs using the readline library such as mysql command-lineutility, in /etc/inputrc configuration file
@danilodistefanis59902 жыл бұрын
Which mode? Set -o vi ? Also zsh will take it ?
@djamison9r6 жыл бұрын
I have been using vi / vim for a month or so now and just the other day, I was wishing I could use vi commands on the command line... and then I found this video... YES!!! Thanks.
@mattlawyer32456 жыл бұрын
This was amazing! I've heard of this before but never bothered looking into how to do it. Thanks a ton!
@germangb87527 жыл бұрын
I pressed V and I'm able to edit the current command inside of Vim. woah
@loarto7 жыл бұрын
Goddamn was going to say this.... something I use occationally :)
@davidh.49444 жыл бұрын
You can give yourself a visual representation of which mode you are in by adding the following to your inputrc. The given character string will appear in front of your $PS1 prompt. personally use the circle-i and circle-c unicode characters myself, but you can get creative. set vi-ins-mode-string "Ⓘ " set vi-cmd-mode-string "Ⓒ " If you want to enable it only in bash, use bind in your bashrc to set the same line. Notice the quoting. bind 'set vi-ins-mode-string "Ⓘ "' bind 'set vi-cmd-mode-string "Ⓒ "'
@pcfreak19927 жыл бұрын
I knew vi-mode in zsh, but I still always used bash. Great to see that this exists in bash too. :D
@Zaurthur7 жыл бұрын
That's amazing! I can't wait to try this.
@oefzdegoeggl7 жыл бұрын
you should mention that this kills CTRL+L to clear the screnn. to get it back, add this to .bashrc: bind -m vi-insert "\C-l":clear-screen
@Neonb886 жыл бұрын
Is there a way to remap so I don't have to move my hands all the time?
@calleha015 жыл бұрын
It's because CTRL+L is an emacs command, and bash uses emacs mode as its default editing mode.
@alexanderkuznetsov75975 жыл бұрын
@@Neonb88 you can also use "Ctrl + [" to go into normal mode just like "Esc" does
@raktom4 жыл бұрын
Instead of this binding hit ESC or Ctrl+[ to get to normal mode (still in bash vi-mode) and then Ctrl+L to clear screen
@statuschannel85723 жыл бұрын
no thanks, I usually type "clear" and it does the work
@gavinvales89286 жыл бұрын
i watched this a while back and thought i didn't need it. but now, nearly a year later, i do.
@soham75103 жыл бұрын
Same
@SamSam-df4xp5 жыл бұрын
Everyday learning from you Luke!!! Thanks.
@craterface124 жыл бұрын
Your channel has opened my eyes to so many things This was built into fish shell and I never knew
@rednight24766 жыл бұрын
Bash is clone of ksh that's about 20 times more blated with a bad case of creeping-feature-itus. vi mode is the default in Unix ksh and can be changed to emacs mode with set -o emacs. It's command set is pretty much the same as actual vi.
@lolisamurai7 жыл бұрын
btw busybox's shell supports this as well by recompiling it with CONFIG_FEATURE_EDITING_VI enabled and setting the same vi option
@geoptus6 жыл бұрын
Does anyone know if there's an equivalent for 'insert last argument' - \e. - while in vi mode? it's definitely not in the bind lists of either 'insert' or 'normal' modes
@vmisev6 жыл бұрын
This is what I have in my '~/.inputrc' and that puts (left of prompt) nice green (c) for command mode and blue (i) for insert mode. imgur.com/DBUNmMw set editing-mode vi set show-mode-in-prompt on set vi-cmd-mode-string \1\e[32m\2(c)\1\e[0m\2 set vi-ins-mode-string \1\e[34m\2(i)\1\e[0m\2
@reformed_attempt_13 жыл бұрын
wtf only now I learned about ~/.inputrc file Thanks
@giobot7 жыл бұрын
2:57 bbw ;)))))))))))))
@LukeSmithxyz7 жыл бұрын
FATT
@mrinfernodude17 жыл бұрын
Christmas came 8 days early this year!
@tactical_shift7 жыл бұрын
was using bash vi for quite a while, then after looking for a way to show the current mode, i found zsh, added a few lines from stack overflow and never had to look back ever since
@Awwe126752 жыл бұрын
I’m not speaking English language This video is the bast video for me I use vim more one year I don’t have any idea about vi on all my system This video changed my mind for every 👏🏻 thank you bro
@103-krithickumarub64 жыл бұрын
is there a way to change the bindings?
@MrChozo4 жыл бұрын
You had (have?) a real Cypher-from-the-Matrix-Joe-Pantoliano-eating-a-steak thing going on here, and you were (are?) killing it, my dude. Good video, useful stuff.
@finndriver10637 жыл бұрын
Wondering if you have ever used fish? It also has a vi-mode and some pretty cool features right out of the box.
@LukeSmithxyz7 жыл бұрын
I've tried fish and I especially like some features like abbreviations, but fish takes way to long to load for me to use it comfortably.
@magnusphilosophus5064 жыл бұрын
Soo, I have dvorak and how can I configure it?
@jonesbbq3073 жыл бұрын
Longest command I have ever typed: four words. Me: I need to use Vim mode to speed up my terminal.
@hejhog19617 жыл бұрын
FYI this works also in Bourne and Korn shells in Unix - it was ported over from Unix to Linux Bash shell.
@BillSteinhauser Жыл бұрын
Korn shell was the first Unix shell to have "vi" style editing on the command line, in latter 1980s. The bourne shell did Not have command line editing at all... you just had to backspace and retype if you needed to change/correct anything before pressing enter. I have been using unix+ksh+shell since before bash shell or Linux existed. The command line editing features from Ksh were re-written & added to bash shell using library code called "readline" to make bash shell nicer to use. The reason that you find command line editing when using "sh" on Linux, is that /bin/sh on Linux is actually running /bin/bash binary executable with a Bourne compatibility mode setting, but "readline" is still active. The reason that some vim key editing combinations are not available, like "ciw" or "ca)" is that command line editing supports the original "vi" editing features from about 1977, and not "vim" features from around 1998. When you type the "bind -P" command, you are getting a response back from the readline library code used by bash. (just to clarify some shell history, and details on command line edit functionality)
@kid-vf4lu6 жыл бұрын
Is there a way to navigate into the whatever you `cat` or `ls` for copying in vim-mode?
@jamieg24273 жыл бұрын
my life suddenly improved so much. i've been wishing for this forever
@VaclavKosar6 жыл бұрын
I cannot find Command-Mode. Is it available? Except for "v" which switches to full vim?
@atimholt4 жыл бұрын
Didn't even mention “`v`”, which will literally take you into Vim to edit the current contents of the command line (i.e. what you’ve typed so far, or “↑/↓/j/k”'d to). Save and exit to run the command (ZZ in normal mode).
@davidh.49444 жыл бұрын
Specifically, 'v' opens the current readline in your default $EDITOR. The option is available in emacs mode too, under a different binding. I forget what it is.
@eduardojreis4 жыл бұрын
Wow. It changed my life (as a computer user)
@amosnimos3 жыл бұрын
was about time KZbin recommend me this video!
@rafaelmartineztomas49112 жыл бұрын
Use tmux you got vi mode and can copy paste any line of the ouput
@Sun-po4zv7 жыл бұрын
What window manager thing is that? How does it work???
@zlovredniyTip6 жыл бұрын
how do you make your desktop panel like this?
@ReneKnuvers74rk5 жыл бұрын
Is there a vi-mode in st?
@magnusanderson66814 жыл бұрын
I'm not sure exactly why this is but it seems that bash is the one that controls the keyboard shortcuts for the command line, not st. So this works in theory on any terminal emulator
@alexstone6916 жыл бұрын
is there set -o neovim
@saeidsaati40216 жыл бұрын
Thanks for the video, can you show how I can change the Esc to jk here in bash ? is it possible here ?
@Sumguy217 жыл бұрын
Thanks, luke. Great video!
@uncle_esau4 жыл бұрын
Yeah but what about bash mode in vi
@MrMhornberger6 жыл бұрын
To get around the lack of, say, yi" or ci], you can hit ctrl-x-e and it'll open up that entire command line in vim itself.
@LukeSmithxyz6 жыл бұрын
That's in emacs mode though. In vi mode it's just v in normal mode.
@tarasywszedzie7 жыл бұрын
What have you done to DIO, Luke? :I
@AhmedKhaled-sj1zx7 жыл бұрын
what is DIO?
@LukeSmithxyz7 жыл бұрын
That's DIO-sama to you.
@rexevan67147 жыл бұрын
KONO DIO DA !!
@AhmedKhaled-sj1zx4 жыл бұрын
@@abdulwahabjag thnx for replying. Didn't watch that Anime
@jantoth46993 жыл бұрын
Great video, guys do you think that we will see sometime in future features like ci", vi", ya(
@yussefakl87314 жыл бұрын
Hey Luke! I’m a bit late seeing this :D when I compile code and get errors usually the compile output is several times the terminal output screen and I want to scroll to see what happened. How do I do that with vim bindings?
@jasonxoc5 жыл бұрын
Well this blows my mind. Been using bash for over 20 years and never knew this. You should put it in your bash_profile though, not your bashrc... profile is for shell, bashrc is loaded any time bash is loaded... like running commands from ssh.
@8cyl6speed6 жыл бұрын
How did you get that pdf preview thing in your bash
@rochr46 жыл бұрын
Ranger, FM with vi like bindings.
@michalski91412 жыл бұрын
line completion mode using your bash history would be nice
@MrHatoi6 жыл бұрын
Ironically, this is actually the way I found out about Vim to begin with.
@Mawkler7 жыл бұрын
What's in his terminal in the very beginning of the video? Looks sorta like a file browser. Is it a tmux plugin?
@gz66167 жыл бұрын
that is ranger, a terminal file manager
@FH-ux4rf6 жыл бұрын
Hi Luke Smith. I just gave LARBS a shot, and well, I'm not experienced with VIM at all so I'm struggling a bit, but from what I can tell, it is amazingly well made! So many props to you. The whole thing, from design, to functionality, to ease of installation is just amazing! However, I noticed one thing and I tried to look it up in your nifty help document, but without luck. This video as well as a few others can be opened within the i3WM with the super + shift +e command, which is so cool, but at least on my setup the audio is unbearable. I'm guessing it's a missing codec or something, but I have no idea how to find out what is causing it. Do you (or anyone reading this) have any idea what could be causing the poor audio quality on these "internal" videos?
@calmarcalmar7 жыл бұрын
I have these in .inputrc (since thousand years) set editing-mode vi set keymap vi So maybe I try out that "set -o vi" .. .seems to be pretty equivalent.. not sure so.
@noscreadur Жыл бұрын
It was there all along! I have been a ghost in a world of half arsed bindings. I set -o vi, and I am born whole at last!
@grahamjoss46434 жыл бұрын
that a great tip. thanks for sharing.
@TroyFletcherKeyboards6 жыл бұрын
I liked this, but since it didn't run my bashrc I was kind of meh. I prefer Ctrl+x,Ctrl+e. Opens a proper vim session (if you've 'export EDITOR=vim' otherwise pico) and lets you set up multiple commands. Executes on save and close. Though I would prefer to see the current session command history in it. Otherwise, super comfy. :)
@LukeSmithxyz6 жыл бұрын
The ctrl-x ctrl-e in emacs mode exists in vi mode as well: just press v while in "normal".
@rohanghige5 жыл бұрын
Amazing video. Does it exist in cshell also. What is command for it. Can you make video for set-up of screen-key.
@Christopher-ew7jw4 жыл бұрын
You are my hero.
@davidjacobs73087 жыл бұрын
Can I do more than 1 :+1 ?
@MrSushant37 жыл бұрын
I always wondered there must be some plugin out there for this, and here I find this. 😻
@fubukimaru6 жыл бұрын
WOW MAN. WOW. The other day I was thinking about this feature. Thanks for your video!
@christianlarsen2404 Жыл бұрын
Gamechanging. Thank you for this gift.
@MarekKowalczyk6 жыл бұрын
Excellent stuff! I've had the same problem, twisting my fingers in bash. BTW, is the bashrc you're using on your GitHub?
@svenwindpassinger21706 жыл бұрын
super tip! thx!
@VictorRodriguez-zp2do6 жыл бұрын
Use athame it gives you the full vim experience and it even work with vim plugins
@gz66167 жыл бұрын
But this disables the Ctrl+L short cut for clear screen.
@MrSushant37 жыл бұрын
i don't mind typing *clear* for this feature 😊
@magnusanderson66814 жыл бұрын
I'm only a couple days late but run bind -m vi-insert '"\C-l": clear-screen' and it sets up the keybinding - so put that in your bashrc. Also by default ctrl-l clears in normal vi mode, just not insert. Use help bind and then bind -p (lowercase)
@somebodyoncetoldme17042 жыл бұрын
Yiw doesn't work :(
@0felex017 жыл бұрын
Mind sharing that wallpaper?
@ne6totapo4 жыл бұрын
www.pinterest.es/pin/74590937551754212/
@zenist697 жыл бұрын
The wallpaper its cool. Where is it from? Movie, game?
@ploutosroman42066 жыл бұрын
www.toca-ch.com/data/walls/120/25421037.jpg
@ne6totapo4 жыл бұрын
link above is dead www.pinterest.es/pin/74590937551754212/
@seneketh3 жыл бұрын
Thank you so much!!!!!!!
@b0nes954 жыл бұрын
I saw you press CTRL + L I assume that stopped working when using Vi mode? ^^
@davidh.49444 жыл бұрын
Most of the major default emacs bindings remain available. Only the ones specific to vi-mode are changed. Of course you can always manually override any of them with bind or your inputrc.
@hassanshabbir82547 жыл бұрын
Also check out github.com/ardagnir/athame which runs an actual vim session in the terminal.
@bananmanx47647 жыл бұрын
Was a bit annoyed that you could not tell if you were in insert mode or in normal mode with this so I looked up a solution for that online. check the first answer here: stackoverflow.com/questions/1039713/different-bash-prompt-for-different-vi-editing-mode If you have trouble editting the file also check this: stackoverflow.com/questions/8253362/etc-apt-sources-list-e212-cant-open-file-for-writing in short: go to /etc/inputrc and add "set show-mode-in-prompt on"
@marauderinchief68586 жыл бұрын
That wallpaper... WOW..
@AndyRufasto5 жыл бұрын
I can't use Ctrl+L to clear :(
@magnusanderson66814 жыл бұрын
This is the only sad but I need to try to find a way to re enable it I imagine it is possible EDIT: figured it out. Run bind -m vi-insert '"\C-l": clear-screen' and it sets up the keybinding - so put that in your bashrc. Also by default ctrl-l clears in normal vi mode, just not insert. Learned by using help bind and then bind -p (lowercase)
@drewberchtolzthofen886 Жыл бұрын
4:48 works for zsh users hehe
@RS-hg3rp6 жыл бұрын
love u chan, more terminal arch linux stuff ;)
@amirul2647 жыл бұрын
Thanks, is like a dream come true lol.
@openfrom033 жыл бұрын
thank you)
@daffybox7 жыл бұрын
let me get that wallpaper bru
@ne6totapo4 жыл бұрын
www.pinterest.es/pin/74590937551754212/
@MarkBlakeney6 жыл бұрын
Adding "set -o vi" to your bash config is not the optimum way to do this! See www.reddit.com/r/vim/comments/8j589n/til_bash_ships_with_a_vi_mode/dyxh0dc/
@8sync7357 жыл бұрын
Perturbator. Kudos.
@aarav38907 жыл бұрын
first thing I noticed too
@H32-u7d7 жыл бұрын
Holy shit my mind is blown
@Robert-dB6 жыл бұрын
Personally I've always found VI mode on the command line an evil hack ... like evim! I use emacs mode as a pico/nano mode but bind a couple of real keys to different functions. eg: Ctrl-Left/Right move by words and most importantly Insert is bound to "edit-and-execute-command" that way one keypress gets me into the _real_ VIM. (If slumming ^X^E gets you $EDITOR, but that's 3 or 4 presses)
@DrathVader7 жыл бұрын
Pls share the wallpaper, senpai, I need it for my rice.
@ne6totapo4 жыл бұрын
a bit late www.pinterest.es/pin/74590937551754212/
@Cheng322905 жыл бұрын
Love videos about VIM tips, thank you so much
@danplt3 жыл бұрын
Vi editing is part of POSIX sh.
@ИванКалашников-ц8л7 жыл бұрын
nice cell luke o.0
@LukeSmithxyz7 жыл бұрын
my warden doesn't allow anime posters
@xtdycxtfuv93534 жыл бұрын
DIO!!!
@sharperguy5 жыл бұрын
Funny I knew about this for a few years because I tried it and didn't like it. Just started again last week and I can never go back now.
@breakername99956 жыл бұрын
thankyouuuuu
@MixterFox7 жыл бұрын
I use vi mode all the time in zsh.
@possumcode6 жыл бұрын
Coooooool
@marianoforti17376 жыл бұрын
I have a serious problem with your videos. I cant stop watching. I need to go back to work. I found about vi mode in bash recently too. now I want vi mode everything.
@DraganAlves6 жыл бұрын
Mind blown
@HansPeter-qg2vc7 жыл бұрын
Pfff, always those vim users using vim commands in bash whilst Emacs users use bash in Emacs.
@calmarcalmar7 жыл бұрын
Maybe .. who knows what you know or not: one of the very very useful commans in bash.. is Ctrl-r xxx I use this.. very very often.. where xxx is the a search-thing... until you find your command in the histroy. with Ctrl-r.. again.. the next will arrive i.e: Ctrl-r ssh Ctrl-r Ctrl-r Ctrl-r enter. this will select the 3rd last ssh..... command in history
@rochr46 жыл бұрын
Try fzf or hstr.
@markcuello52 жыл бұрын
Help me
@joao_lubien6 жыл бұрын
Dio thumb? Instasub
@francoisgervais14 жыл бұрын
I was like, would be so nice to move through my command with h and l just like in vi... casually browsing for a solution and then.. THERE IS AN ACTUAL VI MODE???