From efe9388a41b25fbef759e636dd30c15120e22cd3 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 19 Nov 2022 22:11:47 +0100 Subject: [PATCH] Update lvim settings --- home/.config/lvim/after/ftplugin/lua.lua | 2 + home/.config/lvim/after/ftplugin/markdown.lua | 2 + home/.config/lvim/lua/user/autocmds.lua | 2 - home/.config/lvim/lua/user/keys.lua | 9 ++- home/.config/lvim/lua/user/options.lua | 10 +-- home/.config/lvim/lua/user/plugins.lua | 63 ++++++++++++++----- home/.config/lvim/lua/user/treesitter.lua | 12 ++-- 7 files changed, 68 insertions(+), 32 deletions(-) create mode 100644 home/.config/lvim/after/ftplugin/lua.lua create mode 100644 home/.config/lvim/after/ftplugin/markdown.lua diff --git a/home/.config/lvim/after/ftplugin/lua.lua b/home/.config/lvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..f6ec406 --- /dev/null +++ b/home/.config/lvim/after/ftplugin/lua.lua @@ -0,0 +1,2 @@ +vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.lua", command = "setlocal shiftwidth=2" }) +vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.lua", command = "setlocal tabstop=2" }) diff --git a/home/.config/lvim/after/ftplugin/markdown.lua b/home/.config/lvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..60f99cd --- /dev/null +++ b/home/.config/lvim/after/ftplugin/markdown.lua @@ -0,0 +1,2 @@ +vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.md", command = "setlocal tw=119" }) +vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.md", command = "SymbolsOutline" }) diff --git a/home/.config/lvim/lua/user/autocmds.lua b/home/.config/lvim/lua/user/autocmds.lua index 70f3741..14274d7 100644 --- a/home/.config/lvim/lua/user/autocmds.lua +++ b/home/.config/lvim/lua/user/autocmds.lua @@ -2,8 +2,6 @@ -- Delete all trailing whitespace on saving vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.py", command = [[%s/\s\+$//e]] }) --- Set text wrap to 119 characters -vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.md", command = "setlocal tw=119" }) -- Jump to last position when opening a file vim.api.nvim_create_autocmd("BufReadPost", { pattern = "*", diff --git a/home/.config/lvim/lua/user/keys.lua b/home/.config/lvim/lua/user/keys.lua index d64a210..2e78e6d 100644 --- a/home/.config/lvim/lua/user/keys.lua +++ b/home/.config/lvim/lua/user/keys.lua @@ -20,7 +20,6 @@ lvim.keys.normal_mode[""] = ":BufferLineMovePrev" -- Opening various menus lvim.keys.normal_mode[""] = ":NvimTreeFindFileToggle" lvim.keys.normal_mode[""] = ":Lf" -lvim.keys.normal_mode[""] = ":MinimapToggle" lvim.keys.normal_mode[""] = ":SymbolsOutline" -- Delete to void register @@ -41,6 +40,14 @@ lvim.keys.normal_mode[""] = ":DapStepOver" lvim.keys.normal_mode[""] = ":DapStepInto" lvim.keys.normal_mode[""] = ":DapStepOut" +-- Goto preview +lvim.keys.normal_mode["gpd"] = ":lua require('goto-preview').goto_preview_definition()" +lvim.keys.normal_mode["gpt"] = ":lua require('goto-preview').goto_preview_type_definition()" +lvim.keys.normal_mode["gpi"] = ":lua require('goto-preview').goto_preview_implementation()" +lvim.keys.normal_mode["gpr"] = ":lua require('goto-preview').goto_preview_references()" +lvim.keys.normal_mode["gP"] = ":lua require('goto-preview').close_all_win()" + + -- Quick word replacing (use . for next word) lvim.keys.normal_mode["cn"] = "*``cgn" lvim.keys.normal_mode["cN"] = "*``cgN" diff --git a/home/.config/lvim/lua/user/options.lua b/home/.config/lvim/lua/user/options.lua index d382770..25bf0d2 100644 --- a/home/.config/lvim/lua/user/options.lua +++ b/home/.config/lvim/lua/user/options.lua @@ -9,13 +9,9 @@ vim.opt.relativenumber = true -- Use relative line numbers vim.opt.wrap = true -- Allow line wrapping -- Tab/Indent settings --- vim.opt.autoindent = true -- Enable automatic indenting --- vim.opt.expandtab = true -- Expand tabs into spaces --- vim.opt.tabstop = 2 -- Number of spaces a tab in file accounts for --- vim.opt.shiftwidth = 4 -- Visual number of spaces inserted for each indentation --- vim.opt.softtabstop = 4 -- Tabs/Spaces interlop --- vim.opt.tabpagemax = 50 -- More tabs --- vim.opt.shiftround = true -- Always round indent to multiple of shiftwidth +vim.opt.shiftwidth = 4 -- Number of spaces inserted for each indentation (>>, <<) +vim.opt.tabstop = 4 -- Number of spaces a tab in file accounts for +vim.opt.shiftround = true -- Always round indent to multiple of shiftwidth when indenting (>>, <<) -- -- Enable syntax highlighting in fenced markdown code-blocks vim.g.markdown_fenced_languages = {"html", "javascript", "typescript", "css", "scss", "lua", "vim", "python"} diff --git a/home/.config/lvim/lua/user/plugins.lua b/home/.config/lvim/lua/user/plugins.lua index 99d713e..ca8c117 100644 --- a/home/.config/lvim/lua/user/plugins.lua +++ b/home/.config/lvim/lua/user/plugins.lua @@ -1,8 +1,6 @@ --- Additional Plugins lvim.plugins = { - { "wakatime/vim-wakatime" }, - -- LSP + { -- Tree-like view for symbols in current file using LSP "simrat39/symbols-outline.nvim", @@ -23,17 +21,18 @@ lvim.plugins = { }, -- User interface + + -- Autocompletion + { - -- Code minimap for easy orientation in a longer file - "wfxr/minimap.vim", - run = "cargo install --locked code-minimap", - config = function() - vim.cmd "let g:minimap_width = 10" - end, + -- Local AI completion helper + "tzachar/cmp-tabnine", + run = "./install.sh", + requires = "hrsh7th/nvim-cmp", }, - -- Github copilot for code completion -- { + -- -- Github copilot for code completion -- "zbirenbaum/copilot.lua", -- event = { "VimEnter" }, -- config = function() @@ -42,23 +41,25 @@ lvim.plugins = { -- end, 100) -- end, -- }, - -- { "zbirenbaum/copilot-cmp", after = { "copilot.lua", "nvim-cmp" } }, + -- { + -- -- Github compilot cmp source + -- "zbirenbaum/copilot-cmp", + -- after = { "copilot.lua", "nvim-cmp" } + -- }, - -- - { "jasonccox/vim-wayland-clipboard" }, - - -- Yuck.vim (eww configuration language support) - { "elkowar/yuck.vim" }, -- Treesitter + -- { -- -- Colorize matching parenthesis using treesitter -- "p00f/nvim-ts-rainbow", -- }, + { -- Treesitter information shown directly in neovim "nvim-treesitter/playground", }, + { -- Alwats show class/function name we're in "romgrk/nvim-treesitter-context", @@ -86,8 +87,38 @@ lvim.plugins = { } end, }, + + -- Other + + { + -- Code time & habit tracking + "wakatime/vim-wakatime" + }, + + { + -- Make clipboard work on wayland (using wl-copy) + "jasonccox/vim-wayland-clipboard" + }, + + { + -- eww configuration language support + "elkowar/yuck.vim" + }, + + { + -- Goto preview (definition/implementation/references) + "rmagatti/goto-preview", + config = function() + require('goto-preview').setup {} + end + }, + } -- Register copilot as cmp source -- lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)" -- table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" }) + +-- Register tabnine as cmp source +lvim.builtin.cmp.formatting.source_names["tabnine"] = "(Tabnine)" +table.insert(lvim.builtin.cmp.sources, { name = "tabnine" }) diff --git a/home/.config/lvim/lua/user/treesitter.lua b/home/.config/lvim/lua/user/treesitter.lua index 54169a6..02907fc 100644 --- a/home/.config/lvim/lua/user/treesitter.lua +++ b/home/.config/lvim/lua/user/treesitter.lua @@ -34,9 +34,9 @@ lvim.builtin.treesitter.highlight.enabled = true -- local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername -- ft_to_parser.apparmor = "apparmor" --- Temporary treesitter -lvim.keys.normal_mode["gu"] = ":TSUpdate apparmor" -lvim.keys.normal_mode["gU"] = ":TSToggle apparmor" -lvim.keys.normal_mode["gt"] = ":TSPlaygroundToggle" -lvim.keys.normal_mode["gh"] = ":TSNodeUnderCursor" -lvim.keys.normal_mode["gH"] = ":TSHighlightCapturesUnderCursor" +-- Temporary mappings +-- lvim.keys.normal_mode["gu"] = ":TSUpdate apparmor" +-- lvim.keys.normal_mode["gU"] = ":TSToggle apparmor" +-- lvim.keys.normal_mode["gt"] = ":TSPlaygroundToggle" +-- lvim.keys.normal_mode["gh"] = ":TSNodeUnderCursor" +-- lvim.keys.normal_mode["gH"] = ":TSHighlightCapturesUnderCursor"