0:00 - Introduction 0:53 - edit a file in vim (vim filename.txt || vi filename.txt) 1:12 - how to quit vim (:q) 1:50 - saving files in vim, and other ways of exiting 2:12 - what are vim modes (ESC/i) 3:14 - how to delete a single line with vim (dd) 3:30 - how to delete multiple lines with vim (#dd, e.g. 5dd) 3:47 - how to undo changes in vim (u) 4:06 - how to 'redo' changes (ctrl-r) 4:32 - searching text in vim ( /yourtext + ENTER) 5:52 - how to find and replace text in vim ( :%s/yourtext/replacetext/g (+c)) 7:23 - Conclusion
Thanks, I *really* wanted to get those in there but was already over my original goal of 5 minutes. I figured copy/paste can still be done with the normal readline shortcuts that people are used to from working in the shell, but the vim commands you mention are better. Cheers!
D'OH -- I *knew* I would get something simple like this wrong. That's what I get for being an emacs user :-D. Thanks so much for pointing this out. Cheers!
_pressing colon in normal mode_ Launches unguided floaters. _pressing colon in command mode_ Launches guided floaters. I need to stop watching these videos that make no sense to me and then making $hitty puns..
Actually I think this is overtly the wrong way to teach vi. It's almost always taught like this and it's the reason why so many people are confused about and hate vi. The tutorial *does* give you the basics you need to get in, edit text, and exit. However... if you see vi as a long list of random commands it will fundamentally be frustrating, make no sense, and be hard to remember let alone advance your skills. Rather, by putting an emphasis on the easy to remember fundamental movement primitives and how they can be chained together to form the "vi language" is critical to understanding why vi is so elegant, rather than leaving people wondering why an editor would be modal in the first place. If a beginner tutorial doesn't demonstrate how you can combine primatives into something like ciw (change inner word) or ci" (change inner quotes) and then repeat it on a totally different word with period... then honestly many people just won't get it, and continue to see vim as some kind of relic of the distant past rather than the elegant tool that it is.
you goota be one of the most professional youtube teachers I-ve ever seen. even the videos timeline has the codes to assist. this is gold man, definately spreading the word!
I first used vi in the early 90's it is one of those tools you either use all the time or you forget all the shortcuts, so thanks for the refresher. One thing you missed is: set nonumber. Always handy to know how to unset something you showed how to set. All the best!
Great! Vim was recommended to me yesterday by the lead developer where I work. (I am not currently employed as a developer, I just befriended this gentleman.) I currently alternate between two of the most popular text editors in my studies, and I will be beginning my studies in a coding boot camp 2 days from now. I am convinced that this will be a valuable tool in my developer's tool box, and your simple
you've done a great tutorial! Clear, concise explanation but you've also struck the balance between being useful and getting overwhelming. Keep up the good work!
cut from current line to specified: d G replace word from current position cw replace entire word: ciw Replace line from current position: C my most appreciated commands
Have you guys heard about micro? It's a terminal code editor designed to be one step above nano. It has modern shortcuts, full mouse support and syntax highlighting.
I've seen this video a couple of months ago and ended up falling back to nano, but I'm once again trying to use this as my main terminal editor, and I gotta say I really enjoy it, thank you for making such a consive video, that's what makes the linux community go forward.
Another basics that I recommend: :! - send command to terminal (useful for git stuff and some basic commands, not recommended for interactive commands) :e - open the netrw file navigator inside vim (you can simply type ":e ." to use it on the current directory) :tabnew - create a new tab :tabedit - opens a new tab editing a specific file (or you can type ":tabedit ." to use netrw for interective file selection) g, t - switch to the right tab g, T - switch to the left tab Some tricks with split: CTRL + w, arrow (up/down/left/right) - split navigation (when you use :term, NERDTree and another split stuff inside vim, similar to tmux) :term - opens a shell inside vim (neovim and most recent versions of vim, work as a split) CTRL + w, s - create a vertical split (or you can type ":vsp" on normal mode) CTRL + w, v - create a horizontal split (or you can type ":sp" on normal mode) And some of my favorite extensions: :Files - opens a fzf navigation through the current directory (useful for large projects) :VirtualEnvActivate - forces vim to use Python from a specific virtualenv (I've tested it with virtualenvwrapper, maybe works with venv too) :VirtualEnvList - list all virtualenvs :VirtualEnvDeactivate - switch back to the default Python from OS For the :Files you need fzf and fzf.vim (both from junegunn on GitHub), and for the VirtualEnv commands you need vim-virtualenv (from jmcantrell on GitHub).
Omg thank you so much just started my Operating systems course and had no idea what vim was this was an amazing introduction really appreciate the simplicity of it!
A great way to teach people vim is to have them install the vscode plugin. Then teach them things like the built in find and replace can be replaced by %s/foo/bar/g etc. Super nice
@@chezchezchezchez If you install neovim, and use the neovim extension. It basically has full neovim functionality whilst also including inbuilt vscode functionality. Very nice
@6:34 the 'g' stands for "global". Greedy is a term that's usually used to describe regular expressions that look for as many matches as possible. They have similar definitions, but are used differently when describing those specific use cases. Hope this helps. :)
Good quick overview, thanks. I used vi for 20 years. Now after a long period of not programming, I'm getting back into it. I hope the memory is still retained in my fingertips. BTW, g means "global" not "greedy"
Thanks. I'm pretty damn new to all of this and had avoided vim as there seemed to be two camps, those that used editors like nano and avoided vim like Covid-19 and those that gave you the feeling that any GUI was heresy. You explained it easily, almost casually and didn't make it appear daunting at all
Glad that you got something out of it! And it's a miracle that I cut this video down to 8 minutes. Most of my videos promise 8 minutes and end up actually being 30, because I get extremely excited about whatever I'm talking about and lose track of time :-D.
@@tutoriaLinux Glad that you cut it down to 8 minutes. I was looking for something simple to learn basic editing. 1 week of starting with Vim and I can go by without touching the mouse. I am still very slow, but I will get there. Thanks.
holy moly, as a person that’s used non-terminal apps ‘n fat IDEs, this was refreshing! thanks for this. i personally always thought it was some ancient thing with wonky commands... it seem i was thinking of emacs...
Your channel is the most useful source of tips and tricks for me. Without 'My 90 reasons to not use Windows' and 'Why we should burn systemd to the ground' stuff. I very much appreciate it.
This was actually a very helpful explanation, just what I was looking for! Great job. I have used LInux (dabbled with Ubuntu, Debian, Debian derived distributions, Fedora, ...) and some Bash shell command line commands - the famous powerful Linux emulator tool: THE THERMINAL! /dreaded by people who are only used with GUI's , beloved by powerusers -- since about 6 years ago, but I have also spend a lot of time on OS X as I dualbooted it with Linux, in which longer time period I dabbled a lot less with Linux and the command line. I'm not a programmer, developer, system administrator whatsoever, I don't know any programming language. (had a few python lessons which I was terrible at, score of 1/4 for a project - which I 'kind of' copied huge parts from a friend -: programming an hourglass with a visual presentation and so dreaded it pretty terribly) But I find open-source software, the Linux and GNU philosophies, the forms of freedom you can find in it, to be pretty enchanting; so finally getting a first grasp on one of the, if not most, widely used CLI text editors across the Unix and Unix-like landscapes is pretty cool. A computer that just works for desktop applications is very understandable, not everybody wants to thinker, break, fix, find, source, compile, fail & try again; with their computer. But it has a uniqueness to it. I've always prefered Unix & the like systems some way above Windows, even though the Linux & Unix desktops are 'scattered', if you know what I'm trying to say. Yes, I'm talking about desktop experiences/little experiments, not server and other applications.
wow, I found this video to be exactly the type of quick and dirty explanation I needed. I hope you have more videos just like this for EVERYTHING. I subbed and will rifle through your videos now. Great Vid, seriously
Some tips I learned from working on remote servers with really unreliable connections, dialing into Unix, Solaris and the not-so-usual server kind: - you'll find vi in pretty much ANY *nix system, doesn't matter how old, small it can be, vi, will most likely be there, so LEARN IT, some day in the fallout future you might have to work on a terminal from 1982 - You can press ESC as many times as you want, very good if you have significant input lag and you're not sure where you're standing. - "hjkl" replaces arrow keys. Useful when you're not sure if all the keyboard signals are being sent/received with different communication protocols. - 0 takes you to the first character of the line, $ to the last - w takes you one word forward, b one back - There's shells like "ksh" that leverage vi in the command line We could go all day ! :)
I found vim difficult so use nano. But your easy explanation will make me to try vim again. It is much easier than I thought. Thanks for the clear explanation.
I cant believe this video is upto 8mins, it seemed more like 2mins as it was really interesting to watch, I naturally like the simplicity of nano but because of you, I am gonna quit using nano and switch to vim. you should definitely make a part two. Also, that joke about sticking a noob into a terminal running vim and them not being able to quit is soo true, faced it many times 🤣😂
heh, i got my first job in devops a few months back. i had only ever used emacs - didn't realize that every machine i'd ssh into would only have vim. i asked the team if i could install emacs on everything, and the response was "the hosts already have an OS, they don't need another one" ahahaha this and tmux are the two things i wish i'd learned before starting.
That's too funny! ...stick a noob in front of a keyboard and get him to quit vi... Hey, that was me! Based on that alone (I'm still going through your video, only at 1:52 on the timer as of this comment) I'm commenting and subscribing.
Colon then (q) to quit. This is exactly what I came here to learn. Leaving now! P.s.: In remote server when you do not have Sublume and Atom, Vim is not the only choice, there is always Pico and Nano.
One thing thats rarely mentioned on Vim videos is the need to be a touch-typer. i.e you should be able to type text with all fingers without looking at the keyboard. If you're a two finger typer, you will be missing out on 80% of what Vim is about. Seriously, Touch-Typing is a pre-requisite for successfully and fully using Vim. ...that and remapping your Caps Lock key to function as Esc.
Can learning VIM well allow me to replace all other editors - even markdown editors and maybe even LibreOffice? Can it use images? I use markdown a lot (efficient as heck). I am learning nano now as I hope to have a server and may need to access it remotely on rare occasion. I am also trying out gedit (so easy!) and micro, but am not convinced that micro can be accessed remotely (for a noob, at least) and I know gedit cannot (I use Debian, not Ubuntu).
i am using a remote server on putty on mac and I am trying to copy a c code in the vim but i am not able to, I have tried everything. the code is in my mac and I want to copy the code into the file which I have created in the remote server using vim. how do I do that.