From 3e9376bf8244301f3842308dbc99b576e1c9b7f6 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sat, 8 Jul 2023 22:15:37 +0200 Subject: [PATCH] vim: stylistic tweaks --- config/nvim/lua/user/plugins/colorizer.lua | 2 + config/nvim/lua/user/plugins/fugitive.lua | 1 + .../lua/user/plugins/indent-blankline.lua | 10 ++-- config/nvim/lua/user/plugins/nvim-tree.lua | 48 ++++++++++--------- config/nvim/lua/user/plugins/virt-column.lua | 10 ++-- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/config/nvim/lua/user/plugins/colorizer.lua b/config/nvim/lua/user/plugins/colorizer.lua index c9023be..6c3a942 100644 --- a/config/nvim/lua/user/plugins/colorizer.lua +++ b/config/nvim/lua/user/plugins/colorizer.lua @@ -1,6 +1,8 @@ return { 'norcalli/nvim-colorizer.lua', + cond = vim.opt.termguicolors:get(), + config = function() require('colorizer').setup({'*'}, { mode = 'foreground' }) end, diff --git a/config/nvim/lua/user/plugins/fugitive.lua b/config/nvim/lua/user/plugins/fugitive.lua index d09df61..c73c7ae 100644 --- a/config/nvim/lua/user/plugins/fugitive.lua +++ b/config/nvim/lua/user/plugins/fugitive.lua @@ -1,5 +1,6 @@ return { 'tpope/vim-fugitive', + config = function() vim.keymap.set('n', 'gs', 'tab Git') vim.keymap.set('n', 'gb', 'Git blame') diff --git a/config/nvim/lua/user/plugins/indent-blankline.lua b/config/nvim/lua/user/plugins/indent-blankline.lua index 9607ba5..533cee4 100644 --- a/config/nvim/lua/user/plugins/indent-blankline.lua +++ b/config/nvim/lua/user/plugins/indent-blankline.lua @@ -1,10 +1,12 @@ return { 'lukas-reineke/indent-blankline.nvim', - config = function() - require('indent_blankline').setup { - enabled = false, - } + opts = { + enabled = false, + }, + + config = function(_, opts) + require('indent_blankline').setup(opts) -- show/hide indent guides vim.keymap.set('n', 'si', 'IndentBlanklineToggle') diff --git a/config/nvim/lua/user/plugins/nvim-tree.lua b/config/nvim/lua/user/plugins/nvim-tree.lua index 4c84e35..e43be83 100644 --- a/config/nvim/lua/user/plugins/nvim-tree.lua +++ b/config/nvim/lua/user/plugins/nvim-tree.lua @@ -14,33 +14,35 @@ end return { 'kyazdani42/nvim-tree.lua', - config = function() - require('nvim-tree').setup { - disable_netrw = true, -- replace netrw with nvim-tree - hijack_cursor = true, -- keep the cursor on begin of the filename - sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree - on_attach = on_attach, + opts = { + disable_netrw = true, -- replace netrw with nvim-tree + hijack_cursor = true, -- keep the cursor on begin of the filename + sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree + on_attach = on_attach, - git = { - ignore = false, -- don't hide files from .gitignore - }, + git = { + ignore = false, -- don't hide files from .gitignore + }, - view = { - adaptive_size = true, -- resize the window based on the longest line - width = 35, -- a little wider than the default 30 - }, + view = { + adaptive_size = true, -- resize the window based on the longest line + width = 35, -- a little wider than the default 30 + }, - filters = { - dotfiles = false, -- show files starting with a . - custom = { '^\\.git' }, -- don't show .git directory - }, + filters = { + dotfiles = false, -- show files starting with a . + custom = { '^\\.git' }, -- don't show .git directory + }, - renderer = { - add_trailing = true, -- add trailing / to folders - group_empty = true, -- folders that contain only one folder are grouped - highlight_git = true, -- enable highlight based on git attributes - }, - } + renderer = { + add_trailing = true, -- add trailing / to folders + group_empty = true, -- folders that contain only one folder are grouped + highlight_git = true, -- enable highlight based on git attributes + }, + }, + + config = function(_, opts) + require('nvim-tree').setup(opts) vim.keymap.set('n', 'nn', 'NvimTreeOpen') vim.keymap.set('n', 'nf', 'NvimTreeFindFile') diff --git a/config/nvim/lua/user/plugins/virt-column.lua b/config/nvim/lua/user/plugins/virt-column.lua index fdfd0c7..3275b2d 100644 --- a/config/nvim/lua/user/plugins/virt-column.lua +++ b/config/nvim/lua/user/plugins/virt-column.lua @@ -1,10 +1,12 @@ return { 'lukas-reineke/virt-column.nvim', - config = function() - require('virt-column').setup { - char = '│', - } + opts = { + char = '│', + }, + + config = function(_, opts) + require('virt-column').setup(opts) local toggle_virtual_column = function() if vim.o.colorcolumn == '' then