12 ms·
I use gf (mnemonic: go file) all the time -- it will grab the string under the cursor (the cursor doesn't need to be at the start of it), then attempt to open a
by tasty_freeze 7y ago
I use gf (mnemonic: go file) all the time -- it will grab the string under the cursor (the cursor doesn't need to be at the start of it), then attempt to open a file with that name. You can look up the details but it uses a path type mechanism so if the name of the file isn't absolute, it will check the path.
- Shoop 7y agogf is awesome. Great for navigating scripts that run other scripts and also useful for creating links within a personal wiki of markdown files without a plugin like vim-wiki. While I do use a lot of plugins, I find it's a lot better to select plugins that add to vim's editing language (vim-eunuch, vim-surround, vim-vinegar, vim-exchange, vim-angry, vim-sexp-mappings-for-regular-people, vim-commentary) rather than plugins which agglomerate IDE features onto vim (vim-wiki, nerdtree, etc). While I do have a few of these IDE-like plugins (undotree, for example), I think it's better to try plugins which embrace the "vim way" first before investing in a full IDE-like plugin. I don't mean to gatekeep by criticizing IDE-like plugins, but just to say that spending the time to learn normal mode as a true language (verbs, nouns, and all) and using plugins that follow this idea is a worthy investment. Then, add IDE-like plugins to work around the frustrating rough edges of vim once you've milked all that you can out of it.
- AlkurahCepheus 7y agoDon't forget about its twin gx. For example on MacOS gx uses the open command to open a file in the default application. Really helpful when you want to open up a website quickly in your browser or you have the url to an image in a markdown file and want to see it. Helpful trick for relativ paths: https://www.reddit.com/r/vim/comments/7xs8x3/opening_local_relative_paths_with_gx/ https://www.reddit.com/r/vim/comments/7xs8x3/opening_local_r...