I'm 72, used Bill Joy's vi in the late 80's The muscle memory is still with with me (I use neovim now) It was, and is, brilliant if you want to write code while concentrating on thinking about the code you are writing or editing. You learn how to transfer thoughts to a keyboard without really thinking about how. That is what is so clever about the original vi. Designed to do what you need.
I switched from vscode to Vim a few months ago and I can not stress enought how much I love it. And imo, it's not just for programers if you write blogs it's a must have!
20:44 - An alternative to this that a lot of people use is remapping your Caps lock key to escape, an even better alternative is remapping your caps lock key to escape AND control, so that when you press caps lock alone it's registered as escape and when you press it with another key it counts as CTRL. In Linux there's this package called caps2esc which does that (it does it for every program not just VIM). When I discovered this I felt like a kid in a toy shop
I do similar things, but instead of ESC and Ctrl, I use ESC and Caps and map e.g. HJKL with Caps for moving the arrow key generally. Now I can use arrow keys with homerow in any app outside of vim as well. Caps A for umlaut etc. So I have another layer of shortcuts.
I used to be descent at vim in the 1990s when remotely programming on unix at the university however I have unfortunately forgotten everything about it and stick to nano from a terminal for at least the last 15 or so years.
@@DarkGladiator I had moved on to a windows software development and network admin job after I graduated and did not use vim. However a few years into that 2002/2003 I switched to using gentoo linux servers but the default editor was nano.
@@FakhryHTatanaki When I started in 1989 the labs had vt100 terminals but those were eventually replaced by solaris workstations and windows machines. I was a student at the university for 6.5 years and I work for them for 25+ now.
Coming from a Vim veteran here, there's nothing wrong with mouse=a Keyboard moves are great for quick and precise movements, but there are times when using the mouse just makes a lot of sense, like when you're browsing texts without specific aim and doesn't actually need to edit anything. Don't feel like you have to use the keyboard all the time, the mouse is there to be used. The problem is if you're using the mouse as a crutch instead of actually learning vim keyboard keys. That'll make it hard to actually improve your editing efficiency.
I often challenge myself at using only my mouse to navigate Windows. In fact, one of the things I used to show new Windows users was how much you can do with just the mouse.
@@zeocamo When I just read your comment I was like "wtf is he talking about? right click?" then I right clicked on my neovim window.. "omg he's right XD"
I agree. If you are actively editing in vim, then your hands really should be both on the keyboard. However if I'm going back and fourth between a web browser, or an image editor or whatever, then my right hand wont be on the keyboard. So that creates some tension, and there's cases for example where I will highlight and scroll with the mouse in vim because my right hand is already there and will probably need to stay on the mouse in the next moment when I go back to whatever else I was doing.
I've been a vi(m) user for the past 20+ years. I started my sysadmin career working on Solaris 2.6 and BSDi systems which were pretty primitive compared to today. I will say that even though I have been a long time user I still learn a new trick now and then. You will be surprised by how quickly those key strokes become muscle memory. Also, I always set vi keybindings (set -o vi) in my shell; try it if you have not already done so.
I was a vi user since the 90s and switched to vim 3 years ago when a coworker was using it. It's the first thing I install on any distro, or even inside dockers containers.
Do be sure that you can use it without your customized settings. A great advantage to vim is that it's always there on a Linux box. In fact, there is some advantage to knowing how to get by in vi, because the *nix systems that aren't Llinux may not have vim, but will have vi, and the basics are the same. (I prefer emacs myself, but that's rarely pre-installed on other peoples boxed. I started out with TECO - old old guy - which was what Stallman originally wrote emace in, since it was a highly programmable editor even way back then.) BTW, the direction for the arrow keys is that the DEC VT-52 and others had arrows over the letters on HJKL keys. I believe that HACK, a game from those days uses the same direction keys, or did. And vi, and maybe vim, has exed mode (:ex), harkening back to when we edited on printing terminals like teletype machines (I did my thesis on an Execuport 300 in the TJ6 markup language). Probably not worth it for you, but it's good to know if you wind up having to edit over a VERY slow connection, where having your screen constantly updated is just untenable.
Hack and NetHack do use the HJKL. Also, NetHack is still being developed to this day (though it's mostly bugfixes for those insanely obscure cases + QoL improvements)
if you start with neovim in stand of vim, it is more new user friendly with mouse support out of the box, and better default settings making it easier to get start.
@@StillConfusing yes and it easy to write in, and the LSP and treesitter and telescope and nullls etc. it is at a place now that you can build a great editor for you, or a PDE as Teej_dv call it.
If you for some reason do not like to figure out all your plugins on your own and your are switching from something like vscode, your should definitely try lunarvim initially created by a person also named Chris (chris@machine). It is a pretty popular set of neovim configs that makes neovim behave more like a modern IDE without you having to configure much. I'm sure there are other projects like it and you can try those as well.
@@Kalasklister1337 yes lunarvim is a nice project that i also help with a few things, but when you use it for a while then you need to learn get to fix stuff in neovim maybe with your own config
Nice. Kinda thinking my first live stream will be speed running vim tutor in neovim haha. Plan to dive into neovim quite a bit and work on some lua and python I believe
15:08 Oooo! For this I would use the multi cursor plugin. Select the content you want to search, then CTRL + N to duplicate the cursor till you've selected all of them, and then now you have selected all of them. I don't think I can link the github page, because I'm getting the feeling youtube is hiding comments containing links
Instant like for quickly addressing the "how to exit vim" argument. ZZ and ZQ for the win! String replacements in vim are magical also. Syntax is just like using sed. Undotree is one of my absolute favorite plugins for vim using vundle.
He finally did a video dedicated to Vim! Good coverage on it! Vim is a beast where there's always more to learn for how to use it in new ways, especially with the plugins. At least you don't need to be an expert to be proficient and able to benefit from it. Learn the basics and you'll already start being more efficient in how you edit files.
"The first thing to learn"...to exit: I remember an article comparing Windows (XP or 98) to Linux where the reviewer gave point to Windows because he couldn't shutdown Linux. It worked for a whole week (Linux stability), but he wanted to turn off his PC during the night.
Vim is like the alphabets for any language; the sooner you learn it, the sooner you benefit from knowing it. Similarly, the sooner you learn how to touch type, the sooner you benefit from the productivity that comes with knowing where ASDF is on the keyboard. Only you and you alone will benefit from Vim's high productivity until death do you part.
the g in the substituting is for global, and if you first select the lines with visual mode, then it will only run on the selected lines, then you can do(without %) :s/"//g and without the g here it will only replace the first " on the line
Just to add on something I find useful, the '%' sign at the beginning of the command tells the substitute command to run over the current file/buffer. You can also set a range using line numbers :20,30s/findthis/replacewiththis/g. The 'g' tells the substitute command to replace all occurrences of the located search expression on a line that it's operating on, otherwise it will only change the first occurrence on each line it operates on.
4:30 no it is not the only 3 modes, you can do a :h vim-modes for the full list and more details but it is notmal, visual, select, insert, command-line, ex, terminal, operator-pending, replace, virtual replace, insert normal, insert visual and insert select mode. so that is 13 modes not 3 but 13
One of the many things I learned using vim is one could map H and L to :bprev and :bnext respectively in nomal mode to move left and right between open buffers just for the muscle memory (since h and l navigates left and right respectively). H is for moving the cursor on top of the screen but one could use gg for that. L is for moving the cursor to the bottom of the buffer but one could use G instead.
I like that remapping idea for H and L to switch buffers, but your wrong about what the original H and L commands do. They only go to the top or bottom of the viewable buffer, not the entire file. I normally just use leader(space) p or n to go to previous or next buffer.
I came here to learn more about VIM, but I'm over 50, what should I do? If you're in IT, you should learn something new every day. It will keep you from stagnating. Once that sets in, you're pretty much done for. The great news for those of us over 50 is that eventually you will forget what you learned yesterday, so tomorrow will seem all fresh again and you get to re-learn it all over! Just like all those cert questions you learned and dumped within minutes of passing your MCSA or Security+. I can't remember what I had for dinner a few hours ago, but I can still remember an activation code for Windows XP. Thanks for the video Chris! When you pass 50, hit me up and we'll put arthritic fingers to keyboards and see who can still write PowerShell without using Google. I figure by then, PowerShell will be like the Windows XP license and I'll be able to just start typing...
To overcome that confusion between j for down and k for up, just make a gesture pointing down and say to your self "Your going down!". It's very natural to point down with your forefinger. Of course, pointing up with just your middle finger conjures the "Up yours" phrase. Those two mental images should get you going in the right direction more often.
ThePrimeagen, the speed demon of Vim. Can't believe you have not discovered him until now? I have been watching this guy for a while. I use Vim for my Linux note taking. My Linux notes are 14,000 lines long. Vim let's me move effortlessly to my documented command lines and scripts quickly.
Don't worry about hkjl, I also had trouble with it but after a while you get used to it. It's the same with a lot of VIM features they seem pretty counter-intuitive at first but after some time you feel like you are flying
Press 'Ctrl+[' in insert mode instead of pressing Escape and change the mode to normal mode. 'Control' plus 'Third Bracket'. Or, simply map ''jk"/"jj" to Escape. Using the mouse seems fair sometimes when you have to copy from other application windows such as a web browser. There's no shame in admitting that after using Vim loosely since 2013, I don't think that I'll know everything about Vim even at the end of my life. Nobody is a Vim master. It's just a matter of the level of mastery. How one uses Vim also counts. I still learn from new Vim users. I still look at vimrc files dated back to 1997. Like learning in all other disciplines, the journey to acquire mastery in Vim is a never-ending process. Good job! Keep it up!
Nice thing about vim is when somebody else tries to use your terminal they just sit there an press the escape key to leave, which is harmless and amusing. It is like having an editor with a keyboard lock.
6:18 "that's five words back... or actually there's some dots there, so it'll be three b from here, or two b, I can't count..." 😂, but seriously, use the capital W/E/B instead if you want to ignore all those special characters, it's generally easier to count that way.
I've been using vi the very first time I touched a unix system. When I install linux, vi/vim is one of the first things I install. I never learned any other editor. I have a cheat sheet from when I was in college.
I switched to Vim back in 2015 and it's been amazing. I need to go through my plugins and remove the old junk and look for new plugins. To learn Vim you need to immerse yourself completely and not lean on any crutches and you'll be competent within a week.
I agree with your view on j and k! When I first learned VIM, I decided to configure the vimrc to flip them around using nmap so I didn't have to bother making myself miserable learning the default way. So much better!
Hey Chris. In one of your past videos, ("Installing Linux The "Right" Way") you mentioned that you had created your own personal Debian mirror, and that you would soon make a video on how you did that. Did you ever make that video? I've been wanting to create a personal mirror of my own, and would like some direction. Thanks!
Thank you have learnt so much from you and JustAGuy Linux , DistroTube over the last two months. As a long time windows user (98 to win10? To big and loaded with stuff that I never used) I was so used to changing something in windows and waiting for the blue screen of death that I just stopped changing things. You have give me the confidence to try things in Linux and make the system suit me thank you again keep up the good work.
OMG you triggered VIM PTSD from college. I thought I had forgotten it. Vim on orange VAX terminals in Cobol class. Lucky us it was the very last semester it was required. We were busy reveling in Win-95 and dissing ancient systems.
Vi(m) is definitely the best command line editor. But I appreciate IDEs that have vi(m) capabilities either natively or via a plugin...and as long they exist, I use them every time. Oh BTW, the /etc/fstab can use double quotes just fine as I use them without issue.
I suggest lunar vim if you want to use neovim as an IDE. It has everything you need, including LSP, Git integration, fuzzy finders, menu system... it is my favorite.
@@jupiteriana. it is a ton of plugins! But the coolest thing is microsoft's lsp (language server protocol) which provides stuff like intellesense, syntax highlighting, etc. for almost any language you can think of. Also Git integration (do all of your git management from inside neovim)... essentially, it turns neovim into a full fledged IDE! You can get all of this stuff (or less) without lunar vim, but it is nice to have it all in once place. There are other packages that do similar things... lunarvim is the one I landed on.
Though you need some extra fonts installed, I've found AstroNvim to be a pretty good intro into using vim as an IDE Probably not optimal as regular vim/nvim with the same type of plugins and your own config is probably better, but.... it's a good fit for me
Personally, I just use "ctrl + [ " to escape out of insert mode. Saves on reaching for the escape key and also saves on having to use a plugin and/or script. Another option is using a macro tool to rebind "right-Alt" to "ESC".
@@JedHurricane Caps lock is ESC when tapped, and control when held (or pressed in combination with another key). I use a bit of software called karabiner elements.
@@rkdeshdeepak4131 you can use `:set ttimeoutlen=100` to speed that up a bit (it's because it's checking to see if you'll hit both keys in the mapping before it interprets it as the normal single key)
Thanks for sharing your vim's configuration, Chris. I have a question. How do you open the Markdown previews? Do you have another plugin or you can do it with vim-markdown?
10:17 I totally agree with you about j and k, I always thought j(up) and k(down) that how my brain work but vim is not. Anyway what your distro you use and why is looking so colorful, I've never see any distro have topbar like that.
For hjkl I feel the same and also have the dislike feeling hand needs to leave home row.. I try to remember 'j' sticks down so is down. Another option is separate learning(and practice use) h and l from learning j and k.
used to hate vim as well, until I decided to remove nano and force myself to use vim. I'm not proficient by any stretch of the imagination, but turning on vim mode in Obsidian really helped!
The very first thing I do when I install vim is to remap j+k to esc in insert mode so I never have to move my hands off of the home row; ctrl+[ is also a great default alternative to pressing escape in vim, escape is just a major annoyance when you quickly switch between normal and insert mode very often.
I hate the default location of escape and control, so at the OS level I mapped caps-lock to escape if pressed alone. I also have caps lock mapped to control when pressed with another key.
@@ambuj.k On windows you should use autohotkey. Its free and allows you to easily remap any of your keys to do whatever you like. Have not used windows in a few years now but i always liked autohotkey for its simplicity and power. Reason for binding rebinding capslock on OS level is that you use Escape a whole lot and caps lock is basically never used.
When MSDOS appeared, I used to prefer EDLIN to vi and any of it's rat-infested descendants. Because for several years In the 80's. I had to write software with vi and document it with vi & nroff. On terminals where all sorts of keys (up/down/let/right/etc) generated ESC sequences, happily terminating whichever idiotic vi mode you were in and dropping you into something random. EDT on VAX/VMS was marginally more useful, EDIT on MSDOS was not bad, TPU (also VAX) was rather lovely, and MicroEMACs was bliss. I do still remember how to get out of vi(m) and how to do the very basic stuff, lets call it scar tissue. It's surprisingly visceral after all those years. Sorry, nuffin personal.
@@ChrisTitusTech you only on the top of a really deep hole right now, if you push on with this in 30-60 days, you will be so close to Prim .. it go really fast when you start looking on others dot files and find lua plugins.
@@ChrisTitusTech Was going to ask the same question, but while checking your github for the cool terminal formating I happened to see the recent neovim repo :D Can't wait to see that video ;)
I prefer VS Code. Not because I like the UI or use any of its features and extensions but because it's an Electron application powered by JavaScript, the most-loved programming language among software engineers.
Chris, Chris, Chris, “I’ve only been using vim for a little over a month” 😂😂😂😂😂😂 What a crock of……. I’m one of the people who badgered you into seriously trying vim in the first place when you were doing regular streams over 2 years ago. Keep it honest, amigo. Being honest and real were two qualities that got you here. 😉 Great video otherwise.
Yes I opened VIM and used some of the basic commands on that stream, but for the most part all my editing was done in vscode. I've recently moved to almost using VIM exclusively in Linux. Still have vscode in Windows as gVim in Windows is rough as hell.
@@ChrisTitusTech yeah, I had to give you the business about that. You just got truly serious about vim recently. Well, you got a break from our badgering at least. LOL
Don't heh heh I'll be 50 years old to me Chris, you can do anything you set your mind to, I believe you could get there in several months at most. P.S. have you ever played "osu!" ?
I've been an unhappy Windows programmer for two decades. I loved Solaris and vi. This brings back happy memories. Does Vim still leave ~files around? That bothered me.
In order to make things more manageable with my vimrc, I've compartmentalized it; I have a .vim/config/ directory with like my '.vimrc.plug' and '.vimrc.plug.config' and even my '.vimrc.statusline' files, and then the .vimrc file sources them all. A bit more involved to set up initially, but I find it easier to find things.
This is the good stuff lol, I used to do this too-- you should look into the plugin folder for vim, it'll automatically run all the files in it for you so you don't have to manually get them in ur vimrc and make things even more clean.
You can and I certainly use that. Though I think if you are making extensive use of splits and tabs there may be an issue with your workflow that could be improved with various kinds of jumps and finders.
@@entelin I don't disagree with that completely! In general I use tmux anyway. But there are times when I want to compare files or something like that. But yeah, you are right. Tabs, buffers, and a fuzzy finder SHOULD be plenty for a normal work flow.
@@AndrewErwin73 ctrl i, ctrl o, and if coding lsp based jumps like jump definition and so on. I wish neovim would add a client/server solution where you could attach multiple copies of the client to a single server holding all the buffers. Because without that you can't be editing the same files across multiple tmux, or multiple systems, or split between monitors, etc. For example I have about 150 source files in my current programming project. Often I just open them all in the editor at once with vim src/*, but even if I didn't as I navigate I accumulate buffers and if then another copy of vim is opened it will step on that. There are multiple neovim gui clients, one of which supports detaching vim windows "fvim" so that's another possible solution though I haven't tried it yet.
What a lot of noobs (no offense) don't get is that even just the tippy tip of the vim iceberg will speed up your workflow. Just using the movement keys, search, and especially find and replace is way faster than not using vim.
have you ever looked into Doom Emacs? it uses a vim emulator so the key binds are similar but has more functionality with it being a graphical program (it also has a terminal mode). ps. emacs has a ssh client called TRAMP, it can also use sudo.
I got interested in emacs for awhile but decided it just wasn't worth it. The main thing emacs has over vim is a decent scripting language and client/server capabilities. Emacs lisp is clearly superior to vimscript, but both languages are slow. That's changing quickly with neovim however and the pace of development in neovim and the wider community of plugins is very high. LUA is far faster, cleaner, and has a large existing user base so many of the advantages of emacs I think will be erased over the next couple years. vi & vim's advantage over emacs has always been that it's a very functional program by default and ubiquitous, with genuinely inspired keybindings. Emacs can be made to be usable, but it's a very serious hobby to get somewhere that is a good experience, and even then the loading times can become genuinely obnoxious. Doom is a good project, and integrating the vim way of doing things certainly helps, but even then it's not all there and mixed with emacs bindings.
I don't know why but I hate VIM with no reason gonna watch this video later and I'll see if I will use it or no btw, what is the best IDE for shell scripting (please don't recommend sublime cuz I've already used it)?? edit: vim is OP, and I"m fallen in love with it, and for those people who don't use VIM and they wanna learn how to use it, go to the terminal and type "vimtutor" and you'll see kinda free offline VIM course (it works if you have VIM in your computer) and for me, VIM is such a great program for editing files that I wanted to write this comment using it but there's no VIM here on RUclips ;(
i've tried vim i've tried nvim. i don't do code im not a tech person really. i've tried to mess with stuff on linux but it's sort of hard to learn things when you never used it to begin with.
I really feel that lol-- you could try getting the browser plugins for it and stuff, like SurfingKeys n' such. Could help make it permeate more of your life's activities if you're looking for a second go at it.
I use vim (or gvim) just because I'm used to it. Sometimes I use vscode depending upon my mood. Going to another editor seems like a major time investment which I'd rather not do. Enjoy the videos.
Well, not to many people will be even near as close to make that speed. I go for Emacs any day, and if you are serious programmer or system administrator. And yes, there are a evil mode that is basically vi(1) keybindings for Emacs. If you must. A learn enough vi(1) to edit the configure and compile Emacs. But then configure came, and there was no need to learn vi/vim anymore. There only one way to fast quite vim(1), that is the power button. 😀 But seriously, vim(1) is just a thin layer on top of ed(1), so why bother with vim? 😀
like the video. but I'm such a noob programmer/scripter/Linux-user that this would definitely not speed up my workflow. i use nano for everything, ctr-s saves and ctr-x exits. nothing fancy, no memorizing... :-). I'll pretty need to learn if someday tho lol
"Try out once" - yea after doing vimtutor. If not your not getting anywhere, you restart your computer because you could not get out of it, and from there never boot up vim again 😅
I'm 72, used Bill Joy's vi in the late 80's
The muscle memory is still with with me (I use neovim now)
It was, and is, brilliant if you want to write code while concentrating on thinking about the code you are writing or editing.
You learn how to transfer thoughts to a keyboard without really thinking about how.
That is what is so clever about the original vi. Designed to do what you need.
I switched from vscode to Vim a few months ago and I can not stress enought how much I love it. And imo, it's not just for programers if you write blogs it's a must have!
20:44 - An alternative to this that a lot of people use is remapping your Caps lock key to escape, an even better alternative is remapping your caps lock key to escape AND control, so that when you press caps lock alone it's registered as escape and when you press it with another key it counts as CTRL. In Linux there's this package called caps2esc which does that (it does it for every program not just VIM). When I discovered this I felt like a kid in a toy shop
That indeed could be a gamechanger. Ty for sharing.
I've been using this setup for a year or so, it works well 👍
I do similar things, but instead of ESC and Ctrl, I use ESC and Caps and map e.g. HJKL with Caps for moving the arrow key generally. Now I can use arrow keys with homerow in any app outside of vim as well. Caps A for umlaut etc. So I have another layer of shortcuts.
I used to be descent at vim in the 1990s when remotely programming on unix at the university however I have unfortunately forgotten everything about it and stick to nano from a terminal for at least the last 15 or so years.
Why did you forget it? is it because you stopped using computers for a while or just stopped using vim
@@DarkGladiator I had moved on to a windows software development and network admin job after I graduated and did not use vim. However a few years into that 2002/2003 I switched to using gentoo linux servers but the default editor was nano.
Eyy I can relate to my uni days as well, the labs had windows installed 😝, so I ssh to my home server to do the programming using VIM
@@FakhryHTatanaki When I started in 1989 the labs had vt100 terminals but those were eventually replaced by solaris workstations and windows machines. I was a student at the university for 6.5 years and I work for them for 25+ now.
You might want to give Micro a try.
Coming from a Vim veteran here, there's nothing wrong with mouse=a
Keyboard moves are great for quick and precise movements, but there are times when using the mouse just makes a lot of sense, like when you're browsing texts without specific aim and doesn't actually need to edit anything. Don't feel like you have to use the keyboard all the time, the mouse is there to be used.
The problem is if you're using the mouse as a crutch instead of actually learning vim keyboard keys. That'll make it hard to actually improve your editing efficiency.
that is why neovim got it out of the box and got right click menus too.
I often challenge myself at using only my mouse to navigate Windows. In fact, one of the things I used to show new Windows users was how much you can do with just the mouse.
@@zeocamo When I just read your comment I was like "wtf is he talking about? right click?" then I right clicked on my neovim window.. "omg he's right XD"
I agree. If you are actively editing in vim, then your hands really should be both on the keyboard. However if I'm going back and fourth between a web browser, or an image editor or whatever, then my right hand wont be on the keyboard. So that creates some tension, and there's cases for example where I will highlight and scroll with the mouse in vim because my right hand is already there and will probably need to stay on the mouse in the next moment when I go back to whatever else I was doing.
Heresy. Your computer shouldn't even have a mouse.
I've been a vi(m) user for the past 20+ years. I started my sysadmin career working on Solaris 2.6 and BSDi systems which were pretty primitive compared to today. I will say that even though I have been a long time user I still learn a new trick now and then. You will be surprised by how quickly those key strokes become muscle memory. Also, I always set vi keybindings (set -o vi) in my shell; try it if you have not already done so.
I did NOT know we could do that in our shell. Ill check it out first thing tomorrow
The Primeagen can convince someone who doesn't even have a computer just by his excitement
I was a vi user since the 90s and switched to vim 3 years ago when a coworker was using it. It's the first thing I install on any distro, or even inside dockers containers.
This will be my 149th attempt to learn Vim after watching your video. Thanks Chris.
😄
Do be sure that you can use it without your customized settings. A great advantage to vim is that it's always there on a Linux box. In fact, there is some advantage to knowing how to get by in vi, because the *nix systems that aren't Llinux may not have vim, but will have vi, and the basics are the same. (I prefer emacs myself, but that's rarely pre-installed on other peoples boxed. I started out with TECO - old old guy - which was what Stallman originally wrote emace in, since it was a highly programmable editor even way back then.)
BTW, the direction for the arrow keys is that the DEC VT-52 and others had arrows over the letters on HJKL keys. I believe that HACK, a game from those days uses the same direction keys, or did.
And vi, and maybe vim, has exed mode (:ex), harkening back to when we edited on printing terminals like teletype machines (I did my thesis on an Execuport 300 in the TJ6 markup language). Probably not worth it for you, but it's good to know if you wind up having to edit over a VERY slow connection, where having your screen constantly updated is just untenable.
Cool ,Thank you for sharing
Hack and NetHack do use the HJKL. Also, NetHack is still being developed to this day (though it's mostly bugfixes for those insanely obscure cases + QoL improvements)
if you start with neovim in stand of vim, it is more new user friendly with mouse support out of the box, and better default settings making it easier to get start.
Agreed, I just moved since the video was made.
neovim is also great because lua is a real language that's pretty useful to know, and is also super fast
@@StillConfusing yes and it easy to write in, and the LSP and treesitter and telescope and nullls etc. it is at a place now that you can build a great editor for you, or a PDE as Teej_dv call it.
If you for some reason do not like to figure out all your plugins on your own and your are switching from something like vscode, your should definitely try lunarvim initially created by a person also named Chris (chris@machine). It is a pretty popular set of neovim configs that makes neovim behave more like a modern IDE without you having to configure much. I'm sure there are other projects like it and you can try those as well.
@@Kalasklister1337 yes lunarvim is a nice project that i also help with a few things, but when you use it for a while then you need to learn get to fix stuff in neovim maybe with your own config
Nice. Kinda thinking my first live stream will be speed running vim tutor in neovim haha.
Plan to dive into neovim quite a bit and work on some lua and python I believe
15:08 Oooo! For this I would use the multi cursor plugin. Select the content you want to search, then CTRL + N to duplicate the cursor till you've selected all of them, and then now you have selected all of them.
I don't think I can link the github page, because I'm getting the feeling youtube is hiding comments containing links
Instant like for quickly addressing the "how to exit vim" argument. ZZ and ZQ for the win! String replacements in vim are magical also. Syntax is just like using sed. Undotree is one of my absolute favorite plugins for vim using vundle.
No no you must reboot!!!
nice
yes .. newbie found ZZ and ZQ is for the people who just started out, but Chris is getting there, and we just need to keep helping him in he's steams.
gundo is also nice
He finally did a video dedicated to Vim! Good coverage on it! Vim is a beast where there's always more to learn for how to use it in new ways, especially with the plugins. At least you don't need to be an expert to be proficient and able to benefit from it. Learn the basics and you'll already start being more efficient in how you edit files.
"The first thing to learn"...to exit: I remember an article comparing Windows (XP or 98) to Linux where the reviewer gave point to Windows because he couldn't shutdown Linux. It worked for a whole week (Linux stability), but he wanted to turn off his PC during the night.
Vim is like the alphabets for any language; the sooner you learn it, the sooner you benefit from knowing it. Similarly, the sooner you learn how to touch type, the sooner you benefit from the productivity that comes with knowing where ASDF is on the keyboard. Only you and you alone will benefit from Vim's high productivity until death do you part.
the g in the substituting is for global, and if you first select the lines with visual mode, then it will only run on the selected lines, then you can do(without %) :s/"//g and without the g here it will only replace the first " on the line
Just to add on something I find useful, the '%' sign at the beginning of the command tells the substitute command to run over the current file/buffer. You can also set a range using line numbers :20,30s/findthis/replacewiththis/g. The 'g' tells the substitute command to replace all occurrences of the located search expression on a line that it's operating on, otherwise it will only change the first occurrence on each line it operates on.
4:30 no it is not the only 3 modes, you can do a :h vim-modes for the full list and more details but it is notmal, visual, select, insert, command-line, ex, terminal, operator-pending, replace, virtual replace, insert normal, insert visual and insert select mode.
so that is 13 modes not 3 but 13
😲🤯
One of the many things I learned using vim is one could map H and L to :bprev and :bnext respectively in nomal mode to move left and right between open buffers just for the muscle memory (since h and l navigates left and right respectively). H is for moving the cursor on top of the screen but one could use gg for that. L is for moving the cursor to the bottom of the buffer but one could use G instead.
I like that remapping idea for H and L to switch buffers, but your wrong about what the original H and L commands do. They only go to the top or bottom of the viewable buffer, not the entire file. I normally just use leader(space) p or n to go to previous or next buffer.
I came here to learn more about VIM, but I'm over 50, what should I do?
If you're in IT, you should learn something new every day. It will keep you from stagnating. Once that sets in, you're pretty much done for. The great news for those of us over 50 is that eventually you will forget what you learned yesterday, so tomorrow will seem all fresh again and you get to re-learn it all over! Just like all those cert questions you learned and dumped within minutes of passing your MCSA or Security+. I can't remember what I had for dinner a few hours ago, but I can still remember an activation code for Windows XP. Thanks for the video Chris! When you pass 50, hit me up and we'll put arthritic fingers to keyboards and see who can still write PowerShell without using Google. I figure by then, PowerShell will be like the Windows XP license and I'll be able to just start typing...
To overcome that confusion between j for down and k for up, just make a gesture pointing down and say to your self "Your going down!". It's very natural to point down with your forefinger. Of course, pointing up with just your middle finger conjures the "Up yours" phrase. Those two mental images should get you going in the right direction more often.
ThePrimeagen, the speed demon of Vim. Can't believe you have not discovered him until now? I have been watching this guy for a while. I use Vim for my Linux note taking. My Linux notes are 14,000 lines long. Vim let's me move effortlessly to my documented command lines and scripts quickly.
Don't worry about hkjl, I also had trouble with it but after a while you get used to it. It's the same with a lot of VIM features they seem pretty counter-intuitive at first but after some time you feel like you are flying
10:06 Chris vocalized the mechanical crisscrossed confusion as it was experienced
Press 'Ctrl+[' in insert mode instead of pressing Escape and change the mode to normal mode. 'Control' plus 'Third Bracket'. Or, simply map ''jk"/"jj" to Escape. Using the mouse seems fair sometimes when you have to copy from other application windows such as a web browser. There's no shame in admitting that after using Vim loosely since 2013, I don't think that I'll know everything about Vim even at the end of my life. Nobody is a Vim master. It's just a matter of the level of mastery. How one uses Vim also counts. I still learn from new Vim users. I still look at vimrc files dated back to 1997. Like learning in all other disciplines, the journey to acquire mastery in Vim is a never-ending process.
Good job! Keep it up!
It's really fun to watch your journey.
Also nice to compare it to our own journey.
Nice thing about vim is when somebody else tries to use your terminal they just sit there an press the escape key to leave, which is harmless and amusing. It is like having an editor with a keyboard lock.
6:18 "that's five words back... or actually there's some dots there, so it'll be three b from here, or two b, I can't count..."
😂, but seriously, use the capital W/E/B instead if you want to ignore all those special characters, it's generally easier to count that way.
I've been using vi the very first time I touched a unix system. When I install linux, vi/vim is one of the first things I install. I never learned any other editor. I have a cheat sheet from when I was in college.
I switched to Vim back in 2015 and it's been amazing. I need to go through my plugins and remove the old junk and look for new plugins. To learn Vim you need to immerse yourself completely and not lean on any crutches and you'll be competent within a week.
Accidentally found vi in 1996, while investigating a Solaris 2.3 machine. Was hooked on Vim while learning Linux in 1997.
I agree with your view on j and k! When I first learned VIM, I decided to configure the vimrc to flip them around using nmap so I didn't have to bother making myself miserable learning the default way. So much better!
Undo Tree feels like a local GitHub repository showing all your undo commits.
Do you know the vimium plug in for the browser ? You can use the vim stuff on the browser works on chromium and firefox.
Hey Chris. In one of your past videos, ("Installing Linux The "Right" Way") you mentioned that you had created your own personal Debian mirror, and that you would soon make a video on how you did that. Did you ever make that video? I've been wanting to create a personal mirror of my own, and would like some direction. Thanks!
Thank you have learnt so much from you and JustAGuy Linux , DistroTube over the last two months. As a long time windows user (98 to win10? To big and loaded with stuff that I never used) I was so used to changing something in windows and waiting for the blue screen of death that I just stopped changing things. You have give me the confidence to try things in Linux and make the system suit me thank you again keep up the good work.
OMG you triggered VIM PTSD from college. I thought I had forgotten it. Vim on orange VAX terminals in Cobol class. Lucky us it was the very last semester it was required. We were busy reveling in Win-95 and dissing ancient systems.
I too was amazed the first time I saw some theprimeagen videos, looks like chris just going through the same.
Prime also uses a DVORAK keyboard! I assume he has remapped keys so navigation is similar.
Best random password generator: give a non-tech person a vim and ask them to exit
I used vi in unix for many years! Thanks for the video...
Ara ara, Chris just invented a letter. 10:06
I had the same issue with "j" and "k". I started thinking about the bottom curve of "j" as pointing downward.
You could remap Esc to jj or jk by adding
imap your_key_combination
To your vimrc file and does the same thing you say the plugin does
I recently felt the need to learn vim because using arrow keys often isn't that efficient
Vi(m) is definitely the best command line editor. But I appreciate IDEs that have vi(m) capabilities either natively or via a plugin...and as long they exist, I use them every time.
Oh BTW, the /etc/fstab can use double quotes just fine as I use them without issue.
Meanwhile emacs exists
I suggest lunar vim if you want to use neovim as an IDE. It has everything you need, including LSP, Git integration, fuzzy finders, menu system... it is my favorite.
I'm having a hard time understanding what Lunar Vim is, is it Neovim with preinstalled plugins?
@@jupiteriana. it is a ton of plugins! But the coolest thing is microsoft's lsp (language server protocol) which provides stuff like intellesense, syntax highlighting, etc. for almost any language you can think of. Also Git integration (do all of your git management from inside neovim)... essentially, it turns neovim into a full fledged IDE!
You can get all of this stuff (or less) without lunar vim, but it is nice to have it all in once place.
There are other packages that do similar things... lunarvim is the one I landed on.
@@AndrewErwin73 thank you!
Though you need some extra fonts installed, I've found AstroNvim to be a pretty good intro into using vim as an IDE
Probably not optimal as regular vim/nvim with the same type of plugins and your own config is probably better, but.... it's a good fit for me
Personally, I just use "ctrl + [ " to escape out of insert mode. Saves on reaching for the escape key and also saves on having to use a plugin and/or script.
Another option is using a macro tool to rebind "right-Alt" to "ESC".
Map jk and kj to ESC, best thing. Will cause initial delay while navigatingbup or down though
Re-map caps-lock to be Esc when tapped, and Ctrl when held. I would never go back, it's so easy to use.
@@nodidog Say what? Also, how do you set up hold to ctrl?
@@JedHurricane Caps lock is ESC when tapped, and control when held (or pressed in combination with another key).
I use a bit of software called karabiner elements.
@@rkdeshdeepak4131 you can use `:set ttimeoutlen=100` to speed that up a bit (it's because it's checking to see if you'll hit both keys in the mapping before it interprets it as the normal single key)
I absolutely love vim! Been using it for more than two years now
I love that Mandalorian poster.
Let me suggest mastering splits and tabs. It was a game changer for me to explore code
Thanks for sharing your vim's configuration, Chris. I have a question. How do you open the Markdown previews? Do you have another plugin or you can do it with vim-markdown?
I highly recommend the book 'Practical Vim' by Drew Neil if you want to up your game. It's a treasure trove
Yeah, now Chris says that. It took some effort to get him there. 😁But he is right, it is the perfect editor.
senpai 😀.
Didn't know there is a way to share the yanks to the system via vimrc. Yay!
10:17 I totally agree with you about j and k, I always thought j(up) and k(down) that how my brain work but vim is not. Anyway what your distro you use and why is looking so colorful, I've never see any distro have topbar like that.
I had to find out once and for all. There is a Vigor editor. Next video: become an expert at Vim and vigor.
For hjkl I feel the same and also have the dislike feeling hand needs to leave home row.. I try to remember 'j' sticks down so is down. Another option is separate learning(and practice use) h and l from learning j and k.
used to hate vim as well, until I decided to remove nano and force myself to use vim. I'm not proficient by any stretch of the imagination, but turning on vim mode in Obsidian really helped!
The very first thing I do when I install vim is to remap j+k to esc in insert mode so I never have to move my hands off of the home row; ctrl+[ is also a great default alternative to pressing escape in vim, escape is just a major annoyance when you quickly switch between normal and insert mode very often.
I hate the default location of escape and control, so at the OS level I mapped caps-lock to escape if pressed alone. I also have caps lock mapped to control when pressed with another key.
@@Joe_Brig That is some complex keymapping, idk how you'd do that. I use windows and wsl so I just set jk to escape in vim extension settings.
@@ambuj.k I use a tool called Karibener on a Mac.
@@ambuj.k On windows you should use autohotkey. Its free and allows you to easily remap any of your keys to do whatever you like. Have not used windows in a few years now but i always liked autohotkey for its simplicity and power. Reason for binding rebinding capslock on OS level is that you use Escape a whole lot and caps lock is basically never used.
When MSDOS appeared, I used to prefer EDLIN to vi and any of it's rat-infested descendants. Because for several years In the 80's. I had to write software with vi and document it with vi & nroff. On terminals where all sorts of keys (up/down/let/right/etc) generated ESC sequences, happily terminating whichever idiotic vi mode you were in and dropping you into something random. EDT on VAX/VMS was marginally more useful, EDIT on MSDOS was not bad, TPU (also VAX) was rather lovely, and MicroEMACs was bliss. I do still remember how to get out of vi(m) and how to do the very basic stuff, lets call it scar tissue. It's surprisingly visceral after all those years. Sorry, nuffin personal.
Vim has buffers, that’s cool
What about Neovim? Love it so much that I mapped the vim alias to nvim on my bashrc.
Just moved from vim to nvim 2 days ago after I finished this video lol.
@@ChrisTitusTech you only on the top of a really deep hole right now, if you push on with this in 30-60 days, you will be so close to Prim .. it go really fast when you start looking on others dot files and find lua plugins.
@@ChrisTitusTech Was going to ask the same question, but while checking your github for the cool terminal formating I happened to see the recent neovim repo :D Can't wait to see that video ;)
Emacs The Ultimate Editor
I swapped the tilde key and escape key much nicer then the default location :P
you could also find global vimrc in /etc/vim/vimrc and uncomment line where it says "open on last edited line" to open where you left off.
I prefer VS Code. Not because I like the UI or use any of its features and extensions but because it's an Electron application powered by JavaScript, the most-loved programming language among software engineers.
I think Richard Stallman would disagree with this statement. I am also not the biggest fun of js.
One word; EMACS 😈
yea, Emacs is not useful any more after neovim got lua, now it is neovim that not all the plugins, email client too ;)
@@zeocamo This. There's still some benefits that emacs has, like client/server. But the advantages emacs has had are quickly evaporating.
Yessssssss!!!! I was waiting for this Chris. Woooohooo
Chris, Chris, Chris,
“I’ve only been using vim for a little over a month” 😂😂😂😂😂😂
What a crock of…….
I’m one of the people who badgered you into seriously trying vim in the first place when you were doing regular streams over 2 years ago.
Keep it honest, amigo. Being honest and real were two qualities that got you here. 😉
Great video otherwise.
Yes I opened VIM and used some of the basic commands on that stream, but for the most part all my editing was done in vscode. I've recently moved to almost using VIM exclusively in Linux. Still have vscode in Windows as gVim in Windows is rough as hell.
@@ChrisTitusTech yeah, I had to give you the business about that. You just got truly serious about vim recently. Well, you got a break from our badgering at least. LOL
Wow…. Let’s take a look!
EMACS for me, but vim is great too.
I am still to get there. Emacs is vast.
Don't heh heh I'll be 50 years old to me Chris, you can do anything you set your mind to, I believe you could get there in several months at most.
P.S. have you ever played "osu!" ?
But how do I exit it? 😭
You must reboot your computer
I've been an unhappy Windows programmer for two decades. I loved Solaris and vi.
This brings back happy memories.
Does Vim still leave ~files around? That bothered me.
vim is available for windows. you can move where those undesired files are created or disable them being made.
In order to make things more manageable with my vimrc, I've compartmentalized it; I have a .vim/config/ directory with like my '.vimrc.plug' and '.vimrc.plug.config' and even my '.vimrc.statusline' files, and then the .vimrc file sources them all. A bit more involved to set up initially, but I find it easier to find things.
This is the good stuff lol, I used to do this too-- you should look into the plugin folder for vim, it'll automatically run all the files in it for you so you don't have to manually get them in ur vimrc and make things even more clean.
Aside from tabs, you can also split the screen horizontally or vertically.
You can and I certainly use that. Though I think if you are making extensive use of splits and tabs there may be an issue with your workflow that could be improved with various kinds of jumps and finders.
@@entelin I don't disagree with that completely! In general I use tmux anyway. But there are times when I want to compare files or something like that. But yeah, you are right. Tabs, buffers, and a fuzzy finder SHOULD be plenty for a normal work flow.
@@AndrewErwin73 ctrl i, ctrl o, and if coding lsp based jumps like jump definition and so on. I wish neovim would add a client/server solution where you could attach multiple copies of the client to a single server holding all the buffers. Because without that you can't be editing the same files across multiple tmux, or multiple systems, or split between monitors, etc. For example I have about 150 source files in my current programming project. Often I just open them all in the editor at once with vim src/*, but even if I didn't as I navigate I accumulate buffers and if then another copy of vim is opened it will step on that. There are multiple neovim gui clients, one of which supports detaching vim windows "fvim" so that's another possible solution though I haven't tried it yet.
@@entelin nice! I haven't pushed neovim to that limit just yet! But it is good to know that I could.
Do you have totorials on that file manger built-in.
Should Get the vim cheatsheet and prints as mousepad when I forgot how to use it check the mousepad lol
BLAZINGLY FAST!
Great video, how did you put a window manager on Debian?
What a lot of noobs (no offense) don't get is that even just the tippy tip of the vim iceberg will speed up your workflow. Just using the movement keys, search, and especially find and replace is way faster than not using vim.
have you ever looked into Doom Emacs? it uses a vim emulator so the key binds are similar but has more functionality with it being a graphical program (it also has a terminal mode).
ps. emacs has a ssh client called TRAMP, it can also use sudo.
I got interested in emacs for awhile but decided it just wasn't worth it. The main thing emacs has over vim is a decent scripting language and client/server capabilities. Emacs lisp is clearly superior to vimscript, but both languages are slow. That's changing quickly with neovim however and the pace of development in neovim and the wider community of plugins is very high. LUA is far faster, cleaner, and has a large existing user base so many of the advantages of emacs I think will be erased over the next couple years. vi & vim's advantage over emacs has always been that it's a very functional program by default and ubiquitous, with genuinely inspired keybindings. Emacs can be made to be usable, but it's a very serious hobby to get somewhere that is a good experience, and even then the loading times can become genuinely obnoxious. Doom is a good project, and integrating the vim way of doing things certainly helps, but even then it's not all there and mixed with emacs bindings.
20:52 its all fun and games until you find yourself writing a JJ Abhrams fanfic
I don't know why
but I hate VIM with no reason
gonna watch this video later and I'll see if I will use it or no
btw, what is the best IDE for shell scripting (please don't recommend sublime cuz I've already used it)??
edit: vim is OP, and I"m fallen in love with it,
and for those people who don't use VIM and they wanna learn how to use it, go to the terminal and type "vimtutor" and you'll see kinda free offline VIM course (it works if you have VIM in your computer)
and for me, VIM is such a great program for editing files that I wanted to write this comment using it but there's no VIM here on RUclips ;(
firenvim seems to work with youtube's comment box last I checked ;)
i've tried vim i've tried nvim. i don't do code im not a tech person really. i've tried to mess with stuff on linux but it's sort of hard to learn things when you never used it to begin with.
I really feel that lol-- you could try getting the browser plugins for it and stuff, like SurfingKeys n' such. Could help make it permeate more of your life's activities if you're looking for a second go at it.
My typical use case in VIM is like this. I 2x click a txt file, it opens in vim, I press shift zz and look for a different editor.
I recommend Jason Cannon course about vim on udemy. It might be expensive, but it will drive you in right direction.
do you cover the sea captians blend?
Thanks... it's working... Good Job...!
The absolute Vim editor is Helix, feature complete, no plugins, no electron, tsp, lsp built-in, multi-platform, rust
I like the cheatsheet. Can you make it available for download or did I miss the link somewhere?
... and finally, your starting to install all the vim plugin available to most software your using.. browser at least.
I use vim (or gvim) just because I'm used to it. Sometimes I use vscode depending upon my mood. Going to another editor seems like a major time investment which I'd rather not do. Enjoy the videos.
I can’t use another editor easily. I keep trying to use the vim keys out of habit.
I can't use anything that doesn't have vim keybindings.
My email, pdf viewer, browser, file manager everything has vim keybindings at this point.
@@user-he4ef9br7z what email tho?
@@ISCARI0T Neomutt
@@user-he4ef9br7z ah okay
You should do a video on the benefits of using mutt as your email client.
Is it works on Windows? Is it Visual Studio extension? Do you need virtual linux machine for it? ^.^
You have it with git for windows console, you may install it separately, may use gvim.
Thank you, Chris.
Well, not to many people will be even near as close to make that speed. I go for Emacs any day, and if you are serious programmer or system administrator. And yes, there are a evil mode that is basically vi(1) keybindings for Emacs. If you must.
A learn enough vi(1) to edit the configure and compile Emacs. But then configure came, and there was no need to learn vi/vim anymore.
There only one way to fast quite vim(1), that is the power button. 😀
But seriously, vim(1) is just a thin layer on top of ed(1), so why bother with vim? 😀
like the video. but I'm such a noob programmer/scripter/Linux-user that this would definitely not speed up my workflow. i use nano for everything, ctr-s saves and ctr-x exits. nothing fancy, no memorizing... :-). I'll pretty need to learn if someday tho lol
"Try out once" - yea after doing vimtutor. If not your not getting anywhere, you restart your computer because you could not get out of it, and from there never boot up vim again 😅