From d529e27645c32b1db059be75e5b17e3e02b805b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Ferando=20Carri=C3=B3n?= Date: Fri, 11 Oct 2024 09:58:05 +0200 Subject: [PATCH] updates from sal-7 --- home/any/bash/.bashrc | 2 +- home/any/vim/.config/nvim/init.lua | 1 - .../{lazy => _lazy_deact}/nerdtree.lua | 28 ++++----- .../any/vim/.config/nvim/lua/crthaze/init.lua | 2 + .../nvim/lua/crthaze/lazy/nvim-tree.lua | 61 +++++++++++++++++++ .../vim/.config/nvim/lua/crthaze/remap.lua | 4 ++ 6 files changed, 82 insertions(+), 16 deletions(-) rename home/any/vim/.config/nvim/lua/crthaze/{lazy => _lazy_deact}/nerdtree.lua (76%) create mode 100644 home/any/vim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua diff --git a/home/any/bash/.bashrc b/home/any/bash/.bashrc index 4774f83..5bdf894 100644 --- a/home/any/bash/.bashrc +++ b/home/any/bash/.bashrc @@ -161,7 +161,7 @@ fi [[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh -if [ -d ~/.atuin ] +if [ -f "$HOME/.atuin/bin/env" ] then source "$HOME/.atuin/bin/env" eval "$(atuin init bash --disable-up-arrow)" diff --git a/home/any/vim/.config/nvim/init.lua b/home/any/vim/.config/nvim/init.lua index a25b97c..5b28f6c 100644 --- a/home/any/vim/.config/nvim/init.lua +++ b/home/any/vim/.config/nvim/init.lua @@ -1,2 +1 @@ require("crthaze") - diff --git a/home/any/vim/.config/nvim/lua/crthaze/lazy/nerdtree.lua b/home/any/vim/.config/nvim/lua/crthaze/_lazy_deact/nerdtree.lua similarity index 76% rename from home/any/vim/.config/nvim/lua/crthaze/lazy/nerdtree.lua rename to home/any/vim/.config/nvim/lua/crthaze/_lazy_deact/nerdtree.lua index 6a67d9d..9a4ecd4 100644 --- a/home/any/vim/.config/nvim/lua/crthaze/lazy/nerdtree.lua +++ b/home/any/vim/.config/nvim/lua/crthaze/_lazy_deact/nerdtree.lua @@ -29,20 +29,20 @@ return { end } ) - -- vim.api.nvim_create_autocmd( - -- "VimEnter", - -- { - -- pattern = {"*"}, - -- callback = function() - -- if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') - -- execute 'NERDTree' argv()[0] - -- wincmd p - -- enew - -- execute 'cd '.argv()[0] - -- end - -- end - -- } - --) + -- vim.api.nvim_create_autocmd( + -- "VimEnter", + -- { + -- pattern = {"*"}, + -- callback = function() + -- if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') + -- execute 'NERDTree' argv()[0] + -- wincmd p + -- enew + -- execute 'cd '.argv()[0] + -- end + -- end + -- } + -- ) end }, { diff --git a/home/any/vim/.config/nvim/lua/crthaze/init.lua b/home/any/vim/.config/nvim/lua/crthaze/init.lua index fd087a0..6b35ff9 100644 --- a/home/any/vim/.config/nvim/lua/crthaze/init.lua +++ b/home/any/vim/.config/nvim/lua/crthaze/init.lua @@ -56,3 +56,5 @@ autocmd('LspAttach', { vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 + +ColorMyPencils() diff --git a/home/any/vim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua b/home/any/vim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua new file mode 100644 index 0000000..a6adac1 --- /dev/null +++ b/home/any/vim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua @@ -0,0 +1,61 @@ +local HEIGHT_RATIO = 0.8 +local WIDTH_RATIO = 0.5 + +return { + { + "nvim-tree/nvim-tree.lua", + init = function() + -- disable netrw at the very start of your init.lua + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- optionally enable 24-bit colour + vim.opt.termguicolors = true + + -- empty setup using defaults + require("nvim-tree").setup() + + -- OR setup with some options + require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + float = { + enable = true, + open_win_config = function() + local screen_w = vim.opt.columns:get() + local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + local window_w = screen_w * WIDTH_RATIO + local window_h = screen_h * HEIGHT_RATIO + local window_w_int = math.floor(window_w) + local window_h_int = math.floor(window_h) + local center_x = (screen_w - window_w) / 2 + local center_y = ((vim.opt.lines:get() - window_h) / 2) + - vim.opt.cmdheight:get() + return { + border = 'rounded', + relative = 'editor', + row = center_y, + col = center_x, + width = window_w_int, + height = window_h_int, + } + end, + }, + width = function() + return math.floor(vim.opt.columns:get() * WIDTH_RATIO) + end, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + }) + + vim.keymap.set("n", "e", "NvimTreeToggle") + end + } +} diff --git a/home/any/vim/.config/nvim/lua/crthaze/remap.lua b/home/any/vim/.config/nvim/lua/crthaze/remap.lua index 8626e62..1e32bb4 100644 --- a/home/any/vim/.config/nvim/lua/crthaze/remap.lua +++ b/home/any/vim/.config/nvim/lua/crthaze/remap.lua @@ -56,3 +56,7 @@ vim.keymap.set("n", "", function() vim.cmd("so") end) +vim.keymap.set("n", "nn", function() + vim.cmd("set relativenumber!") +end) +