Removing drex in favor of nvim-tree

For vinegar-style directory navigation. It seems like nvim-tree has
gotten better at this since I last tried it, and I prefer nvim-tree over
drex.
This commit is contained in:
Tyler Hallada 2023-12-01 15:26:01 -05:00
parent 7bc60f6c6a
commit 0a3afcec71
3 changed files with 14 additions and 66 deletions

View File

@ -435,13 +435,6 @@ return require('packer').startup(function(use)
require('plugins.rest-nvim') require('plugins.rest-nvim')
end, end,
} }
use {
'theblob42/drex.nvim',
requires = 'kyazdani42/nvim-web-devicons',
config = function()
require('plugins.drex-nvim')
end,
}
use { use {
'norcalli/nvim-colorizer.lua', 'norcalli/nvim-colorizer.lua',
config = function() config = function()

View File

@ -1,44 +0,0 @@
local drex = require('drex')
local elements = require('drex.elements')
-- open the home directory
vim.keymap.set('n', '~', '<CMD>Drex ~<CR>', { desc = "Open home [~] directory in drex" })
-- open parent DREX buffer and focus current file
vim.keymap.set('n', '-', function()
local path = vim.fn.expand('%:p')
if path == '' then
drex.open_directory_buffer() -- open at cwd
else
drex.open_directory_buffer(vim.fn.fnamemodify(path, ':h'))
elements.focus_element(0, path)
end
end, { desc = "Open current directory in drex" })
require('drex.config').configure({
hijack_netrw = true,
keybindings = {
['n'] = {
['~'] = '<CMD>Drex ~<CR>',
['-'] = '<CMD>lua require("drex.elements").open_parent_directory()<CR>',
['.'] = function()
local element = require('drex.utils').get_element(vim.api.nvim_get_current_line())
local left = vim.api.nvim_replace_termcodes('<left>', true, false, true)
vim.api.nvim_feedkeys(': ' .. element .. string.rep(left, #element + 1), 'n', true)
end,
['<CR>'] = function()
local line = vim.api.nvim_get_current_line()
if require('drex.utils').is_open_directory(line) then
elements.collapse_directory()
else
elements.expand_element()
end
end,
}
},
on_enter = function()
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.opt_local.signcolumn = 'no'
end,
})

View File

@ -1,9 +1,9 @@
require('nvim-tree').setup({ require('nvim-tree').setup({
-- hijack_netrw = true, hijack_netrw = true,
-- hijack_directories = { hijack_directories = {
-- enable = true, enable = true,
-- auto_open = true, auto_open = true,
-- }, },
view = { view = {
mappings = { mappings = {
list = { list = {
@ -17,15 +17,14 @@ require('nvim-tree').setup({
}, },
}) })
-- local function toggle_replace() local function toggle_replace()
-- local view = require('nvim-tree.view') local view = require("nvim-tree.view")
-- if view.is_visible() then if view.is_visible() then
-- view.close() view.close()
-- else else
-- require('nvim-tree').open_replacing_current_buffer() require("nvim-tree").open_replacing_current_buffer()
-- end end
-- end end
-- swapping this out with drex.nvim instead vim.keymap.set('n', '-', function() toggle_replace() end, { noremap = true, silent = true })
-- vim.keymap.set('n', '-', function() toggle_replace() end, { noremap = true, silent = true })
vim.keymap.set('n', '<leader>n', [[<Cmd>NvimTreeToggle<CR>]], { noremap = true, silent = true, desc = "Toggle [N]vim Tree" }) vim.keymap.set('n', '<leader>n', [[<Cmd>NvimTreeToggle<CR>]], { noremap = true, silent = true, desc = "Toggle [N]vim Tree" })