From 192de71720b55eecfdbd5143a550924ba18c57b4 Mon Sep 17 00:00:00 2001 From: Ted Kulp Date: Tue, 26 Jul 2022 19:08:03 -0400 Subject: [PATCH] fix: updated lvim config --- .config/lvim/config.lua | 138 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 129 insertions(+), 9 deletions(-) diff --git a/.config/lvim/config.lua b/.config/lvim/config.lua index f820773..d651022 100644 --- a/.config/lvim/config.lua +++ b/.config/lvim/config.lua @@ -17,6 +17,7 @@ lvim.colorscheme = "tokyonight" vim.opt.clipboard = "unnamed,unnamedplus" -- vim.opt.list = true -- vim.opt.listchars:append("eol:↴") +vim.opt.guifont = "JetBrainsMono Nerd Font Mono:h12" -- keymappings [view all the defaults by pressing Lk] lvim.leader = "space" @@ -63,6 +64,23 @@ lvim.builtin.which_key.mappings["t"] = { w = { "Trouble workspace_diagnostics", "Wordspace Diagnostics" }, } +lvim.builtin.which_key.mappings['lC'] = { + name = "+Convert Case", + c = { "CamelToHyphen!", "Camel => Kebab/Hyphen" }, + C = { "CamelToSnake!", "Camel => Snake" }, + h = { "HyphenToCamel!", "Kebab/Hyphen => Camel" }, + H = { "HyphenToSnake!", "Kebab/Hyphen => Snake" }, + s = { "SnakeToCamel!", "Snake => Camel" }, + S = { "SnakeToHyphen!", "Snake => Kebab/Hyphen" }, +} + +lvim.builtin.which_key.mappings['w'] = { + name = "+Window", + s = { "split", "Split Horizontal" }, + v = { "vsplit", "Split Vertical" }, + c = { "close", "Close Window" }, +} + -- TODO: User Config for predefined plugins -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile lvim.builtin.alpha.active = true @@ -176,15 +194,23 @@ lvim.builtin.treesitter.highlight.enabled = true -- }) lvim.plugins = { - { - "dracula/vim", - }, { "folke/tokyonight.nvim", }, { - "tpope/vim-surround", - keys = { "c", "d", "y" }, + "chiedo/vim-case-convert" + }, + { + "kylechui/nvim-surround", + config = function() + require("nvim-surround").setup({ + delimiters = { + invalid_key_behavior = function(char) + return { char, char } + end + }, + }) + end }, { "andymass/vim-matchup", @@ -204,6 +230,58 @@ lvim.plugins = { }) end, }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + event = "BufRead", + config = function() + require("nvim-treesitter.configs").setup({ + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + ["aC"] = "@conditional.outer", + ["iC"] = "@conditional.inner", + }, + }, + swap = { + enable = true, + swap_next = { + ["ga"] = "@parameter.inner", + }, + swap_previous = { + ["gA"] = "@parameter.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, + }) + end, + + }, { "tpope/vim-repeat" }, @@ -238,10 +316,25 @@ lvim.plugins = { end, }, { - "ggandor/leap.nvim", + "phaazon/hop.nvim", event = "BufRead", + branch = "v2", config = function() - require("leap").set_default_keymaps() + require("hop").setup() + vim.api.nvim_set_keymap("n", "s", ":HopChar2", { silent = true }) + vim.api.nvim_set_keymap("n", "S", ":HopWord", { silent = true }) + vim.api.nvim_set_keymap("n", "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })" + , { silent = true }) + vim.api.nvim_set_keymap("n", "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })" + , { silent = true }) + vim.api.nvim_set_keymap("n", "t", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })" + , { silent = true }) + vim.api.nvim_set_keymap("n", "T", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, hint_offset = -1 })" + , { silent = true }) end, }, { @@ -320,7 +413,22 @@ lvim.plugins = { config = function() require("lsp_lines").setup() end, - } + }, + { + "chaoren/vim-wordmotion", + config = function() + vim.cmd("let g:wordmotion_prefix = ','") + end, + }, + { + "christianrondeau/vim-base64" + }, + { + 'b0o/incline.nvim', + config = function() + require('incline').setup() + end, + }, } -- set additional formatters @@ -387,6 +495,18 @@ lvim.builtin.telescope.on_config_done = function(telescope) pcall(telescope.load_extension, "project") end +function Toggle_lsp_lines() + local flag = not vim.diagnostic.config().virtual_lines + print("LSP lines has been " .. (flag and "enabled" or "disabled")) + vim.diagnostic.config { virtual_lines = flag, virtual_text = not flag } +end + +vim.diagnostic.config({ + virtual_text = false, + virtual_lines = true, +}) + lvim.builtin.which_key.mappings["P"] = { "lua require'telescope'.extensions.project.project{ display_type = 'full' }", "Projects" } -lvim.builtin.which_key.mappings['`'] = { ":edit #", "Last Buffer" } +lvim.builtin.which_key.mappings["`"] = { ":edit #", "Last Buffer" } +lvim.builtin.which_key.mappings["lT"] = { "lua Toggle_lsp_lines()", "Toggle LSP Lines" }