All Projects → TheBlob42 → drex.nvim

TheBlob42 / drex.nvim

Licence: GPL-3.0 License
Another directory/file explorer for Neovim written in Lua

Programming Languages

lua
6591 projects
Vim Script
2826 projects

Projects that are alternatives of or similar to drex.nvim

Nvim Tree.lua
A file explorer tree for neovim written in lua
Stars: ✭ 383 (+2453.33%)
Mutual labels:  neovim, file-explorer
Chadtree
File manager for Neovim. Better than NERDTree.
Stars: ✭ 653 (+4253.33%)
Mutual labels:  neovim, file-explorer
Ranger.vim
Ranger integration in vim and neovim
Stars: ✭ 510 (+3300%)
Mutual labels:  neovim, file-explorer
Tree.nvim
Neovim file-explorer powered by C++
Stars: ✭ 140 (+833.33%)
Mutual labels:  neovim, file-explorer
Fern.vim
🌿 General purpose asynchronous tree viewer written in Pure Vim script
Stars: ✭ 552 (+3580%)
Mutual labels:  neovim, file-explorer
Vim Netranger
A ranger-like system/cloud storage explorer for Vim, bringing together the best of Vim, ranger, and rclone.
Stars: ✭ 170 (+1033.33%)
Mutual labels:  neovim, file-explorer
Comment.nvim
🧠 💪 // Smart and powerful comment plugin for neovim. Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
Stars: ✭ 796 (+5206.67%)
Mutual labels:  neovim
dotfiles
dotfiles for my beautiful rices!
Stars: ✭ 440 (+2833.33%)
Mutual labels:  neovim
nvim.conf
datwaft's neovim configuration using Fennel
Stars: ✭ 65 (+333.33%)
Mutual labels:  neovim
nvim-jdtls
Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
Stars: ✭ 282 (+1780%)
Mutual labels:  neovim
neovim
🌟 Cool & Modularized vim configurations to work like an IDE
Stars: ✭ 17 (+13.33%)
Mutual labels:  neovim
dotfiles
⭐ My own world.
Stars: ✭ 12 (-20%)
Mutual labels:  neovim
close-buffers.nvim
📑 Delete multiple vim buffers based on different conditions
Stars: ✭ 54 (+260%)
Mutual labels:  neovim
dotfiles
🚀 tmux, ohmyzsh, powerlevel10k, neovim 🔧
Stars: ✭ 24 (+60%)
Mutual labels:  neovim
virt-column.nvim
Display a character as the colorcolumn
Stars: ✭ 64 (+326.67%)
Mutual labels:  neovim
denops-deno
🐜 Deno module for denops.vim
Stars: ✭ 16 (+6.67%)
Mutual labels:  neovim
dotfiles-legacy
. .✧ · 🌎 ✷ ✫ 🌙 · ✵ 🚀✵ * ✵ · 🌌✫ ✷ · ✧ .
Stars: ✭ 15 (+0%)
Mutual labels:  neovim
better-escape.nvim
Escape from insert mode without delay when typing
Stars: ✭ 166 (+1006.67%)
Mutual labels:  neovim
vim
📝 minimalistic vimrc based on KISS principle @vim
Stars: ✭ 46 (+206.67%)
Mutual labels:  neovim
.dotfiles
💻 My settings for macOS, kitty, zsh, nvim, tmux, and more 🛠
Stars: ✭ 44 (+193.33%)
Mutual labels:  neovim

DREX

Another DiRectory EXplorer for Neovim

drex For showcase GIFs see here

  • easily navigate through your file system
  • split window and project drawer support
  • add, copy, move, rename and delete elements
  • mark and operate on multiple elements
  • automatic file system synchronization
  • powered by libuv

Installation

DREX requires Neovim version ≥ 0.5

Install DREX with your favorite plugin manager

packer

use {
  'theblob42/drex.nvim',
  requires = 'kyazdani42/nvim-web-devicons', -- optional
}

vim-plug

Plug 'theblob42/drex.nvim'
Plug 'kyazdani42/nvim-web-devicons' " optional

You only need to install nvim-web-devicons if you like to have nice file type icons. The plugin works fine without it.

Usage

Open a DREX buffer in the current working directory

:Drex

You can also provide a target path

:Drex ~/projects

To open the parent directory of the current file

:Drex %:h

Check the manual for cmdline-special and filename-modifiers

DREX also comes with a simple project drawer functionality

:DrexDrawerOpen

See :help drex-commands for more available commands

Default Keybindings

To see the definition of all default keybindings see the configuration section

  • Use j and k like in any other VIM buffer to navigate up and down
  • v is mapped to V because there is no need for charwise selection

Basic navigation

  • l expands the current element
    • If it is a directory open its content in a subtree
    • If it is a file open the file in the current window

    <Right> and <2-LeftMouse> are alternative keybindings

  • h collapses the current directories subtree
    • If the element under the cursor is an open directory collapse it
    • Otherwise collapse the parent directory of the element

    <Left> and <RightMouse> are alternative keybindings

  • <C-v> opens a file in a vertical split
  • <C-x> opens a file in a horizontal split
  • <C-t> opens a file in a new tab
  • <F5> reloads the current directory (dependent on the cursor position)
  • <C-h> opens a new DREX buffer in the parent directory of the current root
  • <C-l> opens the directory under the cursor in a new DREX buffer

Jumping

  • gj jumps to the next sibling
  • gk jumps to the previous sibling
  • gh jumps to the parent directory of the current element

Clipboard

  • m marks or unmarks the current element (add or remove it from the clipboard)
  • M marks the current element (add it to the clipboard)
  • u unmarks the current element (remove it from the clipboard)
  • cc clears the clipboard content
  • cs to show and edit the content of the clipboard in a floating window

