From 2280406860e3492913eec385bc4c066171f1d935 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 23 Feb 2023 19:43:22 +0100 Subject: [PATCH] cleanup, new surround plugin --- .config/nvim/lua/config/autocmds.lua | 14 ++++------ .config/nvim/lua/config/keymaps.lua | 8 ++++-- .config/nvim/lua/config/options.lua | 2 +- .config/nvim/lua/plugins/config/lf.lua | 12 ++++---- .../lua/plugins/config/nvim-colorizer.lua | 1 + .../nvim/lua/plugins/config/nvim-surround.lua | 19 +++++++++++++ .../nvim/lua/plugins/config/tokyonight.lua | 2 +- .config/nvim/lua/plugins/config/whichkey.lua | 28 ++++++++++--------- .config/nvim/lua/plugins/init.lua | 18 ++++++------ 9 files changed, 65 insertions(+), 39 deletions(-) create mode 100644 .config/nvim/lua/plugins/config/nvim-surround.lua diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 3a0b3b64..2ae4a90a 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -64,9 +64,9 @@ M.list = { pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" }, callback = function() vim.cmd [[ - nnoremap q :close - set nobuflisted - ]] + nnoremap q :close + set nobuflisted + ]] end } }, @@ -91,9 +91,7 @@ M.list = { { -- Fix auto comment 'BufWinEnter', { - callback = function() - vim.cmd("set formatoptions-=cro") - end + command = "set formatoptions-=cro" } }, { -- Highlight yanked text @@ -106,8 +104,8 @@ M.list = { } } -M.setup = function() - vim.api.nvim_create_augroup('packer_user_config', { clear = true }) +function M.setup() + vim.api.nvim_create_augroup('user_config', { clear = true }) for _, entry in ipairs(M.list) do local event = entry[1] local opts = entry[2] diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 9f6723bb..1226db49 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -50,14 +50,18 @@ local maps = { } } +local function start_lf() +require('lf').start() +end + + local wkmaps = { general = { n = { ["w"] = { "w!", "Save" }, ["q"] = { function() require("funcs").buf_kill() end, "Close" }, - ["f"] = { function() require("lf").start("~") end, "File Picker" }, ["h"] = { "nohlsearch", "Clear Highlights" }, - ["e"] = { function() require('packer').loader("lf.nvim") require("lf").start() end, "File Picker" }, + ["e"] = { function() require('packer').loader("lf.nvim") start_lf() end, "File Picker" }, u = { name = "Utility", c = { "w!!compiler \"%:p\"", "Compile" }, diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index e5429278..d2d66dc8 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -37,7 +37,7 @@ o.modeline = true o.modelines = 3 o.listchars = "eol:$,tab:>-,trail:~,extends:>,precedes:<" -g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' } +g.Illuminate_ftblacklist = { 'alpha' } g.mapleader = ' ' local icons = require 'config.icons'.list diff --git a/.config/nvim/lua/plugins/config/lf.lua b/.config/nvim/lua/plugins/config/lf.lua index cbe90727..f4dd14fc 100644 --- a/.config/nvim/lua/plugins/config/lf.lua +++ b/.config/nvim/lua/plugins/config/lf.lua @@ -1,8 +1,10 @@ -require("lf").setup({ - default_actions = {}, +local status_ok, lf = pcall(require, 'lf') +if not status_ok then + return +end + +lf.setup({ + mappings = false, winblend = 0, - highlights = { - NormalFloat = { guibg = "NONE" } - }, border = "rounded", }) diff --git a/.config/nvim/lua/plugins/config/nvim-colorizer.lua b/.config/nvim/lua/plugins/config/nvim-colorizer.lua index 6b7fa411..26729b85 100644 --- a/.config/nvim/lua/plugins/config/nvim-colorizer.lua +++ b/.config/nvim/lua/plugins/config/nvim-colorizer.lua @@ -2,6 +2,7 @@ local status_ok, colorizer = pcall(require, 'colorizer') if not status_ok then return end + colorizer.setup({ '*' }, { RGB = true, -- #RGB hex codes RRGGBB = true, -- #RRGGBB hex codes diff --git a/.config/nvim/lua/plugins/config/nvim-surround.lua b/.config/nvim/lua/plugins/config/nvim-surround.lua new file mode 100644 index 00000000..251a97a2 --- /dev/null +++ b/.config/nvim/lua/plugins/config/nvim-surround.lua @@ -0,0 +1,19 @@ +local status_ok, surround = pcall(require, 'nvim-surround') +if not status_ok then + return +end + +surround.setup({ + -- keymaps = { + -- insert = "s", + -- insert_line = "S", + -- normal = "ys", + -- normal_cur = "yss", + -- normal_line = "yS", + -- normal_cur_line = "ySS", + -- visual = "S", + -- visual_line = "gS", + -- delete = "ds", + -- change = "cs", + -- }, +}) diff --git a/.config/nvim/lua/plugins/config/tokyonight.lua b/.config/nvim/lua/plugins/config/tokyonight.lua index 52442420..5207d515 100644 --- a/.config/nvim/lua/plugins/config/tokyonight.lua +++ b/.config/nvim/lua/plugins/config/tokyonight.lua @@ -4,9 +4,9 @@ if not status_ok then end tokyonight.setup({ + style = "night", transparent = true, terminal_colors = true, dim_inactive = true, - lualine_bold = true, }) vim.cmd [[colorscheme tokyonight]] diff --git a/.config/nvim/lua/plugins/config/whichkey.lua b/.config/nvim/lua/plugins/config/whichkey.lua index 1f8605e6..c2e00be3 100644 --- a/.config/nvim/lua/plugins/config/whichkey.lua +++ b/.config/nvim/lua/plugins/config/whichkey.lua @@ -4,17 +4,19 @@ if not status_ok then end local icons = require('config.icons').list -whichkey.setup { - marks = false, - registers = false, - presets = { - operators = false, - motions = false, - text_objects = false, - windows = false, - nav = false, - z = false, - g = false, +whichkey.setup({ + plugins = { + marks = false, + registers = false, + presets = { + operators = false, + motions = false, + text_objects = false, + windows = false, + nav = false, + z = false, + g = false, + } }, spelling = { enabled = false, @@ -46,6 +48,6 @@ whichkey.setup { triggers = "auto", triggers_blacklist = { i = { "j", "k" }, - v = { "j", "k", "c", "y", "d", "v" }, + v = { "j", "k", "y" }, }, -} +}) diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index ba93f443..00719b5a 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -7,11 +7,10 @@ local plugins = { }, { "nvim-lua/plenary.nvim" }, { "lewis6991/impatient.nvim" }, - { "tpope/vim-surround", - event = { "BufRead", "BufWinEnter", "BufNewFile" }, - }, - { "tpope/vim-repeat", - event = { "BufRead", "BufWinEnter", "BufNewFile" }, + { "kylechui/nvim-surround", + config = function() + require('plugins.config.nvim-surround') + end }, { "fladson/vim-kitty", ft = "kitty" @@ -162,10 +161,10 @@ local plugins = { end, }, { "saadparwaiz1/cmp_luasnip", after = "LuaSnip" }, - { "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" }, - { "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" }, - { "hrsh7th/cmp-path", after = "cmp-buffer" }, + { "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" }, + { "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" }, + { "hrsh7th/cmp-path", after = "cmp-buffer" }, { "onsails/lspkind.nvim" }, { "windwp/nvim-autopairs", after = "nvim-cmp", @@ -203,6 +202,7 @@ local plugins = { -- }, { "lmburns/lf.nvim", opt = true, + commit = "383429497292dd8a84271e74a81c6db6993ca7ab", config = function() require('plugins.config.lf') require('config.keymaps').map("lf")