Very nice introduction. I've used vi since the late 70s. My fingers instinctively type the commands. Much like your excellent explanation about Unix/Linux in a different video, I think it helps to give some of VI's history, when talking about the commands starting with colon. This is "ex mode" -- ex was an enhancement to 'ed', the first command-line text editor. 'ed' & 'ex' operate on files, one line at a time. The big advance with 'vi' is that you can edit the file, one character at a time ('vi'sually). But 'vi' developers didn't want to re-invent many of the powerful 'ex' commands, like substitute (:s). So they added the ':' command that takes you into 'ex mode'. I think this brief history makes it easier for new users to understand colon commands. Some of folks who complain about arcane commands in vi forget its history. Before vi, there were NO visual editors. At the time, the input device was an 80x25 CRT with standard typewriter keyboard. The vi inventors consciously decided to assign the most common command-mode commands to where a touch-typist would easily find them. The motion commands (h, j, k, l) are perfect for the right hand. Other than those 4 keys, the command key is the first letter of the operation (a = append, b/f = back/forward, etc. -- well, almost always the first: x = exit). 'z' command was put in as a joke: when you are done with your work, you can go to sleep, type 'zz'. Ubiquity & compatibility are two other reasons to learn vi. IDEs are great, but require a ton of system resources (processor power, disk space, graphics drivers, etc.). Vi needs very little power. It's used in tiny, embedded environments or in places where there's no decent graphical monitors. An IDE would be overkill, or not be able to run in these environments.
If you're like me and don't want to spend 2 years learning vi's archaic commands because you already have a proper text editor - but you still need to edit files on remote linux boxes, just use nano (it's usually in all unix-ish environments and it's far more intuitive - even if less powerfull).
Yeah, I see how vi's useful for people who have to do massive amounts of config file editing, but for my purposes, nano works just fine. The amount of time that it would save me is not nearly enough to justify the effort it would take to achieve Vi Grand Wizardry.
Hmm, Vi's keybindings are fairly intuitive (as far as making sense, but like any keybindings, but it will take effort to become proficient) once you understand the motivation around them. The general idea is to minimize keypresses by 1) switching between modes rather than multi key shortcuts 2) keeping as many commands accessable from the home row as possible. This in general allows you to do really fine grained movements like text selection very quickly without going to your mouse or arrow keys. In fact I would think the only reason you find "modern" (I use this term but really all keybindings at the end of the day are arbitrary choices with some level of reasoning behind them) keybindings intuitive is that you were forced to learn them at an early age. The main issue with vi for software is that semantic code completion is sometimes spotty even with plugins. Anyways, its hard to express to unfamiliar people just how nice vi keybindings (you can find them in most editors) are once you become proficient. You are free from having to move your hands towards either the mouse or the arrow keys. At the very least, I'd urge you not to dismiss it as "archaic". New doesn't necessarily mean better although it often does. I do realize that for a lot of usecases, it may be overkill, but a super valuable tool/skill for swe's.
There is in general, per se a value in learning something new. In this specific case however, many people swear that vi changed their life turning them into highly productive users. So it may not be a waste of time.
While I very may well agree, there are times when you don't have access to nano, but vi is available (often when troubleshooting a remote system), so knowing vi can be very helpful!
@@avikondareddy7318 Intuitive? What other modal, command based HCI software do you use? When I say that it's "archaic", I actually know what I'm talking about. But feel free to debate it with me if you have arguments.
I would love Linux command line tutorials, and pretty much all Linux tutorials that would help newbies and people to try Linux and people to fell in love with Linux. I myself would like longer videos, even if the subject is simple. I think this video could have had couple of more minutes to explain VIM further.
Nice. Please do a follow up on a more advanced stuff: I think people like myself know their way around the basic shortcuts and usage, but kind of lack the experience with the program itself, so could you show us how you do it? Like, 'I think these commands are useful for this thing that you always do when you're in this situation' so the command sticks with me long enough to notice the use case you suggested and I make use of it. Also, customization, alternative commands, split view, you get the idea. I sure would appreciate a video on these topics, and I think many would too. Keep up the good work!
Great introduction to vi. Even though I started using GNU Emacs on Sun 3/60 workstation manyy years ago, and still using it until today, still, vi is relevant. Some of GUI editor users are not used to edit files on Unix or Unix like environment may not able to 'feel' the power of i, or the powerful GNU Emacs. How many modern GUI editors able to play games, compose emails, read newsgroups, IRC, web browsing in editor? I never have to leave from GNU Emacs to do all those things.. :). For quick edditing, I am using GNU Emacs' clones, such as mg or zile. or.. sed. Thank you, and looking forward for your future videos..
Thanks for that. I have a friend at "ARGON Labs" that discusses that kinda stuff with me and I'm a plumber/home handy man kinda programmer. Now I understand more on what he was referring to. Maybe I'll look more into that if and when I have the chance to get deeper into something like Python. Oh, and yeah I really am a Home handy person with over 20 years in computer systems. Your explanation was wonderful.
Thanks, that was an amazing explanation. Although I'll still use nano for in-shell editing in Linux because it's just faster for me personally and it has most of the features I need with more streamlined user experience.
I don't know how much you use shell editing, but I'd really recommend taking a few days to force yourself to use vim. There's definitely a learning curve, but that's why I totally disagree with you that nano is a more "streamlined" user experience. Nano is a "forced" user experience, because its more limited in what you can do. Vim is more streamlined because you can do about 85-90% of any editing imaginable in just a few keystrokes, and the last 10-15% is made up for with regex and other commands built into vim. Nano only feels streamlined because its very limited, but that's not the same thing. I promise you that if you do a significant amount of command line editing that you won't be sorry for the initial time investment, but if its something you only do very occasionally, then you probably won't miss it (although, I like vim so much, I exclusively use vim, and wouldn't even think about using a gui text editor, unless I had to for some sort of IDE or another).
I'd suggest cp and mv as being obvious Linux choices, because they have power and gotchas users of DOS/Win might not expect. Also (if not done already) find, grep, top, jobs, and some basic moves for fdupes and rsync, some of which I wasted time looking for when I finally moved to Linux :-)
Not trying to hate, but the main reason why I love vim is because you can find it virtually everywhere and you can really do anything quicker than a gui requiring a mouse once you learn how to type commands. That's the reason why I prefer a standard vanilla vim with configuration that supports syntax highlighting and relative numbers. Those are quality of life things, that, if I were forced to use vim where I didn't have access to my preferred config file, then I'd be able to adapt relatively easy. Again, not trying to hate on your decision to use plugins, but one of the reasons to use vim is that you always have it, and I'd really prefer to not become dependent upon them.
I can't even remember why I learned vim in the first place...but it's a really addictive typing experience. I also use vim browser plugins that's really useful for power user. I still use mouse btw. Too much useless myth around vim. Make it your own and get comfy!
I think what could be quite interesting could be "explaining" how exactly things like vi have developed, their impact on modern software today (and why something like vim is still a relevant important tool to know), and its predecessors like ed (which would help explain the brilliance of vim). Vim is a topic that is easy to find why people love it, but there are tons of tools in gnu core utils that people just don't even know is there. Education about what these are, where they came from, and why they're still important would be a really nice video series.
I know emacs ppl will disagree, but I like the idea of NOT needing to push ctrl or meta so often, just jumping between modes seem sane. Also, I'm just an opportunist, I learn whatever editor the people I'm working with use, for ease of pair programming :)
Please cover zsh as MacOS is finally adopting it, finally underlining it as THE shell. It has so much potential and bashers seem to be unaware or afraid of it.
@@GaryExplains Yes, please! And any Linux command line stuff. Slogging through everything else on RUclips has not gone well for me thus far. You I trust. You I like. You make sense to me.
Hello Gary, congrats with 100K+ subscriptions. I am currently copy/paste lots of data between storage drives, running windows 10. The transfer speed is about 6.5MB/s in average. Many people are claiming that windows 10 is doing lousy job when transferring data between drives but there are to many "expert" on the internet with solution how to fix this. Maybe this is normal or maybe I should use Linux on usb to copy/paste data. Can you explain?
VI, variables & switches that are case sensitive are the main reasons I never used Unix back in the day. Give me Digital Equipment Corp's EDT & TPU any day. Even Notepad makes more sense than VI. When I need to edit things in Linux, I use Nano.
Gary: Mr. ENGINEER, explain to me the difference in cost to make a 25W charger versus a 45W charger, please ! Rectifier boards have been manufactured for years and I really can't see a big difference between a 25W charger and a 45W charger ?! Thanks 👍
with text editors around which actually by default make use of the keys on a modern keyboard, like nano, joe, etc I never found a single case where I would want to use vi. Also things get weird with vi if you are using a non-US keyboard layout, where e.g. 0 and $ are at complete opposite ends of the keyboard.
I had been in several situations where networking was not working and vi was the only editor available. Really helped to know how to use it and restore the system to a working state.
@@GaryExplains I didn't pay much attention in that part of the video but after you replied I noticed undoing in Vim is different than in Vi. In Vim by default, u is to go back in history and Ctrl+r is to go forward in history. In the editor you use, which I think is Vim with Vi compatibility, as you demonstrated and if I percieved it correctly, u will undo the last command, which can be another undo, which is effectively redo. To go further back in history you press Ctrl+r after u.
Vi is quite good package but a bit complicated package to use, I sincerely hope you have a copy of that source code file that you altered or you will be up the creak without a paddle so to speak.
in command mode: j = Down k = Up l = Right q! = exit out of VI without saving :x = save and exit ______________________________________ i = Insert mode (to type in the file) ESC = command mode u = Undo (first time) ctrl + r = Undo (all times after first time) . = Will repeat last command dd = delete 2 lines 3dd = Deletes 3 lines x = deletes lines one at a time o = new line a = appends at the end of the line 0 = moves cursor to beginning of line $ = moves cursor to end of line / = search for something in command mode n = find next instance nnG = go to line nn N = find instance before :%s/str/rep = replace string You're welcome
I'm using Linux on Chromebook & when I try to use the 'x' to delete, it deletes characters several letters to the right instead of the character under the cursor. Generally it's 4 characters to the right, but that seems to change occasionally. Gvim works as expected. If there any way to fix it?
Ho my god this was compressive will you be doing (have you done) all one needs to know about linux/Unix commands (the stuff no one talks about like the CTRL+ command etc.)
Use what is best for you. I use nano most of the time, but there are snobs who like to struggle with vim rather than use nano. Having said that, vim has more advanced features.
techtard here, so forgive the stupid questions, please: if i only access my own PCs (even remotely) and can use ssh -X to access GUI or, without GUI, I can use the outdated nano or its cute new replacement (?) micro, then why do I need Vi? I have seen the powerful benefits and the insane amount of learning of Vim. But, Vi?? In what scenery would I need Vi?
Are you asking why you would use vi rather than vim? Or vim rather than nano? I am not sure which question you are asking. If it is the first then in this context vi and vim are the same thing.
Most people don't use vi from the '70's, but vim. Experienced sys admins and coders prefer vim over nano because of how fast things are done. But sure, nano is way easier to learn
Yeah, I meant use vim if you need to do anything useful. Vi is only for when vim is not installed and cannot be installed for some reason (not enough privilege or whatever). I use vim as my only editor anyway.
I also use nano when I need to edit files in the terminal. It's easier to use for someone who doesn't want to learn all the Vim commands. However, Vi seems to handle large files a lot better (e.g. database exports).
thank you for this tutorial. I am new to Linux overall, it's almost been 2 months for me but I am learning how to use the command line and know a fair bit about it but when I heard about Vim, I became obsessed and want to learn it but some of the tutorials are way over the top "techy" for me but this is so refreshingly simple. I will implement what you have spoken about here, can you please do an in depth video about Vim? thanks again.
Check Vim-adventures: vim-adventures.com/ It's good for a gentle introduction. vimtutor is good as well - spending a fifteen minutes a day with it for a few weeks will drill the basics pretty well
I highly recommend O'Reilly publications like this one: shop.oreilly.com/product/0636920010913.do (Disclosure: I gain nothing from this, just a friendly suggestion)
this video was ok because it could help me open large files. but i'm not that interested in learning archaic linux commands, even though i'm familiar with a few basic ones. i just don't consider it enlightening
@@GaryExplains As an enthusiastic vim user I really hope so! I wish vim and vim keys were more common! However, speaking from experience, when trying to explain to other people (who might even be developers) why vim is so good, it's really hard to convince them even if you show them some "magic" stuff vim can do. People have this fear of anything terminal-based.
Why the hell is this so unecessarily complicated and counterintuitive? That made it so much easy for Windows and Mac to become so successful. Just download some IDE or even a text editor. For f* sake.
The success of Windows or Mac (which are GUIs) has absolutely nothing to do with vi. Such an assertion is nonsense. When you say IDE, again I assume you are talking about a graphical one, vi is for the command line. There are plenty of graphical IDEs for all the major OSes including Linux, and many are cross platform. I feel you really don't grasp the context of this video.
@@GaryExplains it has to do with how easier it is to do stuff without having to worry about too many highly specific and counterintuitive things and yes, it is partially due to graphical interfaces and whatever is needed to do so. And yes, Linux also has some of this but this is not exactly the point. When I mentioned IDEs and text editors I was actually trying to point towards friendlier interfaces for file/text editing, less of a solution found in the 70s, more of things developed after long decades of maturing. And probably you are right that I didnt grasp the context, but it just really shocks me how it is unjustifiably complicated. It really comes to my mind the comparison between using earlier versions of Linux or even DOS and more modern versions of say, MacOS. But I dont know much. Its been a while I dont need to use a terminal.
@@mazocco So if you aren't using the terminal then this is irrelevant for you. However many people run headless servers on the Internet or even at home (with the Raspberry Pi etc) and in those situations you need command line editing. Vi isn't the only command line editor, and nano is s workable alternative. However vi is installed on just about every Unix and Linux system, it is almost universal. So understanding how to use it can be very helpful. You seem to be confusing the need to have a basic working knowledge of vi with using it as you main editor. I don't think you heard me espouse vi over other editors in this video, did I?
Sublime (or for that matter any GUI text editor) doesn't work over ssh (at least not in a way you'd want to use it) so it does make sense to get used to some command line text editor. And vim is awesome once you get used to it.
does nano work over ssh then? "once you get used to it" is just not worth it for some people, especially if they're already fast with their current tools
comment 104... ma privacy aside... i really enjoyed ur video. it help shed some light to the nuance working of vi that i didn't know. PLEASE DO A PART 2 TILL 5 MAX!!! AND MAYBE A REGULAR EXPRESSION TUTORIAL. since as enthusists it may be more of something referable in 5 min
Very nice introduction. I've used vi since the late 70s. My fingers instinctively type the commands.
Much like your excellent explanation about Unix/Linux in a different video, I think it helps to give some of VI's history, when talking about the commands starting with colon. This is "ex mode" -- ex was an enhancement to 'ed', the first command-line text editor. 'ed' & 'ex' operate on files, one line at a time. The big advance with 'vi' is that you can edit the file, one character at a time ('vi'sually). But 'vi' developers didn't want to re-invent many of the powerful 'ex' commands, like substitute (:s). So they added the ':' command that takes you into 'ex mode'. I think this brief history makes it easier for new users to understand colon commands.
Some of folks who complain about arcane commands in vi forget its history. Before vi, there were NO visual editors. At the time, the input device was an 80x25 CRT with standard typewriter keyboard. The vi inventors consciously decided to assign the most common command-mode commands to where a touch-typist would easily find them. The motion commands (h, j, k, l) are perfect for the right hand. Other than those 4 keys, the command key is the first letter of the operation (a = append, b/f = back/forward, etc. -- well, almost always the first: x = exit). 'z' command was put in as a joke: when you are done with your work, you can go to sleep, type 'zz'.
Ubiquity & compatibility are two other reasons to learn vi. IDEs are great, but require a ton of system resources (processor power, disk space, graphics drivers, etc.). Vi needs very little power. It's used in tiny, embedded environments or in places where there's no decent graphical monitors. An IDE would be overkill, or not be able to run in these environments.
Wow, I was surprised with the topic of this video. Please more foss content on the channel
more Linux command line tutorials would be great!
Did you see my 10 Linux commands video before? ruclips.net/video/CpTfQ-q6MPU/видео.html
If you're like me and don't want to spend 2 years learning vi's archaic commands because you already have a proper text editor
- but you still need to edit files on remote linux boxes, just use nano (it's usually in all unix-ish environments and it's far more intuitive - even if less powerfull).
Yeah, I see how vi's useful for people who have to do massive amounts of config file editing, but for my purposes, nano works just fine. The amount of time that it would save me is not nearly enough to justify the effort it would take to achieve Vi Grand Wizardry.
Hmm, Vi's keybindings are fairly intuitive (as far as making sense, but like any keybindings, but it will take effort to become proficient) once you understand the motivation around them. The general idea is to minimize keypresses by 1) switching between modes rather than multi key shortcuts 2) keeping as many commands accessable from the home row as possible. This in general allows you to do really fine grained movements like text selection very quickly without going to your mouse or arrow keys. In fact I would think the only reason you find "modern" (I use this term but really all keybindings at the end of the day are arbitrary choices with some level of reasoning behind them) keybindings intuitive is that you were forced to learn them at an early age. The main issue with vi for software is that semantic code completion is sometimes spotty even with plugins. Anyways, its hard to express to unfamiliar people just how nice vi keybindings (you can find them in most editors) are once you become proficient. You are free from having to move your hands towards either the mouse or the arrow keys. At the very least, I'd urge you not to dismiss it as "archaic". New doesn't necessarily mean better although it often does. I do realize that for a lot of usecases, it may be overkill, but a super valuable tool/skill for swe's.
There is in general, per se a value in learning something new. In this specific case however, many people swear that vi changed their life turning them into highly productive users. So it may not be a waste of time.
While I very may well agree, there are times when you don't have access to nano, but vi is available (often when troubleshooting a remote system), so knowing vi can be very helpful!
@@avikondareddy7318 Intuitive? What other modal, command based HCI software do you use? When I say that it's "archaic", I actually know what I'm talking about. But feel free to debate it with me if you have arguments.
Great video. I would love to watch more videos like these. Please make a video on awk command.
I started using vi in 1987. Then vim in the mid 90s. And I'm *still* learning new things about it.
I would love Linux command line tutorials, and pretty much all Linux tutorials that would help newbies and people to try Linux and people to fell in love with Linux.
I myself would like longer videos, even if the subject is simple. I think this video could have had couple of more minutes to explain VIM further.
Did you see my 10 Linux commands video ruclips.net/video/CpTfQ-q6MPU/видео.html and it's further 5 commands follow up videos?
Nice. Please do a follow up on a more advanced stuff: I think people like myself know their way around the basic shortcuts and usage, but kind of lack the experience with the program itself, so could you show us how you do it? Like, 'I think these commands are useful for this thing that you always do when you're in this situation' so the command sticks with me long enough to notice the use case you suggested and I make use of it. Also, customization, alternative commands, split view, you get the idea.
I sure would appreciate a video on these topics, and I think many would too. Keep up the good work!
Great introduction to vi.
Even though I started using GNU Emacs on Sun 3/60 workstation manyy years ago, and still using it until today, still, vi is relevant.
Some of GUI editor users are not used to edit files on Unix or Unix like environment may not able to 'feel' the power of i, or the powerful GNU Emacs. How many modern GUI editors able to play games, compose emails, read newsgroups, IRC, web browsing in editor? I never have to leave from GNU Emacs to do all those things.. :).
For quick edditing, I am using GNU Emacs' clones, such as mg or zile. or.. sed.
Thank you, and looking forward for your future videos..
Thanks for that. I have a friend at "ARGON Labs" that discusses that kinda stuff with me and I'm a plumber/home handy man kinda programmer. Now I understand more on what he was referring to. Maybe I'll look more into that if and when I have the chance to get deeper into something like Python. Oh, and yeah I really am a Home handy person with over 20 years in computer systems. Your explanation was wonderful.
the default mode which Vim starts in is the normal mode not the command mode. The command mode is the mode you use when you hit ":'" in normal mode.
Thanks, that was an amazing explanation. Although I'll still use nano for in-shell editing in Linux because it's just faster for me personally and it has most of the features I need with more streamlined user experience.
I don't know how much you use shell editing, but I'd really recommend taking a few days to force yourself to use vim. There's definitely a learning curve, but that's why I totally disagree with you that nano is a more "streamlined" user experience. Nano is a "forced" user experience, because its more limited in what you can do. Vim is more streamlined because you can do about 85-90% of any editing imaginable in just a few keystrokes, and the last 10-15% is made up for with regex and other commands built into vim.
Nano only feels streamlined because its very limited, but that's not the same thing. I promise you that if you do a significant amount of command line editing that you won't be sorry for the initial time investment, but if its something you only do very occasionally, then you probably won't miss it (although, I like vim so much, I exclusively use vim, and wouldn't even think about using a gui text editor, unless I had to for some sort of IDE or another).
Finally! 😃
Awesome video (as always 😉) - I hope you’ll do something like “advanced Vim” soon! 😎
VIM over everything!
Good stuff! Please make a video about using | and > operators in command line along with the unix philosophy of simple, chained commands
I did that already ruclips.net/video/oyc_6UfoW3w/видео.html
I'd suggest cp and mv as being obvious Linux choices, because they have power and gotchas users of DOS/Win might not expect.
Also (if not done already) find, grep, top, jobs, and some basic moves for fdupes and rsync, some of which I wasted time looking for when I finally moved to Linux :-)
Vim is the best.
Plugins I use:
vimplug
Airline
Gitgutter
Delimitmate
Multiple cursors
Ale
Not trying to hate, but the main reason why I love vim is because you can find it virtually everywhere and you can really do anything quicker than a gui requiring a mouse once you learn how to type commands.
That's the reason why I prefer a standard vanilla vim with configuration that supports syntax highlighting and relative numbers. Those are quality of life things, that, if I were forced to use vim where I didn't have access to my preferred config file, then I'd be able to adapt relatively easy.
Again, not trying to hate on your decision to use plugins, but one of the reasons to use vim is that you always have it, and I'd really prefer to not become dependent upon them.
I can't even remember why I learned vim in the first place...but it's a really addictive typing experience. I also use vim browser plugins that's really useful for power user.
I still use mouse btw. Too much useless myth around vim. Make it your own and get comfy!
I think what could be quite interesting could be "explaining" how exactly things like vi have developed, their impact on modern software today (and why something like vim is still a relevant important tool to know), and its predecessors like ed (which would help explain the brilliance of vim).
Vim is a topic that is easy to find why people love it, but there are tons of tools in gnu core utils that people just don't even know is there. Education about what these are, where they came from, and why they're still important would be a really nice video series.
I know emacs ppl will disagree, but I like the idea of NOT needing to push ctrl or meta so often, just jumping between modes seem sane. Also, I'm just an opportunist, I learn whatever editor the people I'm working with use, for ease of pair programming :)
Pls do more Linux command line tutorials...
Please cover zsh as MacOS is finally adopting it, finally underlining it as THE shell. It has so much potential and bashers seem to be unaware or afraid of it.
THANK YOU FOR THIS!!! There's a ton of info out there, sure. But when Gary Explains it, I finally get it!
Please sir, may I have some more...? :)
More vi/vim videos?
@@GaryExplains Yes, please! And any Linux command line stuff. Slogging through everything else on RUclips has not gone well for me thus far. You I trust. You I like. You make sense to me.
@@snapsynapse Great! Did you see my 10 Linux commands video ruclips.net/video/CpTfQ-q6MPU/видео.html and it's further 5 commands follow up videos?
The first mode after starting ist the "normal" mode. Command mode is what you start with the colon.
loud and clear, thank you
it is the ONE thing you need to know about when dealing with any *nix :D Love it. I hate it, too :D
so touching for an excellent video
Great! My suggestions:
- ssh port port forwarding (ie, ssh -L 3306:localhost:3306 root@db)
- find
- OhMyZsh
Hello Gary, congrats with 100K+ subscriptions.
I am currently copy/paste lots of data between storage drives, running windows 10. The transfer speed is about 6.5MB/s in average.
Many people are claiming that windows 10 is doing lousy job when transferring data between drives but there are to many "expert" on the internet with solution how to fix this. Maybe this is normal or maybe I should use Linux on usb to copy/paste data. Can you explain?
It depends 100% on the type of drive/storage and the interface. I have a video about it already. Search for "how fast is your storage."
Thank you #gary for this
VI, variables & switches that are case sensitive are the main reasons I never used Unix back in the day. Give me Digital Equipment Corp's EDT & TPU any day. Even Notepad makes more sense than VI. When I need to edit things in Linux, I use Nano.
thanks! learned something new
Gary:
Mr. ENGINEER, explain to me the difference in cost to make a 25W charger versus a 45W charger, please !
Rectifier boards have been manufactured for years and I really can't see a big difference between a 25W charger and a 45W charger ?! Thanks 👍
with text editors around which actually by default make use of the keys on a modern keyboard, like nano, joe, etc I never found a single case where I would want to use vi. Also things get weird with vi if you are using a non-US keyboard layout, where e.g. 0 and $ are at complete opposite ends of the keyboard.
I had been in several situations where networking was not working and vi was the only editor available. Really helped to know how to use it and restore the system to a working state.
Ctrl+r is to redo changes in Vim, so probably in Vi too. u can undo multiple changes.
I think I cover that in the video, don't I?
@@GaryExplains
I didn't pay much attention in that part of the video but after you replied I noticed undoing in Vim is different than in Vi. In Vim by default, u is to go back in history and Ctrl+r is to go forward in history.
In the editor you use, which I think is Vim with Vi compatibility, as you demonstrated and if I percieved it correctly, u will undo the last command, which can be another undo, which is effectively redo. To go further back in history you press Ctrl+r after u.
Great video, like always
Vi is quite good package but a bit complicated package to use, I sincerely hope you have a copy of that source code file that you altered or you will be up the creak without a paddle so to speak.
Tell 'em about the "vimtutor" command; following that short tutorial, set me up for an almost 20 year career in FreeBSD & Linux SysAdmining.
in command mode:
j = Down
k = Up
l = Right
q! = exit out of VI without saving
:x = save and exit
______________________________________
i = Insert mode (to type in the file)
ESC = command mode
u = Undo (first time)
ctrl + r = Undo (all times after first time)
. = Will repeat last command
dd = delete 2 lines
3dd = Deletes 3 lines
x = deletes lines one at a time
o = new line
a = appends at the end of the line
0 = moves cursor to beginning of line
$ = moves cursor to end of line
/ = search for something in command mode
n = find next instance
nnG = go to line nn
N = find instance before
:%s/str/rep = replace string
You're welcome
Doesn't dd delete 1 line?
I'm using Linux on Chromebook & when I try to use the 'x' to delete, it deletes characters several letters to the right instead of the character under the cursor. Generally it's 4 characters to the right, but that seems to change occasionally. Gvim works as expected. If there any way to fix it?
sir G, please do speedtest snapdragon 855 vs 855 plus. thank u
Ho my god this was compressive will you be doing (have you done) all one needs to know about linux/Unix commands (the stuff no one talks about like the CTRL+ command etc.)
I have two command line videos, check them out and let me know what else I should cover.
Gary Explains this is fast 💨!!!
I like to "Linux tutorials" videos. Could you possibly do a video on grep expressions?
I did that already ruclips.net/video/vcRPNhLbhoc/видео.html
Isn't enough?
@@GaryExplains Yes, you did. Sorry, I missed that. I'm watching it now. Thanks for all your videos.
@@andrewfomin4770 is good. Gary is better. :-)
good job
Thank you!
Can please demonstrate emacs?
How do you record your raspberry pi screen?
How to turn off or on regex in vim search?
Speedtest g:- snapdragon 730 vs kirin 970 vs kirin 810
Please could someone explain why you would not just use nano? As a Linux noob I'd be interested to know.
Use what is best for you. I use nano most of the time, but there are snobs who like to struggle with vim rather than use nano. Having said that, vim has more advanced features.
@@GaryExplains thank you Gary for explaining
@@jamesittraining3206 U aint a true programmer unless u use vim (sips tea and adjusts monocle)
I suggest covering vnc over ssh tunnel and rsync commands. ;)
Rclone supercedes rsync
techtard here, so forgive the stupid questions, please:
if i only access my own PCs (even remotely) and can use ssh -X to access GUI or, without GUI, I can use the outdated nano or its cute new replacement (?) micro, then why do I need Vi? I have seen the powerful benefits and the insane amount of learning of Vim. But, Vi?? In what scenery would I need Vi?
Are you asking why you would use vi rather than vim? Or vim rather than nano? I am not sure which question you are asking. If it is the first then in this context vi and vim are the same thing.
@@genkiferal7178 Vim is "Vi iMproved", so in this context they are the same thing. I have never heard of a GUI version of vi/vim.
Just use nano. It's much more human than vi
Till you want to do anything useful at which point it sucks. Only good for editing like small configs.
Most people don't use vi from the '70's, but vim. Experienced sys admins and coders prefer vim over nano because of how fast things are done. But sure, nano is way easier to learn
Yeah, I meant use vim if you need to do anything useful. Vi is only for when vim is not installed and cannot be installed for some reason (not enough privilege or whatever). I use vim as my only editor anyway.
I also use nano when I need to edit files in the terminal. It's easier to use for someone who doesn't want to learn all the Vim commands.
However, Vi seems to handle large files a lot better (e.g. database exports).
Easier doesn't make it better. You have a lot of limitations in both nano and pico. Vi and vim is supposed to be more advanced on that same approach
thank you for this tutorial. I am new to Linux overall, it's almost been 2 months for me but I am learning how to use the command line and know a fair bit about it but when I heard about Vim, I became obsessed and want to learn it but some of the tutorials are way over the top "techy" for me but this is so refreshingly simple. I will implement what you have spoken about here, can you please do an in depth video about Vim? thanks again.
I have other Linux command line videos on this channel as well. I highly recommend them, even if I do say so myself!
Check Vim-adventures: vim-adventures.com/ It's good for a gentle introduction.
vimtutor is good as well - spending a fifteen minutes a day with it for a few weeks will drill the basics pretty well
I highly recommend O'Reilly publications like this one: shop.oreilly.com/product/0636920010913.do (Disclosure: I gain nothing from this, just a friendly suggestion)
vi / vim are powerful text editors, but personally, I prefer nano.
thank you 💯🔥
Thank god for nano; you should not have to be a member of a secret society to edit a file in Linux. I do like this material.
Nano is fine but after a little practice vim is really convenient
Hoping to learn how to copy and paste, maybe it does not do that.
I even use it on windows
There are much more powerful tools of using vim, but this one does suffice for starters.
You expected something more in "10 minutes"?
Or you can care about your sanity and use nano
Some segments in the video are stamped not adjacent to each other
Eh? I don't think this video has time stamps or chapters.
“Vee Eye” never “Vai”.
_lawn(off void)
While I am sure you are right, when I started using vi back in the 90's everyone was calling vai in the UK.
I think I'll just stick with nano and leafpad
this video was ok because it could help me open large files. but i'm not that interested in learning archaic linux commands, even though i'm familiar with a few basic ones. i just don't consider it enlightening
Nano masterrace
Inb4 Nano
Nano over Vim any day!!
TL:DR:
user@host $ alias vi 'emacs'
user@host $ vi
😂 that would really mess with people's minds!
😂 brilliant, mate
What about selecting text, copying it, switching to another file and pasting it?
Also how to highlight code for C, python and markdown in vi/vim?
I wonder just how many people quit watching after that green 70-ish-looking wall of text appeared on the screen xD
Very few.
@@GaryExplains
As an enthusiastic vim user I really hope so!
I wish vim and vim keys were more common! However, speaking from experience, when trying to explain to other people (who might even be developers) why vim is so good, it's really hard to convince them even if you show them some "magic" stuff vim can do. People have this fear of anything terminal-based.
*GARY!!!*
Ve! Vi! Vo! Vim! I'm learning code from an Englishman!
*Good Morning Professor!*
*Good Morning Fellow Classmates!*
MARK!
sed & awk ?
:!kill -9 $PPID
Why the hell is this so unecessarily complicated and counterintuitive? That made it so much easy for Windows and Mac to become so successful. Just download some IDE or even a text editor. For f* sake.
The success of Windows or Mac (which are GUIs) has absolutely nothing to do with vi. Such an assertion is nonsense. When you say IDE, again I assume you are talking about a graphical one, vi is for the command line. There are plenty of graphical IDEs for all the major OSes including Linux, and many are cross platform. I feel you really don't grasp the context of this video.
@@GaryExplains it has to do with how easier it is to do stuff without having to worry about too many highly specific and counterintuitive things and yes, it is partially due to graphical interfaces and whatever is needed to do so. And yes, Linux also has some of this but this is not exactly the point. When I mentioned IDEs and text editors I was actually trying to point towards friendlier interfaces for file/text editing, less of a solution found in the 70s, more of things developed after long decades of maturing. And probably you are right that I didnt grasp the context, but it just really shocks me how it is unjustifiably complicated. It really comes to my mind the comparison between using earlier versions of Linux or even DOS and more modern versions of say, MacOS. But I dont know much. Its been a while I dont need to use a terminal.
@@mazocco So if you aren't using the terminal then this is irrelevant for you. However many people run headless servers on the Internet or even at home (with the Raspberry Pi etc) and in those situations you need command line editing. Vi isn't the only command line editor, and nano is s workable alternative. However vi is installed on just about every Unix and Linux system, it is almost universal. So understanding how to use it can be very helpful. You seem to be confusing the need to have a basic working knowledge of vi with using it as you main editor. I don't think you heard me espouse vi over other editors in this video, did I?
Nah, Sublime Text for me.
Sublime (or for that matter any GUI text editor) doesn't work over ssh (at least not in a way you'd want to use it) so it does make sense to get used to some command line text editor. And vim is awesome once you get used to it.
does nano work over ssh then? "once you get used to it" is just not worth it for some people, especially if they're already fast with their current tools
Good luck using Sublime in a CLI environment... make a video and let us know when you get it working, you'll be the first to do it.
Seems dumb.. just use a regular text editor
Which editor would you suggest?
I use nano, because I have a girlfriend, a life and things to get done.
I use vim for the same reason. I get things done much quicker with it.
comment 104... ma privacy aside... i really enjoyed ur video. it help shed some light to the nuance working of vi that i didn't know. PLEASE DO A PART 2 TILL 5 MAX!!! AND MAYBE A REGULAR EXPRESSION TUTORIAL. since as enthusists it may be more of something referable in 5 min
I have a video about regular expressions.
@@GaryExplains thats great ....{mad rep} ... but it would be nice for MORE
#playlist for tutorials
@@GaryExplains i hav found it ....thanks... but PART 2 AND 3 are would be great