Sometimes jumping in to the cold water is the easiest way to go about something. I literally began my Linux journey by installing Arch and then uninstalling Windows after previously having been contemplating about doing so for an entire year. Ig Linux is pretty easy once you get the hang of it and Arch imo has the advantage over other distros that it just works unless you do stupid things with it.
Instead of configuring vi mode in Bash you could configure for many programs at once using .inputrc, it's a configuration file for the GNU readline library which is used for text prompts in many CLI tools, not just Bash but also Python interactive shell, etc. There are a bunch of config options but the basic one is "set editing-mode vi" in .inputrc which applies it to all programs at once! (Zsh does not use .inputrc and I don't think Fish does either, but Bash definitely does)
I didn't know about alt+. and it seems super useful, can't wait to try it in practice. I wish someone compiled a list of quick wins like that. You can go for years without knowing that e.g. double click + drag selects text by full words. But I guess it would be hard to make such a list complete and avoid too much detail at the same time.
I've been using a lot of emacs bindings without knowing their origin. It is very nice to know such things and also be aware of options (like `set -o vi`) in order to change them. This will permanently influence how I work with the shell, thank you very much. Also I'm checking out the emacs video right now^^
In vi mode use '_' character in normal mode to get the last parameter of the last command. You can also use the numbers before to get the argument of the specific number.
CTRL-y is not really an undo. It's more like a paste command (which it is in Emacs). And CTRL-w, ALT-d, CTRL-k, and CTRL-u are more like cut commands. So you can actually move an argument or word around using these commands. For example, if you have $ echo word1 word2 and you press "CTRL-w ALT-b CTRL-y " you will get $ echo word2 word1
Yes! And if you press CTRL-y multiple times it will paste what was cut several times. This "undo" stuff was really confusing until I figure that out by trying to undo multiple times.
@@dragonsage6909 As far as I can tell, CTRL-t will swap only the last two CHARACTERS positions. if you use it with "echo word1 word2" you get "echo word1 wor2d"
A long time ago (though still in this galaxy), I used emacs. These days I'm a vim addict. But I tried vim keybindings for bash and ended up going back to the standard emacs ones.
Well hot damn, I've been working in the shell for more than a decade and didn't know that I could change to vi bindings, what an oversight. Also, just to take advantage of shells and fish in particular being discussed: don't be surprised if you change to fish and "!!" or "!$" don't work, that's apparently by design - a design I very much disagree with and why "plugin-bang-bang" is the first thing I install alongside fish. Call me oldskool, but "sudo !!" will probably forever be more ingrained in my mind rather than "[UP]->Ctrl+A->sudo "
Go to my GitLab and look in my Dotfiles repo.. Find my .config/fish/config.fish. There are two custom functions in there, one for "!!" and another for "!$". ;)
1. In macOS Terminal, in the options->Profile tab, enable the checkbox "Use Option as Meta key" to have this keybindings. 2. I just want to thank you for this content and channel, I though I knew how to use the terminal until I saw your content, which is like a glass of water in a desert.
I guess the macOS terminal has some settings that make it more usable, but I eventually switched to Kitty, much better experience. I think Alacritty is also available.
Thank you for covering this. I learned that stuff in school, but I had forgotten so much of it. And, being a Windows user mainly, kindof dumbs me down. I just use arrow keys & only few extras.
Good one, as always 🙂 Hey, DT! Recently, I find myself using a lot of regex in my nvim workflow (%s/...). Would you consider making a video on the topic?
For my keybindings, I've got home and end to go to the start and end of a line, Ctrl+{LArrow,RArrow} to navigate by words, Ctrl+Del to delete forward and Alt+Backspace to delete backwards. Though, I really don't do much line editing. I tend to just add to my .bashrc anything I keep typing repeatedly and occasionally if I need something temporarily I'll just create a function at the terminal. Sometimes I'll make a .sh file if I don't want it polluting the .bashrc but I need it multiple times, like starting up qemu instances.
Most useful setting is to enable Vi keybinding and the different modes in the shell. And on ZSH is even a plugin with extended support for Vim like key bindings and functionality in the shell.
I've not really done a whole lot of line editing with my commands, but I tried vi keybinding just now and it's certainly neat, but how do you tab complete backwards and forwards with it, and how do go up to edit a line without moving over to hit an arrow key?
Apart from the attention given to vi keybindings this was a great video. Mind you that quite a lot of appliances ( Cisco, Arista, Fortigate etc. etc. ) also use these key bindings, i.e. the EMACS key bindings 😋
Nice I usually use "$!" for the last argument retrieval in emacs mode .. "Alt ." is faster... indeed if you ever need to run commands with long arguments such as ffmpeg in the cmd line you will force yourself to learn these jump shortcuts
In Emacs mode ctrl-x ctrl-e opens an editor for the command line. There are times it is handy. It will use your system default editor or honor $EDITOR if set.
every time a vim user approaches me and tries to convince me how bad Emacs is, I ask back which shell he uses, and always it turns out it's Bash, and then I say "oh, well, you know Emacs keybindngs too!"
2 года назад
Nice video, thank you for that. Is there any key binding for scrolling?
hey DT! i recently broke my monitor by putting it on a paused bright RUclips video. it would be nice to make a video talking about the importance of screensavers, show xscreensaver and also add it to the DTOS script
Curious, will this work during a command line installer for say Arch or Gentoo? I'm always having to change a misspelled package when I'm installing all of my packages during an Arch install. Can I go back word by word and fix the error(s) using these keybindings?
Hey DT, completely unrelated to the video but I've always wondered, since PCManFM is your go-to GUI file manager, why don't you use it manage the desktop wallpaper in your WM sessions instead of using Nitrogen?
can you just manually change the keys? I would not mind getting standard copy paste working, as well as just nuking 90% of the other keys. I like arrow keys, ctrl_arrow keys for by word (I might just change that to begingin/ending of line), then I would like a clear all text key, normal copy paste. ESC could be whatever , stop I guess?
First and foremost, thank you very much for your videos!! Been a longtime Mint/Manjaro & Openbox user and your videos gave me the courage to jump toward vanilla Arch. Thanks to your various and in-depth info, I now have a customized AwesomeWM to my satisfaction and I am now setting the terminal to vi mode. I just finished updating my vimrc file and talk about perfect timing... probably nothing, but my 2 cents regarding 'clear' for clearing TERM screen....... =) I've been using an alias 'clr' for 30 years as my pseudo solution still same 3-stroke keys, visual confirmation, and works whether ur in emacs & vi mode. Once again, thank you very much for your hard works. Cheers,
Hey DT this is a great video because I discovered my bindings are messed up. ALT-f doesn't do anything while all the other keybindings work? Now I need to find the problem or else I'll be forced to use the arrow keys! SOMEBODY HELP!
The shell does not use your vim (or emacs) configs because you are not actually running Vim/Emacs. You're just running the shell, and the shell has its own config file (the .bashrc for instance, in bash). I'm pretty sure you could re-bind the command to go to normal mode from ESC to jj or anything else. In bash, you'd use the 'bind' command. Type 'bind' and hit TAB and you will see all of the possibilities. I think vi-movement-mode is the one you are looking for..
I use c-w, c-u every time, anybody knows if exist a command to clear all line in any position? Like Esc in Prompt Command of Windows. I don't know about Vi mode, is possible custom mapping?
Create a ~/.inputrc with this content $include /etc/inputrc # Configure Esc to clear line # "\e": kill-whole-linevi # vi mode "\e": kill-whole-line # emacs (default) mode
Moving or deleting by words is sometimes a little unpredictable, for instance it might be that dashes are considered a word boundary and underscores aren't. So, I sometimes fall back to moving/deleting by individual characters, which can be vastly improved by configuring your OS's key repeat settings. You can do that from your DE's settings UI or from the command line, for instance in Gnome you'd run: gsettings set org.gnome.desktop.peripherals.keyboard delay 250 gsettings set org.gnome.desktop.peripherals.keyboard repeat-interval 25 Bear in mind it affects everything, not just the terminal. But once you try it I don't think you'll want to go back.
I realise this is kinda necroposting, but I'm trying to learn all I can. In Kubuntu 24.04 using ZSH, CTRL+U is deleting the entire line of text, not just from the cursor back. Is this normal? Thanks.
@@utsupp1274 In our times, when we have google translate, the language in which we write to each other is not so important. I am Russian, so I wrote a comment in my language.
I would like to propose you a subject for your channel: Window Managers that run on Wayland! I know you already talked about Sway here, but I would like you to comment on others, like Wayfire, Hyprland, River, etc.That's if you can and when you can too...
Which is wierder, Ctrl + Y for undo or Ctrl + Z for undo.... For ctrl + z, I think it's a little more convenient because it is close to cut (ctrl + x), copy (ctrl + c) and paste (ctrl + v)
I've switched to vi mode for the key bindings... If you use vim as your text editor it only makes sense.... I can never remember the emacs bindings... They are not intuitive at all...
I was a Windows user 2 weeks ago; now an Arch user & if it wasn't for your vidz & the wiki... I'd probably still be using Windows. Merci 😌
Welcome to Linux! It's a deep rabbit hole. :D
@@DistroTube ohh yeah, I have much to learn but determined 🧠 💪
Sometimes jumping in to the cold water is the easiest way to go about something. I literally began my Linux journey by installing Arch and then uninstalling Windows after previously having been contemplating about doing so for an entire year. Ig Linux is pretty easy once you get the hang of it and Arch imo has the advantage over other distros that it just works unless you do stupid things with it.
@@pizzapizza1460 How's the learning going? :)
Instead of configuring vi mode in Bash you could configure for many programs at once using .inputrc, it's a configuration file for the GNU readline library which is used for text prompts in many CLI tools, not just Bash but also Python interactive shell, etc. There are a bunch of config options but the basic one is "set editing-mode vi" in .inputrc which applies it to all programs at once! (Zsh does not use .inputrc and I don't think Fish does either, but Bash definitely does)
I know and use some of these key bindings for many years. I still learnt new and useful ones from your short video.
I didn't know about alt+. and it seems super useful, can't wait to try it in practice. I wish someone compiled a list of quick wins like that. You can go for years without knowing that e.g. double click + drag selects text by full words. But I guess it would be hard to make such a list complete and avoid too much detail at the same time.
O-M-F-G. Thanks, just thanks! I never questioned if there were keybindings...
I've been using a lot of emacs bindings without knowing their origin. It is very nice to know such things and also be aware of options (like `set -o vi`) in order to change them. This will permanently influence how I work with the shell, thank you very much.
Also I'm checking out the emacs video right now^^
In vi mode use '_' character in normal mode to get the last parameter of the last command. You can also use the numbers before to get the argument of the specific number.
CTRL-y is not really an undo. It's more like a paste command (which it is in Emacs).
And CTRL-w, ALT-d, CTRL-k, and CTRL-u are more like cut commands.
So you can actually move an argument or word around using these commands.
For example, if you have
$ echo word1 word2
and you press "CTRL-w ALT-b CTRL-y " you will get
$ echo word2 word1
Could you just use ctrl - T to swap args also!?
Yes! And if you press CTRL-y multiple times it will paste what was cut several times. This "undo" stuff was really confusing until I figure that out by trying to undo multiple times.
@@dragonsage6909 As far as I can tell, CTRL-t will swap only the last two CHARACTERS positions. if you use it with "echo word1 word2" you get "echo word1 wor2d"
@@mellowgeekstudio ok, thx.. still experimenting.. there are a lot of these.. :)
@@dragonsage6909 Indeed. No problem.
A long time ago (though still in this galaxy), I used emacs. These days I'm a vim addict. But I tried vim keybindings for bash and ended up going back to the standard emacs ones.
The thumbnail was gorgeous!
"set -o vi" was the solution to all my miseries and it's been so many years I didn't know that.
Great episode, I'm trying to use these more lately, great time savers.
Ty
just a note ^ brings you to the start of text , 0 brings you to the actual start of the line regardless of leading whitespace or tabs
Well hot damn, I've been working in the shell for more than a decade and didn't know that I could change to vi bindings, what an oversight.
Also, just to take advantage of shells and fish in particular being discussed: don't be surprised if you change to fish and "!!" or "!$" don't work, that's apparently by design - a design I very much disagree with and why "plugin-bang-bang" is the first thing I install alongside fish. Call me oldskool, but "sudo !!" will probably forever be more ingrained in my mind rather than "[UP]->Ctrl+A->sudo "
Go to my GitLab and look in my Dotfiles repo.. Find my .config/fish/config.fish. There are two custom functions in there, one for "!!" and another for "!$". ;)
1. In macOS Terminal, in the options->Profile tab, enable the checkbox "Use Option as Meta key" to have this keybindings.
2. I just want to thank you for this content and channel, I though I knew how to use the terminal until I saw your content, which is like a glass of water in a desert.
I guess the macOS terminal has some settings that make it more usable, but I eventually switched to Kitty, much better experience. I think Alacritty is also available.
@@rafalg87 Thanks for the tip.
Thank you for covering this. I learned that stuff in school, but I had forgotten so much of it. And, being a Windows user mainly, kindof dumbs me down. I just use arrow keys & only few extras.
Oh no I am used to emacs standards, very useful to know!
Thank you. Good info. Relearned a forgotten.
Fun fact, in the Fish shell you can use alt+l to run "ls".
You have taught me something really useful!
Wow, didn't know that
Good one, as always 🙂
Hey, DT! Recently, I find myself using a lot of regex in my nvim workflow (%s/...). Would you consider making a video on the topic?
Yes please!
For my keybindings, I've got home and end to go to the start and end of a line, Ctrl+{LArrow,RArrow} to navigate by words, Ctrl+Del to delete forward and Alt+Backspace to delete backwards. Though, I really don't do much line editing. I tend to just add to my .bashrc anything I keep typing repeatedly and occasionally if I need something temporarily I'll just create a function at the terminal. Sometimes I'll make a .sh file if I don't want it polluting the .bashrc but I need it multiple times, like starting up qemu instances.
As always writing a comment to support the channel
Great channel. Thanks so much for sharing all the valuable information and experience 👍👍👍
Most useful setting is to enable Vi keybinding and the different modes in the shell. And on ZSH is even a plugin with extended support for Vim like key bindings and functionality in the shell.
I've not really done a whole lot of line editing with my commands, but I tried vi keybinding just now and it's certainly neat, but how do you tab complete backwards and forwards with it, and how do go up to edit a line without moving over to hit an arrow key?
Very helpful as a newbie
Apart from the attention given to vi keybindings this was a great video. Mind you that quite a lot of appliances ( Cisco, Arista, Fortigate etc. etc. ) also use these key bindings, i.e. the EMACS key bindings 😋
I was going to say the same thing about the EMACS bindings!
ctrl + left/right arrow will move your cursor by 1 word forward or backward. just like alt+b/f
This is super helpful. Thanks DT!
Very Good Info in this video.
For beginning of the line and end, you can also use 'home' and 'end'.
But this might already be setup somewhere that I don't know about
Nice I usually use "$!" for the last argument retrieval in emacs mode .. "Alt ." is faster... indeed if you ever need to run commands with long arguments such as ffmpeg in the cmd line you will force yourself to learn these jump shortcuts
Could you explain copying/cutting and pasting text shortcuts? And these vim *, + registers, how to use them in a convenient way??
In Emacs mode ctrl-x ctrl-e opens an editor for the command line. There are times it is handy. It will use your system default editor or honor $EDITOR if set.
every time a vim user approaches me and tries to convince me how bad Emacs is, I ask back which shell he uses, and always it turns out it's Bash, and then I say "oh, well, you know Emacs keybindngs too!"
Nice video, thank you for that. Is there any key binding for scrolling?
scrolling is related to the terminal emulator and has nothing to do with the shell.
I love that T-shirt! 🤣
That shirt is hilarious!
ctrl-r allows you to search for a previous command in your history.
Ctrl+L works in normal mode with vi bindings. Use Ctrl+Alt+L in insert mode.
Great work 🥳🥳🥳 Thank you 💜💜💜
ctrl + l works with zsh in vim mode btw
hey DT! i recently broke my monitor by putting it on a paused bright RUclips video. it would be nice to make a video talking about the importance of screensavers, show xscreensaver and also add it to the DTOS script
Curious, will this work during a command line installer for say Arch or Gentoo? I'm always having to change a misspelled package when I'm installing all of my packages during an Arch install. Can I go back word by word and fix the error(s) using these keybindings?
Would be nice to configure any terminal to use vim key bindings
When using the vi mode you are in the 'insert' mode at first. You must hit ESC to get out of that mode.
set -o vi, is all you need
Quite a lot of this works the same in tcsh. (I use that for historical reasons - csh rather than sh. I forget why,)
Hey DT, completely unrelated to the video but I've always wondered, since PCManFM is your go-to GUI file manager, why don't you use it manage the desktop wallpaper in your WM sessions instead of using Nitrogen?
7:05 Ctrl + D is not related to the emacs/vi keymap, It sends an EOF to bash, or any command running, which denotes the end of input.
Very useful :) thanks
Hey DT can you do a video on USBguard?
Hey DT, you have a broken Audacium link in the description, apparently they've moved to other website 😃
can you just manually change the keys? I would not mind getting standard copy paste working, as well as just nuking 90% of the other keys. I like arrow keys, ctrl_arrow keys for by word (I might just change that to begingin/ending of line), then I would like a clear all text key, normal copy paste. ESC could be whatever , stop I guess?
Correction: Ctrl+y isn't undo. It is paste. But when you do Ctrl+u it also sets the text in the clipboard.
You should try to put the keys pressed on screen.
First and foremost, thank you very much for your videos!! Been a longtime Mint/Manjaro & Openbox user and your videos gave me the courage to jump toward vanilla Arch.
Thanks to your various and in-depth info, I now have a customized AwesomeWM to my satisfaction and I am now setting the terminal to vi mode. I just finished updating my vimrc file and talk about perfect timing...
probably nothing, but my 2 cents regarding 'clear' for clearing TERM screen....... =)
I've been using an alias 'clr' for 30 years as my pseudo solution
still same 3-stroke keys, visual confirmation, and works whether ur in emacs & vi mode.
Once again, thank you very much for your hard works.
Cheers,
Hey DT this is a great video because I discovered my bindings are messed up. ALT-f doesn't do anything while all the other keybindings work?
Now I need to find the problem or else I'll be forced to use the arrow keys! SOMEBODY HELP!
Many terminal emulators have their own custom keybindings as well. It's possible that your terminal has Alt-f set to something else.
@@DistroTube that was my first thought but there is isn't one. For a one handed x programmer remembering all the key bindings is maddening.
thnx for the vid dt
When you're in vim mode does it respect your .vimrc? I have bindings like jj to go to normal mode.
The shell does not use your vim (or emacs) configs because you are not actually running Vim/Emacs. You're just running the shell, and the shell has its own config file (the .bashrc for instance, in bash). I'm pretty sure you could re-bind the command to go to normal mode from ESC to jj or anything else. In bash, you'd use the 'bind' command. Type 'bind' and hit TAB and you will see all of the possibilities. I think vi-movement-mode is the one you are looking for..
Thanks for that. Will try tonight
I use c-w, c-u every time, anybody knows if exist a command to clear all line in any position? Like Esc in Prompt Command of Windows.
I don't know about Vi mode, is possible custom mapping?
Create a ~/.inputrc with this content
$include /etc/inputrc
# Configure Esc to clear line
# "\e": kill-whole-linevi # vi mode
"\e": kill-whole-line # emacs (default) mode
Moving or deleting by words is sometimes a little unpredictable, for instance it might be that dashes are considered a word boundary and underscores aren't.
So, I sometimes fall back to moving/deleting by individual characters, which can be vastly improved by configuring your OS's key repeat settings. You can do that from your DE's settings UI or from the command line, for instance in Gnome you'd run:
gsettings set org.gnome.desktop.peripherals.keyboard delay 250
gsettings set org.gnome.desktop.peripherals.keyboard repeat-interval 25
Bear in mind it affects everything, not just the terminal. But once you try it I don't think you'll want to go back.
I realise this is kinda necroposting, but I'm trying to learn all I can. In Kubuntu 24.04 using ZSH, CTRL+U is deleting the entire line of text, not just from the cursor back. Is this normal?
Thanks.
no thats not normal. its probably something with zsh i dont use it doe
For me Ctrl-u deletes whole line for some reason
Great! zsh-vi-mode is a zsh plugin which is very helpful. I just wonder how to set the mode of neovim after press ":", do you guys have any ideas?
*Latte has been discontinued!* The author shared the bad news on their website and on r/kde
Это супер контент ) Ждем еще.
why would you write a comment in russian on an english channel?
@@utsupp1274 In our times, when we have google translate, the language in which we write to each other is not so important. I am Russian, so I wrote a comment in my language.
Ctrl+Y is not weird. "Y" stands for "yank", when you are yanking back what you just deleted.
I wondered when I saw your Manjaro T-Shirt and now I wonder again.
Where do you get these Shirts? ;)
There is a link in the videodescription.
where did you get your shirt from
There is a link in the videodescription.
Weird binding?
You know what really weird is?
Enter to copy.
(anyone knows which shell is using it?)
Oxford comma missing in title
I would like to propose you a subject for your channel: Window Managers that run on Wayland! I know you already talked about Sway here, but I would like you to comment on others, like Wayfire, Hyprland, River, etc.That's if you can and when you can too...
Which is wierder,
Ctrl + Y for undo or
Ctrl + Z for undo....
For ctrl + z,
I think it's a little more convenient because it is close to cut (ctrl + x), copy (ctrl + c) and paste (ctrl + v)
Depends if you are on a qwertz or qwerty keyboard ;)
@@kaptkraut I didn't even think about qwertz. Poor people....
vim mode in zsh is better honestly
GVDT.
I've switched to vi mode for the key bindings... If you use vim as your text editor it only makes sense....
I can never remember the emacs bindings...
They are not intuitive at all...
I was just waiting for some vimster to show up and start pouring crap on emacs. Let the holywar begin!
@@romany8125 sorry dude,
But honestly the emacs bindings are just weird....
I'm learning emacs but with evil mode...
not first
Wait, there was a vi-mode in a shell all that time?! I'm out, peace V
:q!
Its sudO not sudu.
first
lol
First?!
Not even close. :(
Eyyo pin my comment?
Your kernel is very outdated
Fix the stupidity by adding set -o vi to the end of your .bashrc and enjoy vim keybindings.