From 619c164096a72b6ffc01689297db308bcb1e35c8 Mon Sep 17 00:00:00 2001 From: chlorospingus Date: Tue, 3 Jun 2025 17:32:56 -0700 Subject: [PATCH] Clean up init.lua, remove unused plugins, switch to blink.cmp --- nvim/init.lua | 129 ++++---------------------------- nvim/lazy-lock.json | 22 ------ nvim/lua/plugins/autoclose.lua | 1 + nvim/lua/plugins/cmp.lua | 61 +++++++++++---- nvim/lua/plugins/keystrokes.lua | 5 -- nvim/lua/plugins/lualine.lua | 32 ++++++++ nvim/lua/plugins/presence.lua | 3 - nvim/lua/plugins/typst.lua | 2 - 8 files changed, 95 insertions(+), 160 deletions(-) delete mode 100644 nvim/lazy-lock.json delete mode 100644 nvim/lua/plugins/keystrokes.lua delete mode 100644 nvim/lua/plugins/presence.lua diff --git a/nvim/init.lua b/nvim/init.lua index c8e6dbc..18cdaee 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,116 +1,19 @@ require('config.lazy') -local capabilities = require('cmp_nvim_lsp').default_capabilities() - --- Set up lspconfig. -local lspconfig = require('lspconfig') -local servers = { 'jdtls', 'rust_analyzer', 'csharp_ls', 'html', 'marksman', 'ts_ls', 'clangd', 'cssls', 'tinymist'} -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - capabilities = capabilities, - } -end -lspconfig.pylsp.setup({settings={pylsp={plugins={pylint={enabled = true,}}}}}) - -local cmp = require('cmp') -cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - -- formatting = { - -- format = require('lspkind').cmp_format(), - -- }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - }) -}) - -require('autoclose').setup{} - -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'auto', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = {{'mode', separator = {left = '', right = ''}, padding = 0}}, - lualine_b = {'branch'}, - lualine_c = {'diagnostics'}, - lualine_x = {}, - lualine_y = {'filetype'}, - lualine_z = {{'filename', separator = {left = '', right = ''}, padding = 0}} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} -} - -require('screenkey').setup{} - --- The setup config table shows all available config options with their default values: -require("neocord").setup({ - -- General options - logo = "auto", -- "auto" or url - logo_tooltip = nil, -- nil or string - main_image = "language", -- "language" or "logo" - client_id = "1157438221865717891", -- 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)`) - blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches - file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference) - show_time = true, -- Show the timer - global_timer = false, -- if set true, timer won't update when any event are triggered - - -- Rich Presence text options - editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string) - file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string) - git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string) - plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string) - reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string) - workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string) - line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string) - terminal_text = "Using Terminal", -- Format string rendered when in terminal mode. -}) +vim.lsp.enable( + "rust_analyzer", + "clangd", + "jdtls", + "csharp_ls", + "html", + "ts_ls", + "css_ls", + "tinymist" +) vim.keymap.set({'n', 'x', 'o'}, ',', vim.diagnostic.open_float) vim.keymap.set({'n', 'x', 'o', 'i'}, '', "up") - -if vim.g.neovide then - vim.o.guifont = 'ComicShannsMono Nerd Font:h14' - vim.g.neovide_transparency = 0.85 - vim.g.neovide_cursor_animation_length = 0.05 - vim.g.neovide_cursor_trail_size = 0.5 -end - vim.cmd([[ no e @@ -119,9 +22,7 @@ vim.cmd([[ no A I no I A no k o - no / - ino - ino + no j J no h no t @@ -132,17 +33,19 @@ vim.cmd([[ no / ^ no = + ino + ino no ino no : ino : cno - nn :bn - nn :UndotreeToggle + no + " - no j J + no / nn :noh nn n + set number set relativenumber hi LineNr ctermfg=67 diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json deleted file mode 100644 index 460fd16..0000000 --- a/nvim/lazy-lock.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, - "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, - "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lspkind-nvim": { "branch": "master", "commit": "d53c53d76af05641e2ea7d3f8629019fc9c58aff" }, - "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, - "neocord": { "branch": "main", "commit": "41bacd44e9d36f5e36e0271672ac2c02f6fa355a" }, - "nvim": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" }, - "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, - "screenkey.nvim": { "branch": "main", "commit": "16390931d847b1d5d77098daccac4e55654ac9e2" }, - "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, - "typst-preview.nvim": { "branch": "master", "commit": "2503b188cd2a17ce44fdd21a944a93335e935215" }, - "vim-snippets": { "branch": "master", "commit": "f0a3184d9f90b96b044d5914625a25c554d7f301" }, - "vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" } -} diff --git a/nvim/lua/plugins/autoclose.lua b/nvim/lua/plugins/autoclose.lua index 311753d..c86cd74 100644 --- a/nvim/lua/plugins/autoclose.lua +++ b/nvim/lua/plugins/autoclose.lua @@ -1,3 +1,4 @@ return { 'm4xshen/autoclose.nvim', + opts = { } } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 61d77bc..30ed18a 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -1,17 +1,48 @@ return { - 'hrsh7th/nvim-cmp', - version = false, - lazy = false, - dependencies = { - "neovim/nvim-lspconfig", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/lspkind-nvim", - "honza/vim-snippets", - "hrsh7th/vim-vsnip", - "hrsh7th/cmp-vsnip", - "rafamadriz/friendly-snippets" - }, - init = function() - end + 'saghen/blink.cmp', + dependencies = { + "neovim/nvim-lspconfig", + 'rafamadriz/friendly-snippets' + }, + + -- use a release tag to download pre-built binaries + version = '1.*', + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'enter' }, + + appearance = { + nerd_font_variant = 'mono' + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'snippets' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" } + }, + opts_extend = { "sources.default" } } diff --git a/nvim/lua/plugins/keystrokes.lua b/nvim/lua/plugins/keystrokes.lua deleted file mode 100644 index 11c7a65..0000000 --- a/nvim/lua/plugins/keystrokes.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'NStefan002/screenkey.nvim', - lazy = false, - version = "*", -} diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index 2ec5ffa..8bb2b96 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -2,5 +2,37 @@ return { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', + }, + opts = { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {{'mode', separator = {left = '', right = ''}, padding = 0}}, + lualine_b = {'branch'}, + lualine_c = {'diagnostics'}, + lualine_x = {}, + lualine_y = {'filetype'}, + lualine_z = {{'filename', separator = {left = '', right = ''}, padding = 0}} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} } } diff --git a/nvim/lua/plugins/presence.lua b/nvim/lua/plugins/presence.lua deleted file mode 100644 index 44aaf88..0000000 --- a/nvim/lua/plugins/presence.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - 'IogaMaster/neocord', -} diff --git a/nvim/lua/plugins/typst.lua b/nvim/lua/plugins/typst.lua index 6f65f73..8bdc751 100644 --- a/nvim/lua/plugins/typst.lua +++ b/nvim/lua/plugins/typst.lua @@ -1,6 +1,4 @@ return { 'chomosuke/typst-preview.nvim', - lazy = false, -- or ft = 'typst' version = '1.*', - opts = {}, -- lazy.nvim will implicitly calls `setup {}` }