Hot answers tagged

16

You cannot use y, p etc., to copy files in netrw - it comes with its own commands. See :h netrw-mc: MARKED FILES: COPYING netrw-mc {{{2 (See netrw-mf and netrw-mr for how to mark files) (Uses the global marked file list) Select a target directory with mt (netrw-mt). Then change ...


13

As @Carpetsmoker points out in his comment, g:netrw_gx determines what will be considered part of a URI. By default it is set to "<cfile>". From the docs (:help <cfile>): <cfile> is replaced with the path name under the cursor It escapes me, why parameter parts (i.e. ?) of a URL are being disregarded as parts of a "path name", but I ...


12

Alternatively (the passing of directory argument(s) as in @EvergreenTree's answer relies on the autocmds of the netrw plugin, and aren't a general solution), you can pass any Ex command to Vim on startup via the -c argument: $ vim -c Explore You can also use +, which is exactly the same as -c, except slightly shorter: $ vim +Explore


12

In :help netrw-explore they mention several other commands to explore your files. Among them are :Texplore which opens the file explorer window in a new tab instead of using your current window. There are other variants you could try, like :Sexplore (horizontal split) or :Vexplore (vertical split). When your cursor is on a file, you can also hit o, v, ...


12

Instead of pointing Vim/Netrw to a file: scp://host/path/file point it to a directory: scp://host/path/ This gives you the same listing and the same shortcuts as if you were browsing your machine.


11

To solve this nuisance with netrw permanently, I added this to my .vimrc: " Per default, netrw leaves unmodified buffers open. This autocommand " deletes netrw's buffer once it's hidden (using ':q', for example) autocmd FileType netrw setl bufhidden=delete From Tim Pope.


10

The "Explore Mode" you are talking about is netrw, a vim plugin which is provided by default. It should open in that "mode" if you just try to open a directory with vim, eg. vim foo/bar/baz/


9

I would do this from the command line mode: Select the file you need in netrw Open command the line and type - :!mv <C-R><C-F> ../<C-R><C-F> Here <C-R><C-F> inserts file name under cursor, so you don't have to type the file name.


7

I set the following two options to ensure that Vim's current working directory is always the same as the current buffer's. set autochdir " Changes the cwd to the directory of the current " buffer whenever you switch buffers. set browsedir=current " Make the file browser always open the current ...


7

Yes, vim has a :cd command, which either prints the current directory or changes the current directory. In the help is this - note the last lines: :cd[!] {path} Change the current directory to {path}. If {path} is relative, it is searched for in the directories listed in |'cdpath'|. ...


7

I usually use a following flow when I want to open the file (while keeping the current file): Make a new vertical / horizontal split Open netrw from in the new split Select another file As mentioned in comments there are also :Sexplore and :Vexplore which do the split and open netrw at once, but I don't use them. I don't use :Explore too. Instead I use ...


7

From :h netrw-t: BROWSING WITH A NEW TAB netrw-t Normally one enters a file or directory using the <cr>. The "t" map allows one to open a new window holding the new directory listing or file in a new tab. So in the netrw window simply press t when your cursor is on the file or on the directory you want to open in the new tab. To do ...


7

You can use any of Vim's many buffer-switching commands to return to the file you were previously working on. Here's a few possibilities: Use the :buffer command to jump to the alternate buffer: :b # Use the normal mode command to jump to the alternate buffer: <C-^> Just step back through the jump list till you get there: <C-O> As Peter ...


6

The gx mapping is calling netrw#BrowseX(), so you could call that at the end of your function, passing in the l:site variable you've constructed: call netrw#BrowseX(l:site, netrw#CheckIfRemote()) I would also suggest that instead of getline('.'), you use expand('<cfile>'), which evaluates to the filename under the cursor. This will work when the URL ...


6

If you have netrw v153 or later, you'll have :Lexplore available. This command opens a window on the side of the display, and <cr> will cause editing to occur in window#2 (by default). You can change the default window to be used for editing by using the C map or by changing the variable g:netrw_chgwin.


6

This usually happens, if there are two or more buffers which are modified and Vim then usually toggles between them and shows the error message. So when :q! would abort the current buffer, it wouldn't not abort the other modified buffer, so therefore Vim protects you from losing changes and gives this error message. If you are absolutely sure, you want to ...


6

There is a dedicated command for opening a netrw listing in a vertical split: :Vex[plore] There is a dedicated command for going back to the latest netrw listing: :Rex[plore] Netrw comes with a complete documentation; read it: :help netrw.


6

I followed this script (https://www.reddit.com/r/vim/comments/6jcyfj/toggle_lexplore_properly/djdmsal/) and it works as expected. let g:NetrwIsOpen=0 function! ToggleNetrw() if g:NetrwIsOpen let i = bufnr("$") while (i >= 1) if (getbufvar(i, "&filetype") == "netrw") silent exe "bwipeout " . i ...


6

I've had this problem, when using Vinegar to make netrw easier to use. I found a site that offers one solution here, and more solutions here. The solution that worked for me, was to add this to my .vimrc: autocmd FileType netrw setl bufhidden=wipe For the sake of completeness, other solutions: @serebrov on Github: function! QuitNetrw() for i in range(...


6

According to following thread on the mailing list vim_use from 03.10.15 (https://groups.google.com/forum/#!topic/vim_use/6yqU3RX2CWA): How to copy and rename a file with netrw where the target and source directory are the same? answered by the author of netrw DrChip himself: Copy a file using the usual netrw method for copying: (assuming cursor ...


5

It is possible by setting the netrw configuration variable g:netrw_keepdir to 0 (default is 1). To make it permanent, add in the .vimrc file this line: let g:netrw_keepdir=0


5

The surround plugin defines global mappings. Unfortunately, you can only override those with buffer-local ones, but not :unmap them only in the buffer. Temporarily disabling and re-defining the global surround mappings would be possible, but is cumbersome. I think the best solution would be patching the netrw plugin to add the <nowait> argument to the ...


5

Try :bdelete! or :bd! for short. This stands for "buffer delete" and will close the buffer you have open. (Credit goes to Emil Asmussen) After that, you should be able to do :q! as normal.


5

Your autocmd is clearly correct, as you can see that the message is printed if you explicitly set the 'ft' with setl ft=netrw. The problem you are facing is that something is blocking the messages (such as :silent). But your autocmd is being called when the filetype is first set; you can ensure that by using this: au FileType netrw echom "ft is now netrw"|...


5

With :Vexplore, the current window is split in two and a netrw buffer is displayed in the new window. Repeating that command again and again will keep splitting the current window until the left half of the workspace is filled with very narrow netrw windows. :Lexplore is a toggle, this means that it switches between two states: The netrw window created ...


5

Newrw is distributed as a Vimball. After you download the new version, move netrw.vba.gz to ~/.vim. Then open it with vim, e.g., $ vim netrw.vba.gz You will see this message at the bottom of the screen: ***vimball*** Source this file to extract it! (:so %) Execute :so % and the plugin files will be extracted into the autoload, doc, plugin and syntax ...


4

I get a different result when I go this: the buffer consists of garbled text (gziped?). Perhaps your version of links and/or vim does something different with gzip-encoded text. Netrw, the plugin bundled with Vim which reads URLs tries a bunch of different commands to get the source of a page, but you can also set it explicitly. For example, to set it to ...


4

:E[xplore] does the same thing as :e %:h, and is shorter to type. If you look up :help :Explore, you can see that there are also variations to open the directory of the current file in a new tab or split instead of in the current window.


4

You could try setting the buftype option. E.g. doing :set buftype=nofile should make ignore that buffer. But I'am wondering how you could modify this buffer, since this should read-protected and not-modifiable.


4

No it isn't possible. Vim will be the child of your bash process. A child can't change the current directory of its parent (except by doing tricky and very discouraged things: https://stackoverflow.com/questions/2375003/how-do-i-set-the-working-directory-of-the-parent-process). You may also want to read: https://unix.stackexchange.com/questions/141313/...


Only top voted, non community-wiki answers of a minimum length are eligible