From 0700c237cb0df9f2ac0a08ece50c4bee6d844125 Mon Sep 17 00:00:00 2001 From: JackJ30 Date: Wed, 28 May 2025 01:31:16 -0400 Subject: better config --- .config/nvim/lua/user/options.lua | 7 ++- .config/nvim/lua/user/plugins/cmp.lua | 61 ++++++++++++++++++--------- .config/nvim/lua/user/plugins/colorscheme.lua | 4 +- .config/nvim/lua/user/plugins/fidget.lua | 17 ++++++++ .config/nvim/lua/user/plugins/find-file.lua | 10 ----- .config/nvim/lua/user/plugins/indent-bars.lua | 5 +++ .config/nvim/lua/user/plugins/lspconfig.lua | 8 +++- .config/nvim/lua/user/plugins/luasnip.lua | 12 ++++++ .config/nvim/lua/user/plugins/neogit.lua | 8 ++++ .config/nvim/lua/user/plugins/telescope.lua | 54 ++++++++++++++++++++++++ .config/nvim/lua/user/plugins/treesitter.lua | 24 +++++++++++ 11 files changed, 174 insertions(+), 36 deletions(-) create mode 100644 .config/nvim/lua/user/plugins/fidget.lua delete mode 100644 .config/nvim/lua/user/plugins/find-file.lua create mode 100644 .config/nvim/lua/user/plugins/indent-bars.lua create mode 100644 .config/nvim/lua/user/plugins/luasnip.lua create mode 100644 .config/nvim/lua/user/plugins/neogit.lua create mode 100644 .config/nvim/lua/user/plugins/telescope.lua create mode 100644 .config/nvim/lua/user/plugins/treesitter.lua (limited to '.config/nvim') diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua index ef987ff..d2163fd 100644 --- a/.config/nvim/lua/user/options.lua +++ b/.config/nvim/lua/user/options.lua @@ -7,8 +7,11 @@ vim.opt.shortmess:append { s = true, I = true } vim.g.mapleader = ' ' vim.g.maplocalleader = '\\' -vim.opt.signcolumn="yes" +vim.opt.signcolumn="number" +vim.opt.number=true +vim.opt.fillchars:append({ eob = " " }) vim.diagnostic.config({ - virtual_text = true + virtual_text = true, + update_in_insert = true, }) diff --git a/.config/nvim/lua/user/plugins/cmp.lua b/.config/nvim/lua/user/plugins/cmp.lua index 8776310..95ae6d5 100644 --- a/.config/nvim/lua/user/plugins/cmp.lua +++ b/.config/nvim/lua/user/plugins/cmp.lua @@ -1,24 +1,45 @@ return { - 'hrsh7th/nvim-cmp', - event = { 'InsertEnter', 'CmdlineEnter' }, - dependencies = { - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-path', - }, - opts = function() - local cmp = require('cmp') + 'hrsh7th/nvim-cmp', + event = { 'InsertEnter', 'CmdlineEnter' }, + dependencies = { + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-path', + }, + opts = function() + local cmp = require('cmp') - return { - mapping = cmp.mapping.preset.insert(), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - }, { - { name = 'buffer' }, - }, { - { name = 'path' }, - }) - } - end, + return { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert(), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = "luasnip" }, + }, { + { name = 'buffer' }, + }, { + { name = 'path' }, + }), + sorting = { + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + --cmp.config.compare.scopes, + cmp.config.compare.score, + cmp.config.compare.recently_used, + cmp.config.compare.locality, + cmp.config.compare.kind, + --cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + }, + }, + } + end, } diff --git a/.config/nvim/lua/user/plugins/colorscheme.lua b/.config/nvim/lua/user/plugins/colorscheme.lua index 7862f25..593cc45 100644 --- a/.config/nvim/lua/user/plugins/colorscheme.lua +++ b/.config/nvim/lua/user/plugins/colorscheme.lua @@ -1,6 +1,6 @@ return { - "Mofiqul/dracula.nvim", + "rose-pine/neovim", config = function () - vim.cmd[[colorscheme dracula]] + vim.cmd[[colorscheme rose-pine]] end } diff --git a/.config/nvim/lua/user/plugins/fidget.lua b/.config/nvim/lua/user/plugins/fidget.lua new file mode 100644 index 0000000..facf28b --- /dev/null +++ b/.config/nvim/lua/user/plugins/fidget.lua @@ -0,0 +1,17 @@ +return { + 'j-hui/fidget.nvim', + tag = 'v1.4.1', + lazy = true, + opts = { + progress = { + display = { + progress_icon = { pattern = 'line', period = 0.7 }, + }, + }, + notification = { + window = { + winblend = 0, + }, + }, + }, +} diff --git a/.config/nvim/lua/user/plugins/find-file.lua b/.config/nvim/lua/user/plugins/find-file.lua deleted file mode 100644 index b547d10..0000000 --- a/.config/nvim/lua/user/plugins/find-file.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "NAHTAIV3L/vertico.nvim", - dependencies = { - 'nvim-lua/plenary.nvim', - }, - config = function () - vim.keymap.set("n", "f", require("vertico").find_file) - vim.keymap.set("n", "", require("vertico").close) - end -} diff --git a/.config/nvim/lua/user/plugins/indent-bars.lua b/.config/nvim/lua/user/plugins/indent-bars.lua new file mode 100644 index 0000000..29812cc --- /dev/null +++ b/.config/nvim/lua/user/plugins/indent-bars.lua @@ -0,0 +1,5 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + config = true, +} diff --git a/.config/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua index 371fdec..01b3262 100644 --- a/.config/nvim/lua/user/plugins/lspconfig.lua +++ b/.config/nvim/lua/user/plugins/lspconfig.lua @@ -15,7 +15,7 @@ local on_attach = function(client, bufnr) keymap('n', 'K', vim.lsp.buf.hover, { desc = 'Show documentation' }) keymap('n', 'gK', vim.lsp.buf.signature_help, { desc = 'Show signature' }) - keymap('i', '', vim.lsp.buf.signature_help, { desc = 'Show signature' }) + keymap('i', '', vim.lsp.buf.signature_help, { desc = 'Show signature' }) keymap('n', 'rn', vim.lsp.buf.rename, { desc = 'Rename symbol' }) keymap('n', 'ca', vim.lsp.buf.code_action, { desc = 'Code action' }) @@ -34,8 +34,9 @@ return { 'neovim/nvim-lspconfig', dependencies = { "hrsh7th/cmp-nvim-lsp", + 'j-hui/fidget.nvim', }, - ft = { 'lua', 'zig' }, + ft = { 'c', 'cpp', 'lua', 'zig' }, opts = { servers = { lua_ls = { @@ -46,6 +47,9 @@ return { }, }, }, + clangd = { + settings = {}, + }, zls = { settings = {}, }, diff --git a/.config/nvim/lua/user/plugins/luasnip.lua b/.config/nvim/lua/user/plugins/luasnip.lua new file mode 100644 index 0000000..8ed8c24 --- /dev/null +++ b/.config/nvim/lua/user/plugins/luasnip.lua @@ -0,0 +1,12 @@ +return { + 'L3MON4D3/LuaSnip', + lazy = true, + dependencies = { 'rafamadriz/friendly-snippets' }, + keys = { + { '', function() require('luasnip').jump(-1) end, mode = { 'i', 's' } }, + { '', function() require('luasnip').jump(1) end, mode = { 'i', 's' } }, + }, + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, +} diff --git a/.config/nvim/lua/user/plugins/neogit.lua b/.config/nvim/lua/user/plugins/neogit.lua new file mode 100644 index 0000000..0f5f90e --- /dev/null +++ b/.config/nvim/lua/user/plugins/neogit.lua @@ -0,0 +1,8 @@ +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + "nvim-telescope/telescope.nvim", -- optional + }, +} diff --git a/.config/nvim/lua/user/plugins/telescope.lua b/.config/nvim/lua/user/plugins/telescope.lua new file mode 100644 index 0000000..ab0e24f --- /dev/null +++ b/.config/nvim/lua/user/plugins/telescope.lua @@ -0,0 +1,54 @@ +return { + 'nvim-telescope/telescope.nvim', + cmd = 'Telescope', + dependencies = { + 'nvim-lua/plenary.nvim', + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + }, + keys = function() + local lazy_telescope = function(builtin) + return function(...) + require('telescope.builtin')[builtin](...) + end + end + return { + { 'fb', lazy_telescope('buffers'), desc = 'Find buffers' }, + { 'fd', lazy_telescope('diagnostics'), desc = 'Find diagnostics' }, + { 'ff', lazy_telescope('git_files'), desc = 'Find Git files' }, + { 'fF', lazy_telescope('find_files'), desc = 'Find files' }, + { 'fg', lazy_telescope('live_grep'), desc = 'Find files by content' }, + { 'fh', lazy_telescope('help_tags'), desc = 'Find help tags' }, + { 'fo', lazy_telescope('oldfiles'), desc = 'Find recently opened files' }, + { 'fw', lazy_telescope('grep_string'), desc = 'Find word in buffer' }, + { 'f/', lazy_telescope('current_buffer_fuzzy_find'), desc = 'Find fuzzy match in current buffer' }, + } + end, + opts = function() + return { + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + } + }, + } + end, + config = function() + local telescope = require('telescope') + telescope.setup({ + defaults = { + mappings = { + i = { + [""] = require('telescope.actions').close, + }, + n = { + [""] = require('telescope.actions').close, + }, + }, + }, + }) + telescope.load_extension('fzf') + end, +} diff --git a/.config/nvim/lua/user/plugins/treesitter.lua b/.config/nvim/lua/user/plugins/treesitter.lua new file mode 100644 index 0000000..6e2950f --- /dev/null +++ b/.config/nvim/lua/user/plugins/treesitter.lua @@ -0,0 +1,24 @@ +return { + 'nvim-treesitter/nvim-treesitter', + ft = { 'c', 'cpp', 'zig', 'lua', 'rust' }, + build = ':TSUpdate', + config = function() + require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'lua', 'rust', 'vimdoc', 'vim' }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = false, + + highlight = { + enable = true, + disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, + additional_vim_regex_highlighting = false, + }, + } + end, +} -- cgit v1.2.3