![]() Don't kill the started process when nvim exits. This was the main reason for using jobstop. This dialog is hidden so the process would just linger in the background forever for no reason. ![]() However, if no associated default-app is found, or the file doesn't exist, Windows tries to show a modal dialog, waiting for user input indefinitely. ![]() On windows it effectively uses cmd /c start so it opens all kinds of files/URLS with the system-associated app. If the invoked program, for whatever reason, still runs after 5 seconds, it is killed using jobstop. Here's a netrw-independent solution for neovim implemented in lua that uses instead of. That way, my vimrc stays platform-agnostic, and I'll just deal with the inconsistencies via bashrc/zshrc/fish config. :!open and just alias in your bashrc/zshrc/fish config the open command to whatever platform-specific program you have. You can just use one of them for your vim bindings, eg. I use all three platforms and they work great. □ nmap gx :sil !open Note on platform-specific programs to open a url: I like to silent my bindings, so adding and :sil will do the trick ( :help :map-silent) ![]() If you want the gx functionality back, you can just map using the same command: Notice the ! which indicates leveraging the power of external programs outside of vim. While you have your cursor on top of the url, is just a single step: □ So don't just stay in one mode, try to leverage the full power of vim. Combining this with different modes, taps the full power of vim. I'm surprised most solution doesn't leverage command workflow, I use ex-command a lot, :s, :g, :v, :argdo, :cdo, and friends. There's a reason why :w doesn't have normal bindings. Now for the solution, there's a binding in command mode, ctrl-r then ctrl-a ( :help c_CTRL-R_CTRL-A), to paste whatever you have in your cursor to the command line, so if you combine that with :!xdg-open / :!open (for mac), you pretty much set. I didn't want to load a plugin to get the gx functionality back. Since I disable netrw, ( :help netrw-noload) I found myself reaching gx for time to time. (dot command, which is mnemonic for the repeat command), do that on both selection or the actual line on a vim-dirvish buffer. And that is achieve by :Shdo, and it has a convenient key of. The important part is how natural these external programs interact with vim. Where it leverages the power of other programs in the terminal to do file manipulations, instead of trying to do everything by itself. The beauty of this plugin is it embraces the philosophy of VINE (Vim is not Emacs). I dropped vim-vinegar too because vim-dirvish have the - binding anyway, and most of the configuration of vim-vinegar is netrw specifics. I even tried it in a 10K file repo, listing files via - still instant! Someone tested vim-dirvish against Nerdtree, you can see the difference. I don't use remote editing much so vim-dirvish is powerful enough to manage my workflow (It's actually faster than netrw ~ the author claims 2x, I feel it's faster than that - it's really instantaneous ⚡) very useful on large codebase/repositories. This plugin has around 500~ LOC, compared to netrw's (11,000+ LOC). I was searching for a solution to this problem too since I actually removed netrw from being loaded in vim completely and replace it with vim-dirvish. For example, they use a different file-manager like vim-dirvish TLDR: This is a solution for people who removed netrw( :help netrw-noload) in vim/neovim.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |