diff --git a/.gitignore b/.gitignore index 14a9370b..5ffa6434 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,24 @@ -tags -test.sh -.luarc.json -nvim +# OS files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db -spell/ - -# Project status tracking (local only) -CLAUDE.md -STATUS.md -VIDINTEL.md -KEYBIND_ANALYSIS.md +# Neovim runtime files +.cache/ +.local/ +*.tmp +*.swp +*.swo +*~ +# Plugin artifacts lazy-lock.json +.luarc.json + +# Development artifacts +*.disabled +todo.md diff --git a/init.lua b/init.lua index dee03ef4..a8755d7b 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -631,19 +631,7 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - clangd = { - cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], - }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = require('lspconfig.util').root_pattern '.git', - single_file_support = true, - }, + -- clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, @@ -658,7 +646,7 @@ require('lazy').setup({ lua_ls = { -- cmd = { ... }, - -- filetypes = { ... }, + filetypes = { 'lua', 'luau' }, -- capabilities = {}, settings = { Lua = { diff --git a/lua/custom/plugins/avante.lua b/lua/custom/plugins/avante.lua deleted file mode 100644 index ff03f7b9..00000000 --- a/lua/custom/plugins/avante.lua +++ /dev/null @@ -1,46 +0,0 @@ -return { - "yetone/avante.nvim", - event = "VeryLazy", - lazy = false, - version = false, -- set this if you want to always pull the latest change - opts = { - -- add any opts here - }, - -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` - build = "make", - -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows - dependencies = { - "stevearc/dressing.nvim", - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - --- The below dependencies are optional, - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions - "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - "zbirenbaum/copilot.lua", -- for providers='copilot' - { - -- support for image pasting - "HakonHarnes/img-clip.nvim", - event = "VeryLazy", - opts = { - -- recommended settings - default = { - embed_image_as_base64 = false, - prompt_for_file_name = false, - drag_and_drop = { - insert_mode = true, - }, - -- required for Windows users - use_absolute_path = true, - }, - }, - }, - { - -- Make sure to set this up properly if you have lazy=true - 'MeanderingProgrammer/render-markdown.nvim', - opts = { - file_types = { "markdown", "Avante" }, - }, - ft = { "markdown", "Avante" }, - }, - }, -} \ No newline at end of file diff --git a/lua/custom/plugins/completion.lua b/lua/custom/plugins/completion.lua deleted file mode 100644 index 81a23b17..00000000 --- a/lua/custom/plugins/completion.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', -- Load when entering insert mode - dependencies = { - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - { -- LuaSnip and its potential build step - 'L3MON4D3/LuaSnip', - -- Follow latest V2 release. - version = 'v2.*', - -- tag = '', -- Removed tag specification - -- install jsregexp (optional!:). - build = (function() - -- Build Step is needed for regex support in snippets. This step is optional. - -- Remove the below condition to build Luasnip with regex support on Mac and Linux. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - }, - 'saadparwaiz1/cmp_luasnip', -- Snippet source for nvim-cmp - -- Add other cmp sources if needed, e.g.: - -- 'hrsh7th/cmp-cmdline', - }, - config = function() - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} -- Setup luasnip first - - local function toggle_path_completion() - local config = cmp.get_config() - local snippet = config.snippet - local completion = config.completion - local mapping = config.mapping - - local path_enabled = vim.tbl_any(function(src) - return src.name == 'path' - end, config.sources) - - local new_sources = { - { name = 'lazydev', group_index = 0 }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - } - - if not path_enabled then - table.insert(new_sources, { name = 'path' }) - end - - cmp.setup { - snippet = snippet, - completion = completion, - mapping = mapping, - sources = new_sources, - } - - print('Path completion ' .. (path_enabled and 'disabled' or 'enabled')) - end - - -- Configure nvim-cmp - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- Expand snippets using luasnip - end, - }, - completion = { - -- Set completeopt to have a better completion experience - -- :help completeopt - -- menuone: popup even when there's only one match - -- noinsert: Do not insert text until a selection is made - -- noselect: Do not select the first item by default - completeopt = 'menu,menuone,noinsert', - }, - -- Key Mappings for completion - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), -- Select next item - [''] = cmp.mapping.select_prev_item(), -- Select previous item - [''] = cmp.mapping.scroll_docs(-4), -- Scroll documentation back - [''] = cmp.mapping.scroll_docs(4), -- Scroll documentation forward - [''] = cmp.mapping.confirm { select = true }, -- Confirm selection - [''] = cmp.mapping.complete {}, -- Trigger completion manually - - -- Handle snippet jumping - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), -- Jump forward in snippet - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), -- Jump backward in snippet - }, - -- Completion sources - sources = cmp.config.sources { - { name = 'nvim_lsp' }, -- LSP symbols - { name = 'luasnip' }, -- Snippets - { name = 'buffer' }, -- Words from current buffer - { name = 'path' }, -- Filesystem paths - }, - -- Add other cmp setup options from your old config if any - } - - vim.keymap.set('n', 'tp', toggle_path_completion, { desc = '[T]oggle [p]ath completion' }) - end, -- End of config function - }, -} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..18744d84 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,14 @@ +return { + { + 'github/copilot.vim', + event = 'VimEnter', + config = function() + -- Accept suggestion with Ctrl-y + vim.keymap.set('i', '', 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false + }) + vim.g.copilot_no_tab_map = true + end, + }, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 722ec301..22ef8fa6 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,14 +3,15 @@ -- -- See the kickstart.nvim README for more information return { - { import = 'custom.plugins.avante' }, -- { import = 'custom.plugins.completion' }, + -- { import = 'custom.plugins.theme' }, + -- { import = 'custom.plugins.avante' }, + { import = 'custom.plugins.copilot' }, { import = 'custom.plugins.debug' }, { import = 'custom.plugins.formatting' }, { import = 'custom.plugins.git' }, { import = 'custom.plugins.lsp' }, { import = 'custom.plugins.nvim-tmux-navigator' }, { import = 'custom.plugins.telescope' }, - -- { import = 'custom.plugins.theme' }, { import = 'custom.plugins.treesitter' }, } diff --git a/lua/custom/plugins/lsp/lsp.lua b/lua/custom/plugins/lsp/lsp.lua index cd330778..9f25c4a3 100644 --- a/lua/custom/plugins/lsp/lsp.lua +++ b/lua/custom/plugins/lsp/lsp.lua @@ -5,10 +5,33 @@ return { { 'neovim/nvim-lspconfig', -- only load when editing these filetypes (optional) - ft = { 'python', 'lua', 'nix', 'rust', 'go', 'c', 'cpp' }, + ft = { + 'c', + 'cpp', + 'objc', + 'objcpp', + 'cuda', + 'cmake', + -- + 'go', + 'nix', + 'python', + 'rust', + 'tex', + }, opts = function() local lspconfig = require 'lspconfig' - local capabilities = require('blink.cmp').get_lsp_capabilities() + local capabilities = {} + pcall(function() + capabilities = require('blink.cmp').get_lsp_capabilities() + end) + local util = require 'lspconfig.util' + + local query_driver = table.concat({ + '/nix/store/*/bin/clang*', + '/opt/homebrew/opt/llvm/bin/clang*', + '/usr/bin/clang*', + }, ';') local servers = { clangd = { @@ -17,13 +40,22 @@ return { '--background-index', '--clang-tidy', '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath('clang++'), - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + '--query-driver=' .. query_driver, + '--compile-commands-dir=build', + '--resource-dir=' .. (function() + local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' }) + if ok and result and result[1] then + return result[1] + else + return '/usr/lib/clang/19/include' -- fallback + end + end)(), }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = require('lspconfig.util').root_pattern('.git'), + root_dir = util.root_pattern('CMakeLists.txt', '.git'), single_file_support = true, }, + pyright = { settings = { python = { @@ -37,13 +69,16 @@ return { }, positionEncoding = 'utf-8', }, - nixd = {}, ruff = {}, + + nixd = {}, + texlab = {}, + cmake = { cmd = { 'cmake-language-server' }, filetypes = { 'cmake' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), + root_dir = util.root_pattern('CMakeLists.txt', '.git'), }, } diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua deleted file mode 100644 index 58e088d8..00000000 --- a/lua/custom/plugins/statusline.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - 'echasnovski/mini.statusline', - dependencies = { 'nvim-tree/nvim-web-devicons' }, -- optional for icons - opts = function(_, opts) - local statusline = require 'mini.statusline' - - -- Add new section function - -- statusline.section_target = function() - -- local target = require('custom.utils'):get_target() - -- return target and (' ' .. target) or '' - -- end - - -- Override content.active to include target - opts.content = opts.content or {} - opts.content.active = function() - local mode, git, diagnostics, filename, fileinfo, target, location = - statusline.section_mode {}, - statusline.section_git {}, - statusline.section_diagnostics {}, - statusline.section_filename {}, - statusline.section_fileinfo {}, - -- statusline.section_target {}, - statusline.section_location {} - - return statusline.combine_groups { - { hl = 'MiniStatuslineModeNormal', strings = { mode } }, - { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } }, - '%<', - { hl = 'MiniStatuslineFilename', strings = { filename } }, - { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, - { hl = 'MiniStatuslineTarget', strings = { target } }, - { hl = 'MiniStatuslineLocation', strings = { location } }, - } - end - - return opts - end, -} diff --git a/lua/custom/plugins/theme.lua b/lua/custom/plugins/theme.lua deleted file mode 100644 index 3bff8c6d..00000000 --- a/lua/custom/plugins/theme.lua +++ /dev/null @@ -1,12 +0,0 @@ --- Theme configuration - -return { - { - 'catppuccin/nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'catppuccin-mocha' - end, - }, - { 'folke/tokyonight.nvim', enabled = false }, -}