Probably my most useful (neo)vim productivity tip is:
vim.keymap.set('n', '\\.', ':tabedit %:p:h<CR>')
My leader is \, so when I press \. it will open netrw in a new tab in the directory containing the file whose buffer I was just editing. I use this all the time when I need to navigate source trees as I don't care much for fuzzy file finders. Credit to -romainl- who taught me about %:p:h.
I imagine you aren't going to install a plugin for this but oil.nvim is really great for this as you can also use it to edit your directory listing like a buffer to easily create/rename and delete files and directories.
https://github.com/stevearc/oil.nvim
I've used oil/vinegar for a decade or more, I'd be entirely lost without -
This is really handy, thank you!
There's a shorthand :Texplore which does the same thing as your :tabedit invocation. Also, if you change it to
, it'll open the directory of the current file and put the cursor on the current file.I've added this to my .vimrc:
This binds Ctrl-b to browse in the directory of the current file.I just got around to trying :Texplore -- had no idea this existed, cool find.
Tossing up the idea whether to switch to Texplore, but you know if it aint broke...
Edit: Switched to :Texplore and also have \v bound to :Vexplore -- very handy.
I've got a lot of shortcuts set up for telescope (fuzzy finder ui in neovim). One of them is leader fa for "find around" which limits the file list to current directory and the next level down (only). It's quite useful in the same scenario.
The regular fuzzy finder is unfortunately useless in the home directory (too many files), with this limit, it's useful.
oh that's great -- i think i got it working with the following config:
This is what I do to include the depth restriction
I have the same, except via ranger.vim, which integrates it with said program - it's an excellent pairing