Actions

  • s shows the stats for the current element
  • a creates a new file or directory
    • to create a new directory end your input with a / (\ on Windows)
    • non-existent parent directories will be created (e.g. foo/bar/file will create foo and bar if they don't exist yet)
  • d deletes the element under the cursor (or the visual selection)
  • D deletes all elements currently contained in the clipboard
  • p copies all elements from the clipboard to the path under the cursor
    • this will NOT clear the clipboard, so you can continue to paste elsewhere
  • P moves all elements from the clipboard to the path under the cursor
  • r renames the element under the cursor (or the visual selection)
    • this can move the element to another location
    • non-existent parent directories will be created (e.g. foo/bar/file will create foo and bar if they don't exist yet)
  • R to multi rename all elements from the clipboard

Copy strings

  • y copies the name of the element under the cursor
  • Y copies the relative path of the element under the cursor
  • <C-Y> copies the absolute path of the element under the cursor

In visual mode these copy all selected elements (separated by "\n")

Configuration

There is no initial setup needed to use DREX.
However you may configure certain settings to your liking.

Check out the default configuration:

require('drex.config').configure {
    icons = {
        file_default = "",
        dir_open = "",
        dir_closed = "",
        link = "",
        others = "",
    },
    hide_cursor = true,
    hijack_netrw = false,
    sorting = function(a, b)
        local aname, atype = a[1], a[2]
        local bname, btype = b[1], b[2]

        local aisdir = atype == 'directory'
        local bisdir = btype == 'directory'

        if aisdir ~= bisdir then
            return aisdir
        end

        return aname < bname
    end,
    drawer = {
        default_width = 30,
        window_picker = {
            enabled = true,
            labels = 'abcdefghijklmnopqrstuvwxyz',
        },
    },
    disable_default_keybindings = false,
    keybindings = {
        ['n'] = {
            ['v'] = 'V',
            ['l'] = '<cmd>lua require("drex").expand_element()<CR>',
            ['h'] = '<cmd>lua require("drex").collapse_directory()<CR>',
            ['<right>'] = '<cmd>lua require("drex").expand_element()<CR>',
            ['<left>']  = '<cmd>lua require("drex").collapse_directory()<CR>',
            ['<2-LeftMouse>'] = '<LeftMouse><cmd>lua require("drex").expand_element()<CR>',
            ['<RightMouse>']  = '<LeftMouse><cmd>lua require("drex").collapse_directory()<CR>',
            ['<C-v>'] = '<cmd>lua require("drex").open_file("vs")<CR>',
            ['<C-x>'] = '<cmd>lua require("drex").open_file("sp")<CR>',
            ['<C-t>'] = '<cmd>lua require("drex").open_file("tabnew")<CR>',
            ['<C-l>'] = '<cmd>lua require("drex").open_directory()<CR>',
            ['<C-h>'] = '<cmd>lua require("drex").open_parent_directory()<CR>',
            ['<F5>'] = '<cmd>lua require("drex").reload_directory()<CR>',
            ['gj'] = '<cmd>lua require("drex.jump").jump_to_next_sibling()<CR>',
            ['gk'] = '<cmd>lua require("drex.jump").jump_to_prev_sibling()<CR>',
            ['gh'] = '<cmd>lua require("drex.jump").jump_to_parent()<CR>',
            ['s'] = '<cmd>lua require("drex.actions").stats()<CR>',
            ['a'] = '<cmd>lua require("drex.actions").create()<CR>',
            ['d'] = '<cmd>lua require("drex.actions").delete("line")<CR>',
            ['D'] = '<cmd>lua require("drex.actions").delete("clipboard")<CR>',
            ['p'] = '<cmd>lua require("drex.actions").copy_and_paste()<CR>',
            ['P'] = '<cmd>lua require("drex.actions").cut_and_move()<CR>',
            ['r'] = '<cmd>lua require("drex.actions").rename()<CR>',
            ['R'] = '<cmd>lua require("drex.actions").multi_rename("clipboard")<CR>',
            ['M'] = '<cmd>DrexMark<CR>',
            ['u'] = '<cmd>DrexUnmark<CR>',
            ['m'] = '<cmd>DrexToggle<CR>',
            ['cc'] = '<cmd>lua require("drex.actions").clear_clipboard()<CR>',
            ['cs'] = '<cmd>lua require("drex.actions").open_clipboard_window()<CR>',
            ['y'] = '<cmd>lua require("drex.actions").copy_element_name()<CR>',
            ['Y'] = '<cmd>lua require("drex.actions").copy_element_relative_path()<CR>',
            ['<C-y>'] = '<cmd>lua require("drex.actions").copy_element_absolute_path()<CR>',
        },
        ['v'] = {
            ['d'] = ':lua require("drex.actions").delete("visual")<CR>',
            ['r'] = ':lua require("drex.actions").multi_rename("visual")<CR>',
            ['M'] = ':DrexMark<CR>',
            ['u'] = ':DrexUnmark<CR>',
            ['m'] = ':DrexToggle<CR>',
            ['y'] = ':lua require("drex.actions").copy_element_name(true)<CR>',
            ['Y'] = ':lua require("drex.actions").copy_element_relative_path(true)<CR>',
            ['<C-y>'] = ':lua require("drex.actions").copy_element_absolute_path(true)<CR>',
        }
    },
    on_enter = nil,
    on_leave = nil,
}

Check out :help drex-configuration for more details about the individual options

Internals

Like vim-dirvish every line is just a file path hidden via conceal (plus indentation and an icon). For file system scanning, file interactions (add, delete, rename, etc.) and monitoring DREX uses libuv which is exposed via vim.loop

See also :help drex-customization and the Wiki for more information and examples

Credit

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].