diff --git a/init.lua b/init.lua index 0928b3e..d1ef06a 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,8 @@ vim.opt.termguicolors = true require("config.functions") -require("config.keymaps") require("config.lazy") +require("config.keymaps") require("config.options") ---require("core.plugins") require("config.aliases") require("config.plugin") diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 0431737..d4ec4aa 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -1,3 +1,4 @@ +local wk = require("which-key") -- clear searchterm vim.keymap.set('n', '', ':noh') @@ -14,11 +15,6 @@ vim.keymap.set('n', '*', '*```') -- show lsp floating tooltip vim.keymap.set('n', '', ':lua vim.lsp.buf.hover()') --- The telescope leader key is space --- keymaps can be found in telescope config -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - -- toggle tagbar plugin vim.keymap.set('n', '', ':TagbarToggle fj') @@ -39,3 +35,23 @@ vim.keymap.set('n', '', ':wincmd l') -- move split to tab vim.keymap.set('n', '', ':tab split') + +-- open context menu +vim.keymap.set("n", "", function() + require("menu").open("default") +end, {}) + +-- lspsaga +wk.register({ + l = { + name = "Lspsaga", + c = { "Lspsaga code_action", "Code Action" }, + o = { "Lspsaga outline", "Outline" }, + r = { "Lspsaga rename", "Rename" }, + d = { "Lspsaga goto_definition", "Lsp GoTo Definition" }, + f = { "Lspsaga finder", "Lsp Finder" }, + p = { "Lspsaga preview_definition", "Preview Definition" }, + s = { "Lspsaga signature_help", "Signature Help" }, + w = { "Lspsaga show_workspace_diagnostics", "Show Workspace Diagnostics" }, + } +}, { prefix = "" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 197c5e1..92d6151 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -18,8 +18,8 @@ vim.opt.rtp:prepend(lazypath) -- Make sure to setup `mapleader` and `maplocalleader` before -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) -vim.g.mapleader = " " -vim.g.maplocalleader = "\\" +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' -- Setup lazy.nvim require("lazy").setup({ diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 2359b75..83a1363 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -25,22 +25,8 @@ return { "nvim-tree/nvim-web-devicons", }, }, - --# neo-tree, a filebrowser - { - "nvim-neo-tree/neo-tree.nvim", - keys = { - { "ft", "Neotree toggle", desc = "NeoTree" }, - }, - opts = {}, - }, --# gruvbox, a style 'morhetz/gruvbox', - --# catppuccin, a style - { - "catppuccin/nvim", - name = "catppuccin", - priority = 1000 - }, --# fugitive, a git wrapper 'tpope/vim-fugitive', --# tagbar, opens a view to see properties and methods of file @@ -50,7 +36,6 @@ return { --# deadcolumn, shows line limit when coming close 'Bekaboo/deadcolumn.nvim', --# colorizer, show hex and other colors e.g: #ADADBF - --'norcalli/nvim-colorizer.lua', looks unmaintained 'NiklasV1/nvim-colorizer.lua', --# SyntaxAttr, display syntax highlighting 'vim-scripts/SyntaxAttr.vim', @@ -84,6 +69,102 @@ return { require("lazy-lsp").setup {} end }, + -- Add scrollbar + 'petertriho/nvim-scrollbar', + -- Show shortcut keys + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + }, + -- formatting! + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { lua = { "stylua" } }, + }, + }, + -- context menu + { + "nvzone/volt", + lazy = true + }, + { + "nvzone/menu", + lazy = true + }, + -- color picker + { + "nvzone/minty", + cmd = { "Shades", "Huefy" }, + }, + -- undo tree + { + "jiaoshijie/undotree", + dependencies = { "nvim-lua/plenary.nvim" }, + ---@module 'undotree.collector' + ---@type UndoTreeCollector.Opts + opts = { + -- your options + }, + keys = { -- load the plugin only when using it's keybinding: + { "u", "lua require('undotree').toggle()" }, + }, + }, + { + 'nvimdev/lspsaga.nvim', + config = function() + require('lspsaga').setup({}) + end, + dependencies = { + 'nvim-treesitter/nvim-treesitter', -- optional + 'nvim-tree/nvim-web-devicons', -- optional + } + }, +} +--"williamboman/mason.nvim", +--"williamboman/mason-lspconfig.nvim", +--"neovim/nvim-lspconfig", + --# neo-tree, a filebrowser + --{ + -- "nvim-neo-tree/neo-tree.nvim", + -- keys = { + -- { "ft", "Neotree toggle", desc = "NeoTree" }, + -- }, + -- opts = {}, + --}, + ---- ui plugin is a collection of many UI modules like statusline, tabline, cheatsheet, nvdash and much more! + --"nvim-lua/plenary.nvim", + --{ + -- "nvim-tree/nvim-web-devicons", + -- lazy = true + --}, + --{ + -- "nvchad/ui", + -- config = function() + -- require "nvchad" + -- end + --}, + --{ + -- "nvchad/base46", + -- lazy = true, + -- build = function() + -- require("base46").load_all_highlights() + -- end, + --}, --{ -- "dundalek/lazy-lsp.nvim", -- commit="0ccc0238be37351d53e64c2f6c7f9e106e2bdb68", @@ -107,9 +188,3 @@ return { -- require("lazy-lsp").setup {} -- end, --}, - -- Add scrollbar - 'petertriho/nvim-scrollbar', -} ---"williamboman/mason.nvim", ---"williamboman/mason-lspconfig.nvim", ---"neovim/nvim-lspconfig",