diff --git a/files/nvim/.config/nvim/init.lua b/files/nvim/.config/nvim/init.lua index 8c7ad58..f51388d 100644 --- a/files/nvim/.config/nvim/init.lua +++ b/files/nvim/.config/nvim/init.lua @@ -1,11 +1,12 @@ --- Make sure to update packer with `:PackerInstall` and `:PackerSync` --- Treesitter with `:TSUpdate` after every nvim update. --- LSP with `:LSPInstall`, log with `:LSPInfo` --- --- Rollback possible with packer.nvim --- Always create a snapshot BEFORE upgrading, so we can rollback if we find sth --- `:PackerSnapshot YEAR-MONTH-DAY --- Location: ~/.cache/nvim/packer.nvim +-- NOTE: Make sure to update packer with `:PackerInstall` and `:PackerSync` + +-- NOTE: Update Treesitter with `:TSUpdate` after every nvim update + +-- NOTE: Install LSP with `:LSPInstall`, log with `:LSPInfo` + +-- NOTE: Rollback possible with packer.nvim: +-- Always create a snapshot BEFORE upgrading `:PackerSnapshot YEAR-MONTH-DAY` +-- Location: ~/.cache/nvim/packer.nvim -- This must be loaded first vim.cmd("set termguicolors") diff --git a/files/nvim/.config/nvim/lua/icons.lua b/files/nvim/.config/nvim/lua/icons.lua deleted file mode 100644 index ee0b09c..0000000 --- a/files/nvim/.config/nvim/lua/icons.lua +++ /dev/null @@ -1,207 +0,0 @@ -local M = {} - -M.lspkind = { - Namespace = "", - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = "ﰠ ", - Variable = " ", - Class = "ﴯ ", - Interface = " ", - Module = " ", - Property = "ﰠ ", - Unit = "塞 ", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = "פּ ", - Event = " ", - Operator = " ", - TypeParameter = " ", - Table = "", - Object = " ", - Tag = "", - Array = "[]", - Boolean = " ", - Number = " ", - Null = "ﳠ", - String = " ", - Calendar = "", - Watch = " ", - Package = "", -} - -M.statusline_separators = { - default = { - left = "", - right = " ", - }, - - round = { - left = "", - right = "", - }, - - block = { - left = "█", - right = "█", - }, - - arrow = { - left = "", - right = "", - }, -} - -M.devicons = { - default_icon = { - icon = "", - name = "Default", - }, - - c = { - icon = "", - name = "c", - }, - - css = { - icon = "", - name = "css", - }, - - deb = { - icon = "", - name = "deb", - }, - - Dockerfile = { - icon = "", - name = "Dockerfile", - }, - - html = { - icon = "", - name = "html", - }, - - jpeg = { - icon = "", - name = "jpeg", - }, - - jpg = { - icon = "", - name = "jpg", - }, - - js = { - icon = "", - name = "js", - }, - - kt = { - icon = "󱈙", - name = "kt", - }, - - lock = { - icon = "", - name = "lock", - }, - - lua = { - icon = "", - name = "lua", - }, - - mp3 = { - icon = "", - name = "mp3", - }, - - mp4 = { - icon = "", - name = "mp4", - }, - - out = { - icon = "", - name = "out", - }, - - png = { - icon = "", - name = "png", - }, - - py = { - icon = "", - name = "py", - }, - - ["robots.txt"] = { - icon = "ﮧ", - name = "robots", - }, - - toml = { - icon = "", - name = "toml", - }, - - ts = { - icon = "ﯤ", - name = "ts", - }, - - ttf = { - icon = "", - name = "TrueTypeFont", - }, - - rb = { - icon = "", - name = "rb", - }, - - rpm = { - icon = "", - name = "rpm", - }, - - vue = { - icon = "﵂", - name = "vue", - }, - - woff = { - icon = "", - name = "WebOpenFontFormat", - }, - - woff2 = { - icon = "", - name = "WebOpenFontFormat2", - }, - - xz = { - icon = "", - name = "xz", - }, - - zip = { - icon = "", - name = "zip", - }, -} - -return M diff --git a/files/nvim/.config/nvim/lua/mappings.lua b/files/nvim/.config/nvim/lua/mappings.lua index 65dc197..483268c 100644 --- a/files/nvim/.config/nvim/lua/mappings.lua +++ b/files/nvim/.config/nvim/lua/mappings.lua @@ -24,23 +24,23 @@ telescope.setup({ } } }) -map("n", "", " Telescope git_files ", default_opts) -- Show files -map("n", "", " Telescope live_grep", default_opts) -- Grep through current directory -map("n", "", " Telescope keymaps", default_opts) -- Show all keys +map("n", "", " Telescope git_files ", default_opts) +map("n", "", " Telescope live_grep", default_opts) +map("n", "", " Telescope keymaps", default_opts) --- Telescope + LSP -map("n", "la", " lua vim.lsp.buf.code_action()", default_opts) -- Apply LSP code action -map("n", "ld", " Telescope lsp_definitions", default_opts) -- Show all LSP definitions (or jump if only 1) -map("n", "le", " Telescope diagnostics", default_opts) -- Show errors and warnings -map("n", "lf", " lua vim.lsp.buf.format {async = true }", default_opts) -- Format buffer with LSP -map("n", "lh", " lua vim.lsp.buf.hover()", default_opts) -- Show info of symbol (double tap to enter) -map("i", "", " lua vim.lsp.buf.signature_help()", default_opts) -- Show function signature -map("n", "", " lua vim.lsp.buf.signature_help()", default_opts) -- Show function signature -map("n", "ln", " lua vim.lsp.buf.rename()", default_opts) -- Rename LSP symbol -map("n", "lr", " Telescope lsp_references", default_opts) -- Show all LSP references -map("n", "ls", " Telescope lsp_workspace_symbols", default_opts) -- Search for LSP symbols -map("n", "lt", " TodoTelescope", default_opts) -- Show all TODOs in a project -map("n", "lp", " call SVED_Sync()", default_opts) -- synctex +-- LSP +map("n", "la", " lua vim.lsp.buf.code_action()", default_opts) +map("n", "ld", " Telescope lsp_definitions", default_opts) +map("n", "le", " Telescope diagnostics", default_opts) +map("n", "lf", " lua vim.lsp.buf.format {async = true }", default_opts) +map("n", "lh", " lua vim.lsp.buf.hover()", default_opts) +map("i", "", " lua vim.lsp.buf.signature_help()", default_opts) +map("n", "", " lua vim.lsp.buf.signature_help()", default_opts) +map("n", "ln", " lua vim.lsp.buf.rename()", default_opts) +map("n", "lr", " Telescope lsp_references", default_opts) +map("n", "ls", " Telescope lsp_workspace_symbols", default_opts) +map("n", "lt", " TodoTelescope", default_opts) +map("n", "lp", " call SVED_Sync()", default_opts) wk.register({ [""] = { l = { @@ -57,7 +57,7 @@ wk.register({ } }) --- git +-- git(1) map("n", "gb", " Git blame", default_opts) map("n", "gl", " LazyGitFilter", default_opts) map("n", "gf", " LazyGitFilterCurrentFile", default_opts) @@ -73,10 +73,10 @@ wk.register({ } }) --- Telescope + telescope-symbols -map("n", "ie", " lua require'telescope.builtin'.symbols{ sources = { 'emoji', 'gitmoji' } }", default_opts) -- Show emojis -map("n", "im", " lua require'telescope.builtin'.symbols{ sources = { 'julia' } }", default_opts) -- Show math symbols -map("n", "in", " lua require'telescope.builtin'.symbols{ sources = { 'nerd' } }", default_opts) -- Show nerd icons +-- telescope-symbols +map("n", "ie", " lua require'telescope.builtin'.symbols{ sources = { 'emoji', 'gitmoji' } }", default_opts) +map("n", "im", " lua require'telescope.builtin'.symbols{ sources = { 'julia' } }", default_opts) +map("n", "in", " lua require'telescope.builtin'.symbols{ sources = { 'nerd' } }", default_opts) wk.register({ [""] = { i = { @@ -116,3 +116,6 @@ cmp.setup({ }, }) +-- nvim-tree +map("n", "tt", " NvimTreeToggle", default_opts) +map("n", "tc", " NvimTreeCollapse", default_opts) diff --git a/files/nvim/.config/nvim/lua/plugins/Comment-conf.lua b/files/nvim/.config/nvim/lua/plugins/Comment-conf.lua deleted file mode 100644 index a844323..0000000 --- a/files/nvim/.config/nvim/lua/plugins/Comment-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require('Comment').setup() diff --git a/files/nvim/.config/nvim/lua/plugins/gitsigns-conf.lua b/files/nvim/.config/nvim/lua/plugins/gitsigns-conf.lua deleted file mode 100644 index 91fa65b..0000000 --- a/files/nvim/.config/nvim/lua/plugins/gitsigns-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require('gitsigns').setup() diff --git a/files/nvim/.config/nvim/lua/plugins/guess-indent-conf.lua b/files/nvim/.config/nvim/lua/plugins/guess-indent-conf.lua deleted file mode 100644 index 2750b40..0000000 --- a/files/nvim/.config/nvim/lua/plugins/guess-indent-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require('guess-indent').setup {} diff --git a/files/nvim/.config/nvim/lua/plugins/init.lua b/files/nvim/.config/nvim/lua/plugins/init.lua index 29accfa..4e57b09 100644 --- a/files/nvim/.config/nvim/lua/plugins/init.lua +++ b/files/nvim/.config/nvim/lua/plugins/init.lua @@ -1,12 +1,11 @@ --- NOTE: --- Define all plugins in this file, --- but maintain config in -conf.lua +-- NOTE: Required plugins are maintained here. --- NOTE: --- Run `checkhealth` after first install +-- NOTE: Plugin configuration: ${plugin}-conf.lua --- Mention all dependencies in 'requires', but create their own entry, --- if they need configuration. +-- NOTE: Use `checkhealth` after new installation + +-- NOTE: Mention all dependencies in 'requires', but create their own entry, +-- if they need configuration. local fn = vim.fn @@ -30,30 +29,26 @@ return require('packer').startup(function(use) }) -- Icons - -- Load here, because otherwise icons won't show correctly use({ - "kyazdani42/nvim-web-devicons", - config = function() require('plugins.nvim-web-devicons-conf') end, + 'kyazdani42/nvim-web-devicons', + config = function() require 'nvim-web-devicons'.setup({ default = true }) end, }) -- LuaLine use({ - "nvim-lualine/lualine.nvim", + 'nvim-lualine/lualine.nvim', requires = { - "kyazdani42/nvim-web-devicons", -- All icons in bar - "arkav/lualine-lsp-progress", -- Show lsp loading progress - "SmiteshP/nvim-navic", -- Show breadcrumbs (loaded in lualine-conf) - "neovim/nvim-lspconfig", -- for nvim-navic (loaded later) + 'kyazdani42/nvim-web-devicons', -- All icons in bar }, config = function() require('plugins.lualine-conf') end, }) -- Fuzzy Finder (Files etc) use({ - "nvim-telescope/telescope.nvim", + 'nvim-telescope/telescope.nvim', requires = { - "nvim-lua/plenary.nvim", -- General functions - "nvim-telescope/telescope-symbols.nvim", -- Search for icons + 'nvim-lua/plenary.nvim', -- General functions + 'nvim-telescope/telescope-symbols.nvim', -- Search for icons }, config = function() require('plugins.telescope-conf') end, }) @@ -61,48 +56,51 @@ return require('packer').startup(function(use) -- Auto Indentation use({ 'nmac427/guess-indent.nvim', - config = function() require('plugins.guess-indent-conf') end, + config = function() require('guess-indent').setup {} end, }) -- Autopairs use({ - "windwp/nvim-autopairs", - config = function() require('plugins.nvim-autopairs-conf') end, + 'windwp/nvim-autopairs', + config = function() require('nvim-autopairs').setup({}) end, }) - -- Treesitter (Update with `:TSUpdate`) + -- Treesitter use({ - "nvim-treesitter/nvim-treesitter", + 'nvim-treesitter/nvim-treesitter', + requires = { + 'kyazdani42/nvim-web-devicons', + }, config = function() require('plugins.nvim-treesitter-conf') end, }) - -- LSP (install with `:LSPInstall`, inspect with `:LSPInfo`) + -- LSP use({ - "neovim/nvim-lspconfig", -- Easier to manage LSP servers + 'neovim/nvim-lspconfig', requires = { - "williamboman/nvim-lsp-installer", -- Easy to install LSP servers - "simrat39/rust-tools.nvim", -- Cooler LSP stuff for Rust + 'williamboman/nvim-lsp-installer', + 'simrat39/rust-tools.nvim', }, config = function() require('plugins.nvim-lspconfig-conf') end, }) - -- Snippets + -- Suggestion window + snippets use({ 'hrsh7th/nvim-cmp', requires = { - "L3MON4D3/LuaSnip", -- Snippet engine - "hrsh7th/cmp-buffer", -- Source: buffer - "hrsh7th/cmp-nvim-lsp", -- Source: LSP symbols - "hrsh7th/cmp-path", -- Source: path - "rafamadriz/friendly-snippets", -- Source: JSON style snippets for LuaSnip - "saadparwaiz1/cmp_luasnip", -- Make LuaSnip work with cmp + 'L3MON4D3/LuaSnip', -- Snippet engine + 'hrsh7th/cmp-buffer', -- Source: buffer + 'hrsh7th/cmp-nvim-lsp', -- Source: LSP symbols + 'hrsh7th/cmp-path', -- Source: path + 'rafamadriz/friendly-snippets', -- Source: JSON style snippets for LuaSnip + 'saadparwaiz1/cmp_luasnip', -- Make LuaSnip work with cmp }, config = function() require('plugins.nvim-cmp-conf') end, }) - -- which-key (Show key combos) + -- which-key use { - "folke/which-key.nvim", + 'folke/which-key.nvim', config = function() require('plugins.which-key-conf') end } @@ -111,49 +109,52 @@ return require('packer').startup(function(use) -- Easily comment out stuff use({ - "numToStr/Comment.nvim", - config = function() require('plugins.Comment-conf') end, + 'numToStr/Comment.nvim', + config = function() require('Comment').setup() end, }) -- Highlight TODOs use { - "folke/todo-comments.nvim", - requires = "nvim-lua/plenary.nvim", - config = function() require('plugins.todo-comments-conf') end + 'folke/todo-comments.nvim', + requires = 'nvim-lua/plenary.nvim', + config = function() require('todo-comments').setup {} end, } -- interactive git - use { - 'kdheepak/lazygit.nvim' - } + use({ 'kdheepak/lazygit.nvim' }) - -- git cmd wrapper - use 'tpope/vim-fugitive' + -- git command wrapper + use({ 'tpope/vim-fugitive' }) -- git signs at left side (+ blame line) - use { + use({ 'lewis6991/gitsigns.nvim', - config = function() require('plugins.gitsigns-conf') end - } + config = function() require('gitsigns').setup() end, + }) -- show color codes inline use({ - "norcalli/nvim-colorizer.lua", - config = function() require('plugins.nvim-colorizer-conf') end + 'norcalli/nvim-colorizer.lua', + config = function() require 'colorizer'.setup() end, }) -- fancy lsp loading animation use({ 'j-hui/fidget.nvim', - config = function() require "fidget".setup {} end, + config = function() require 'fidget'.setup {} end, }) - -- latex synctex - -- pip install pygobject dbus-python pynvim - use({ "peterbjorgensen/sved" }) + -- latex synctex (requires`pip install pygobject dbus-python pynvim`) + use({ 'peterbjorgensen/sved' }) - -- d2 lang support - use({"terrastruct/d2-vim"}) + -- d2-lang support (https://d2lang.com/tour/intro/) + use({'terrastruct/d2-vim'}) + + -- tree sidebar + use({ + 'nvim-tree/nvim-tree.lua', + config = function() require('nvim-tree').setup() end, + }) -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/files/nvim/.config/nvim/lua/plugins/lualine-conf.lua b/files/nvim/.config/nvim/lua/plugins/lualine-conf.lua index 390c26c..aaf5705 100644 --- a/files/nvim/.config/nvim/lua/plugins/lualine-conf.lua +++ b/files/nvim/.config/nvim/lua/plugins/lualine-conf.lua @@ -1,6 +1,3 @@ --- startup breadcrumbs -require 'nvim-navic'.setup({}) - local function showTrailing() local space = vim.fn.search([[\s\+$]], 'nwc') return space ~= 0 and "TW:" .. space or "" diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-autopairs-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-autopairs-conf.lua deleted file mode 100644 index f96cb3e..0000000 --- a/files/nvim/.config/nvim/lua/plugins/nvim-autopairs-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require('nvim-autopairs').setup({}) diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-cmp-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-cmp-conf.lua index a3bc440..883ef97 100644 --- a/files/nvim/.config/nvim/lua/plugins/nvim-cmp-conf.lua +++ b/files/nvim/.config/nvim/lua/plugins/nvim-cmp-conf.lua @@ -1,3 +1,43 @@ +lspkind = { + Namespace = "", + Text = " ", + Method = " ", + Function = " ", + Constructor = " ", + Field = "ﰠ ", + Variable = " ", + Class = "ﴯ ", + Interface = " ", + Module = " ", + Property = "ﰠ ", + Unit = "塞 ", + Value = " ", + Enum = " ", + Keyword = " ", + Snippet = " ", + Color = " ", + File = " ", + Reference = " ", + Folder = " ", + EnumMember = " ", + Constant = " ", + Struct = "פּ ", + Event = " ", + Operator = " ", + TypeParameter = " ", + Table = "", + Object = " ", + Tag = "", + Array = "[]", + Boolean = " ", + Number = " ", + Null = "ﳠ", + String = " ", + Calendar = "", + Watch = " ", + Package = "", +} + local cmp = require 'cmp' cmp.setup({ snippet = { @@ -14,8 +54,7 @@ cmp.setup({ formatting = { -- Show icons in cmp box format = function(_, vim_item) - local icons = require("icons").lspkind - vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) + vim_item.kind = string.format("%s %s", lspkind[vim_item.kind], vim_item.kind) return vim_item end, }, diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-colorizer-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-colorizer-conf.lua deleted file mode 100644 index 39e91bb..0000000 --- a/files/nvim/.config/nvim/lua/plugins/nvim-colorizer-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require 'colorizer'.setup() diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-lspconfig-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-lspconfig-conf.lua index a9a8827..7a1dd55 100644 --- a/files/nvim/.config/nvim/lua/plugins/nvim-lspconfig-conf.lua +++ b/files/nvim/.config/nvim/lua/plugins/nvim-lspconfig-conf.lua @@ -20,10 +20,9 @@ require("nvim-lsp-installer").setup({ }) local lsp = require('lspconfig') -local navic = require('nvim-navic') -- breadcrumbs +-- own custom attach, gets called in every client function my_attach (client, bufnr) - navic.attach(client, bufnr) -- breadcrumbs end -- Normal LSPs diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-treesitter-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-treesitter-conf.lua index 3f6474d..1ccd099 100644 --- a/files/nvim/.config/nvim/lua/plugins/nvim-treesitter-conf.lua +++ b/files/nvim/.config/nvim/lua/plugins/nvim-treesitter-conf.lua @@ -1,5 +1,5 @@ require('nvim-treesitter.configs').setup({ - ensure_installed = { -- can also be manually installed with :TSInstall + ensure_installed = { "bash", "c", "haskell", diff --git a/files/nvim/.config/nvim/lua/plugins/nvim-web-devicons-conf.lua b/files/nvim/.config/nvim/lua/plugins/nvim-web-devicons-conf.lua deleted file mode 100644 index f88b1e1..0000000 --- a/files/nvim/.config/nvim/lua/plugins/nvim-web-devicons-conf.lua +++ /dev/null @@ -1,3 +0,0 @@ -require 'nvim-web-devicons'.setup({ - default = true -}) diff --git a/files/nvim/.config/nvim/lua/plugins/todo-comments-conf.lua b/files/nvim/.config/nvim/lua/plugins/todo-comments-conf.lua deleted file mode 100644 index b54866b..0000000 --- a/files/nvim/.config/nvim/lua/plugins/todo-comments-conf.lua +++ /dev/null @@ -1 +0,0 @@ -require("todo-comments").setup {}