From 96bce82d7bff53f880cdf8963cccff1aa3c2f258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Tue, 25 Oct 2022 21:28:05 +0200 Subject: [PATCH 01/59] Basic setup for merlin --- init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index e5fec66..c276592 100644 --- a/init.lua +++ b/init.lua @@ -139,6 +139,7 @@ local config = { -- enable servers that you already have installed without mason servers = { -- "pyright" + "clangd" }, formatting = { format_on_save = false, -- enable or disable auto formatting on save @@ -292,23 +293,23 @@ local config = { -- end, -- }, -- - { "github/copilot.vim" }, + -- { "github/copilot.vim" }, { "puremourning/vimspector" }, { "lervag/vimtex" }, - { "normen/vim-pio" }, - { - "iamcco/markdown-preview.nvim", - run = function() vim.fn["mkdp#util#install"]() end, - }, + -- { "normen/vim-pio" }, + -- { + -- "iamcco/markdown-preview.nvim", + -- run = function() vim.fn["mkdp#util#install"]() end, + -- }, { "Pocco81/auto-save.nvim", config = function() require("auto-save").setup() end, }, - { "weirongxu/plantuml-previewer.vim" }, + -- { "weirongxu/plantuml-previewer.vim" }, { "aklt/plantuml-syntax" }, - { "tyru/open-browser.vim" }, + -- { "tyru/open-browser.vim" }, -- We also support a key value style plugin definition similar to NvChad: -- ["ray-x/lsp_signature.nvim"] = { From 644dab6ed38cd4040292febcd465048a5bf53f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Tue, 25 Oct 2022 21:38:59 +0200 Subject: [PATCH 02/59] Update README for merlin --- README.md | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e158509..e0e2efe 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # My [AstroNvim](https://github.com/AstroNvim/AstroNvim) config -## How to install my config +## How to install my config on merlin - First you have to install AstroNvim - Backup your previous nvim config @@ -23,18 +23,44 @@ git clone https://github.com/jiriks74/astronvim_config ~/.config/nvim/lua/user ``` - - For NeoVim < 8.0 use `neovim7.2` branch - - ```bash - git clone -b neovim7.2 https://github.com/jiriks74/astronvim_config ~/.config/nvim/lua/user - ``` - - Open nvim and run `:PackerSync` + - **This will result in errors as `merlin` kills most of the clone processes** + - To make this work you need to press `R` (yes, capital) to download all the + failed downloads + - You have to do this until all plugins have been successfully downloaded ```bash nvim +PackerSync ``` +## Updating + +```bash +cd ~/.config/nvim +git pull +cd lua/user +git pull +``` + +- To update the plugins you need to first remove all the downloaded plugins +(or plugin downloading will fail) + +```bash +rm -rf ~/.local/share/nvim +``` + +- Then you need to repeat the process as if you were initializing AstroNvim for +the first time: + - Open nvim and run `:PackerSync` + - **This will result in errors as `merlin` kills most of the clone processes** + - To make this work you need to press `R` (yes, capital) to download all the + failed downloads + - You have to do this until all plugins have been successfully downloaded + + ```bash + nvim +PackerSync + ``` + ## Useful info - Folding with treesitter From 1268abebfcd4591f1eacee89fe3b21e1e700950f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Sat, 29 Oct 2022 23:16:55 +0200 Subject: [PATCH 03/59] Working config --- init.lua | 76 ++++++++++++++++++++++++++++++++++---- plugins/cmp.lua | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 plugins/cmp.lua diff --git a/init.lua b/init.lua index bc34760..4512d44 100644 --- a/init.lua +++ b/init.lua @@ -55,9 +55,10 @@ local config = { diagnostics_enabled = true, -- enable diagnostics at start status_diagnostics_enabled = true, -- enable diagnostics in statusline - copilot_no_tab_map = true, - copilot_assume_mapped = true, - copilot_tab_fallback = "", + -- copilot_no_tab_map = true, + -- copilot_assume_mapped = true, + -- copilot_tab_fallback = "", + vimspector_enable_mappings = 'VISUAL_STUDIO', }, }, @@ -266,13 +267,16 @@ local config = { -- quick save -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command }, + i = { + -- [""] = { "copilot#Accept('')", silent = true, expr = true }, + -- [""] = { "copilot#Accept('')" }, + -- Oopen cmp menu + [""] = { "cmp#complete()", silent = true, expr = true }, + }, t = { -- setting a mapping to false will disable it -- [""] = false, }, - i = { - [""] = { "copilot#Accept('')", silent = true, expr = true }, - } }, -- Configure plugins @@ -292,14 +296,43 @@ local config = { -- end, -- }, -- - { + { "folke/todo-comments.nvim", event = "BufRead", config = function() require("todo-comments").setup() end, }, - { "github/copilot.vim" }, + { + "zbirenbaum/copilot.lua", + -- event = "VimEnter", + event = "BufRead", + -- after = "feline.nvim", + config = function() + vim.defer_fn(function() + require("copilot").setup() + end, 100) + end, + }, + -- { "github/copilot.vim" }, + { + "zbirenbaum/copilot-cmp", + -- after = "copilot.lua", + after = { "nvim-cmp", "copilot.lua" }, + config = function() + -- astronvim.add_cmp_source("copilot_cmp") + astronvim.add_cmp_source({ name = "copilot", priority = 1050, keyword_length = -1, max_item_count = 4 }) + require("copilot_cmp").setup { + method = "getCompletionsCycling", + -- method = "getPanelCompletions", + formatters = { + label = require("copilot_cmp.format").format_label_text, + insert_text = require("copilot_cmp.format").format_insert_text, + preview = require("copilot_cmp.format").deindent, + }, + } + end, + }, { "puremourning/vimspector" }, { "lervag/vimtex" }, { "normen/vim-pio" }, @@ -383,6 +416,33 @@ local config = { buffer = 500, path = 250, }, + -- mappings = { + -- [""] = cmp.mapping(function(fallback) + -- if luasnip.expandable() then + -- luasnip.expand() + -- elseif luasnip.expand_or_jumpable() then + -- luasnip.expand_or_jump() + -- elseif has_words_before() then + -- cmp.complete() + -- else + -- fallback() + -- end + -- end, { + -- "i", + -- "s", + -- }), + -- [""] = cmp.mapping(function(fallback) + -- if luasnip.jumpable(-1) then + -- luasnip.jump(-1) + -- else + -- fallback() + -- end + -- end, { + -- "i", + -- "s", + -- }), + -- + -- } }, -- Modify which-key registration (Use this with mappings table in the above.) diff --git a/plugins/cmp.lua b/plugins/cmp.lua new file mode 100644 index 0000000..184e8ac --- /dev/null +++ b/plugins/cmp.lua @@ -0,0 +1,97 @@ +local kind_icons = { + NONE = "", + Array = "", + Boolean = "⊨", + Class = "", + Constructor = "", + Key = "", + Namespace = "", + Null = "NULL", + Number = "#", + Object = "⦿", + Package = "", + Property = "", + Reference = "", + Snippet = "", + String = "𝓐", + TypeParameter = "", + Unit = "", + + Text = "", + Method = "", + Function = "", + Field = "ﰠ", + Variable = "", + Interface = "", + Module = "", + Value = "", + Enum = "", + Keyword = "", + Color = "", + File = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + Copilot = "", +} +local cmp = require("cmp") +-- local has_words_before = function() +-- if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end +-- local line, col = unpack(vim.api.nvim_win_get_cursor(0)) +-- return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil +-- end +return { + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(_, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + return vim_item + end, + }, + -- completion = { + -- keyword_length = 0, + -- }, + -- mapping = { + -- [""] = vim.schedule_wrap(function(fallback) + -- if cmp.visible() and has_words_before() then + -- cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + -- else + -- fallback() + -- end + -- end), + -- [''] = cmp.mapping(function(fallback) + -- if vim.fn['vsnip#jumpable'](1) == 1 then + -- feedkey('(vsnip-jump-next)', '') + -- else + -- local copilot_keys = vim.fn['copilot#Accept']() + -- if copilot_keys ~= '' then + -- vim.api.nvim_feedkeys(copilot_keys, 'i', true) + -- else + -- fallback() + -- end + -- end + -- end, { 'i', 's' }), + -- }, +} +-- local cmp = require "cmp" +-- local luasnip = require "luasnip" +-- return { +-- preselect = cmp.PreselectMode.None, +-- mapping = { +-- [""] = cmp.mapping.confirm { select = false }, +-- [""] = cmp.mapping(function(fallback) +-- if luasnip.expandable() then +-- luasnip.expand() +-- elseif luasnip.expand_or_jumpable() then +-- luasnip.expand_or_jump() +-- fallback() +-- end +-- end, { +-- "i", +-- "s", +-- }), +-- }, +-- } From e6d978fc38fd74b5bfa54d1057f0579fc146c615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Sat, 29 Oct 2022 23:55:17 +0200 Subject: [PATCH 04/59] Make copilot work with cmp --- init.lua | 7 +++++-- plugins/cmp.lua | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 plugins/cmp.lua diff --git a/init.lua b/init.lua index bc34760..c766ca3 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,6 @@ +local cmp = require('cmp') +-- Never gonna give you up +-- Never gonna -- AstroNvim Configuration Table -- All configuration changes should go inside of the table below @@ -271,7 +274,7 @@ local config = { -- [""] = false, }, i = { - [""] = { "copilot#Accept('')", silent = true, expr = true }, + -- [""] = { "copilot#Accept('')", silent = true, expr = true }, } }, @@ -292,7 +295,7 @@ local config = { -- end, -- }, -- - { + { "folke/todo-comments.nvim", event = "BufRead", config = function() diff --git a/plugins/cmp.lua b/plugins/cmp.lua new file mode 100644 index 0000000..b247eed --- /dev/null +++ b/plugins/cmp.lua @@ -0,0 +1,25 @@ +local cmp = require "cmp" +local luasnip = require "luasnip" +return { + preselect = cmp.PreselectMode.None, + mapping = { + [""] = cmp.mapping.confirm { select = false }, + [""] = cmp.mapping(function(fallback) + vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('', true, true, true)), 'n', + true) + end) + -- if luasnip.expandable() then + -- luasnip.expand() + -- elseif luasnip.expand_or_jumpable() then + -- luasnip.expand_or_jump() + -- fallback() + -- end + -- end, { + -- "i", + -- "s", + -- }), + }, + experimental = { + ghost_text = false -- this feature conflict with copilot.vim's preview. + } +} From 3c26384e30b99d60a7d951506a1154e3baf20a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Sun, 30 Oct 2022 00:09:36 +0200 Subject: [PATCH 05/59] Revert "Merge branch 'merlin' into main" This reverts commit b0f1dd9656085e6a359178137a0dc7f4de805a10, reversing changes made to e6d978fc38fd74b5bfa54d1057f0579fc146c615. --- README.md | 42 +++++++++--------------------------------- init.lua | 14 +++++++++++++- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 782423f..ae91ebc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # My [AstroNvim](https://github.com/AstroNvim/AstroNvim) config -## How to install my config on merli +## README for the merlin server at FIT VUT can be found [here](https://github.com/jiriks74/astronvim_config/tree/merlin) + +## How to install my config - First you have to install AstroNvim - Backup your previous nvim config @@ -23,44 +25,18 @@ git clone https://github.com/jiriks74/astronvim_config ~/.config/nvim/lua/user ``` + - For NeoVim < 8.0 use `neovim7.2` branch + + ```bash + git clone -b neovim7.2 https://github.com/jiriks74/astronvim_config ~/.config/nvim/lua/user + ``` + - Open nvim and run `:PackerSync` - - **This will result in errors as `merlin` kills most of the clone processes** - - To make this work you need to press `R` (yes, capital) to download all the - failed downloads - - You have to do this until all plugins have been successfully downloaded ```bash nvim +PackerSync ``` -## Updating - -```bash -cd ~/.config/nvim -git pull -cd lua/user -git pull -``` - -- To update the plugins you need to first remove all the downloaded plugins -(or plugin downloading will fail) - -```bash -rm -rf ~/.local/share/nvim -``` - -- Then you need to repeat the process as if you were initializing AstroNvim for -the first time: - - Open nvim and run `:PackerSync` - - **This will result in errors as `merlin` kills most of the clone processes** - - To make this work you need to press `R` (yes, capital) to download all the - failed downloads - - You have to do this until all plugins have been successfully downloaded - - ```bash - nvim +PackerSync - ``` - ## Useful info - Folding with treesitter diff --git a/init.lua b/init.lua index 2eac822..c766ca3 100644 --- a/init.lua +++ b/init.lua @@ -142,7 +142,6 @@ local config = { -- enable servers that you already have installed without mason servers = { -- "pyright" - "clangd" }, formatting = { format_on_save = false, -- enable or disable auto formatting on save @@ -306,13 +305,20 @@ local config = { { "github/copilot.vim" }, { "puremourning/vimspector" }, { "lervag/vimtex" }, + { "normen/vim-pio" }, + { + "iamcco/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end, + }, { "Pocco81/auto-save.nvim", config = function() require("auto-save").setup() end, }, + { "weirongxu/plantuml-previewer.vim" }, { "aklt/plantuml-syntax" }, + { "tyru/open-browser.vim" }, -- We also support a key value style plugin definition similar to NvChad: -- ["ray-x/lsp_signature.nvim"] = { @@ -321,6 +327,12 @@ local config = { -- require("lsp_signature").setup() -- end, -- }, + -- ["weirongxu/plantuml-previewer.vim"] = { + -- requires = { {"aklt/plantuml-syntax"} }, + -- -- depends = "aklt/plantuml-syntax", + -- requires = { {"tyru/open-browser.vim"} }, + -- -- depends = "tyru/open-browser.vim", + -- }, }, -- All other entries override the require("").setup({...}) call for default plugins From d9d4d1169bdb07fa2bacbb01a29ae141f67d3961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Tue, 29 Nov 2022 17:05:20 +0100 Subject: [PATCH 06/59] Remove nonsense from config file, fix cmp error --- init.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/init.lua b/init.lua index c766ca3..0fc2db6 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,3 @@ -local cmp = require('cmp') --- Never gonna give you up --- Never gonna -- AstroNvim Configuration Table -- All configuration changes should go inside of the table below From 138b46f8a0e39f07684814ed295deb8ee011cb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Mon, 5 Dec 2022 00:41:25 +0100 Subject: [PATCH 07/59] Add more plugins --- init.lua | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 0fc2db6..4792b2e 100644 --- a/init.lua +++ b/init.lua @@ -47,6 +47,11 @@ local config = { spell = false, -- sets vim.opt.spell signcolumn = "auto", -- sets vim.opt.signcolumn to auto wrap = false, -- sets vim.opt.wrap + + -- Treesitter + foldenable = false, + foldexpr = "nvim_treesitter#foldexpr()", -- set Treesitter based folding + foldmethod = "expr", }, g = { mapleader = " ", -- sets vim.g.mapleader @@ -59,6 +64,12 @@ local config = { copilot_assume_mapped = true, copilot_tab_fallback = "", vimspector_enable_mappings = 'VISUAL_STUDIO', + + -- Taglist + Tlist_Use_Right_Window = 1, + Tlist_GainFocus_On_ToggleOpen = 1, + Tlist_Auto_Update = 1, + -- Tlist_Close_On_Select = 1, }, }, -- If you need more control, you can use the function()...end notation @@ -260,6 +271,18 @@ local config = { ["xs"] = { "VimtexToggleMain", desc = "Set current file as 'current project'" }, ["xa"] = { "VimtexContextMenu", desc = "Show context menu" }, + -- Taglist + ["ft"] = { "TlistToggle", desc = "Tagbar toggle " }, + + -- Trouble + ["ttx"] = { "TroubleToggle", desc = "Toggle Trouble" }, + ["ttw"] = { "TroubleToggle workspace_diagnostics", desc = "Workspace diagnostics" }, + ["ttd"] = { "TroubleToggle document_diagnostics", desc = "Document diagnostics" }, + ["ttq"] = { "TroubleToggle quickfix", desc = "Quickfix" }, + ["ttl"] = { "TroubleToggle loclist", desc = "Loc List" }, + ["ttR"] = { "TroubleToggle lsp_references", desc = "Lsp references" }, + ["ttt"] = { "TodoTrouble", desc = "Todo Trouble" }, + -- Autosave [""] = { "ASToggle", desc = "Toggle autosave" }, @@ -292,6 +315,31 @@ local config = { -- end, -- }, -- + { "andweeb/presence.nvim", + require("presence"):setup({ + -- General options + auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) + neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image + main_image = "neovim", -- Main image display (either "neovim" or "file") + client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) + log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") + debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(, true)`) + enable_line_number = false, -- Displays the current line number instead of the current project + blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches + buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "