From the course: Learning Vim
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Open files from name
- In many cases I work with files that reference other files. If you look at "index.md"; Vim index dot md. You will see a list of files. Lets go to "new.txt"; So file, slash, new and enter. We can now copy the file name and open it, but instead of that we can use "gf", which stands for "go to file" and the new file will be opened. If you have an error from a compiler, such as in "error.txt" so colon e for edit, "error.txt". This is a very common format. We see the file name, the line number and the offending column. "gf" will open the file, but if you use g, shift, f, it will open the file in the right line. So g, shift, f, and we open the file in the right line number. Very handy. If you have "wget" or "crn" installed, you can even fetch URLs. Switch to "index.md". So, "b" buffer, "IN" and then tab and Vim will complete the file name. Now enter. Lets go to the bottom with shift, g. And then, w, w, w you get to the url. And now if you do "gf" Vim is going to fetch the sources and if…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
Start Vim with a command1m 38s
-
Challenge: Use Vim command4s
-
Solution: Use Vim command26s
-
Diff mode3m 4s
-
Challenge: Diff mode8s
-
Solution: Diff mode18s
-
Zip files1m 19s
-
Challenge: Zip file8s
-
Solution: Zip file22s
-
Open files from name1m 22s
-
Challenge: Open file to line number11s
-
Solution: Open file to line number26s
-
External commands2m 9s
-
Challenge: External command13s
-
Solution: External command31s
-
-