all repos — dotfiles @ 8f037c747cd32d3dcd7b3d56f0d3c12b5b889522

linux dotfiles

nvim: change colors and nvim tree style
Prithu Goswami pg@prithu.dev
Sun, 26 Nov 2023 17:22:16 +0530
commit

8f037c747cd32d3dcd7b3d56f0d3c12b5b889522

parent

306e72da75f9685669c6a640200a6570b5a455a1

M config/nvim/init.luaconfig/nvim/init.lua

@@ -3,6 +3,7 @@ require 'options'

require 'keymaps' require 'completion' require 'lsp' +require 'highlights' -- TODO move each plugin setup to own file local function nvim_tree_on_attach(bufnr)

@@ -16,15 +17,56 @@ vim.keymap.set('n', '<C-s>', api.node.open.horizontal, opts('Open: Horizontal Split'))

end +-- TODO implement min-width option +local tree_width_ratio = 0.3 +local tree_height_ratio = 0.82014 + require("nvim-tree").setup({ on_attach = nvim_tree_on_attach, sort_by = "case_sensitive", + view = { + centralize_selection = true, + signcolumn = "auto", + float = { + enable = true, + quit_on_focus_loss = 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 * tree_width_ratio + local window_h = screen_h * tree_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() * tree_width_ratio) + end, + }, filters = { custom = {"__pycache__"} }, diagnostics = { enable = true }, + actions = { + open_file = { + window_picker = { + enable = false + }, + }, + }, renderer = { indent_markers = { enable = false

@@ -34,7 +76,7 @@ show = {

file = false, folder = false, }, - git_placement = "after", + git_placement = "before", glyphs = { git = { unstaged = "△",

@@ -49,6 +91,7 @@ }

} }, }) + require('telescope').setup { defaults = {
A config/nvim/lua/highlights.lua

@@ -0,0 +1,5 @@

+vim.cmd([[ + hi WinSeparator guifg=#505050 guibg=#151515 + hi NvimTreeNormalFloat guibg=#151515 + hi Normal guibg=#0b0b0b +]])
M config/nvim/lua/lsp/init.luaconfig/nvim/lua/lsp/init.lua

@@ -70,9 +70,9 @@ vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)

vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) - vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', '<leader>]', "<cmd>lua vim.lsp.buf.format({async = true})<cr>", bufopts)
M config/nvim/lua/options.luaconfig/nvim/lua/options.lua

@@ -7,6 +7,7 @@ vim.opt.autoindent = true

vim.opt.undofile = true --o.colorcolumn = '80' vim.opt.scrolloff = 10 +vim.opt.cursorline = true vim.opt.sidescrolloff = 10 vim.opt.wrap = true vim.opt.mouse = 'a'
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -13,6 +13,7 @@

use 'junegunn/goyo.vim' use 'MunifTanjim/nui.nvim' use 'dpayne/CodeGPT.nvim' + use 'rktjmp/lush.nvim' -- themes