diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 41107593..10c32a68 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,7 +1,3 @@ --- local vim = vim -require('plugins') -require('keymaps') - -- Need to replace this once lua api has vim modes vim.api.nvim_exec([[ augroup Packer @@ -21,10 +17,10 @@ augroup end au BufNewFile,BufRead,BufReadPost *.html.tera set syntax=HTML ]], false) -vim.o.number = true +vim.o.number = true vim.o.relativenumber = true vim.o.timeoutlen = 700 -vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font' +vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font:h11' vim.o.undodir=vim.fn.stdpath('cache')..'/undodir' vim.o.undofile = true @@ -55,7 +51,7 @@ vim.g.python_highlight_all = 1 vim.g.test = { default = { - default = { + default = { complete_items = { 'lsp', 'snippet' }, mode = 'file', }, @@ -66,53 +62,20 @@ vim.g.test = { } --- Temp - vim.o.completeopt = 'menuone,noselect' --- -- luasnip setup --- local luasnip = require 'luasnip' +vim.g.coq_settings = { + auto_start = 'shut-up' +} + +require('plugins') +require('keymaps') + +require'nvim-treesitter.configs'.setup { + ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + additional_vim_regex_highlighting = false, + }, +} --- -- nvim-cmp setup --- local cmp = require 'cmp' --- cmp.setup { --- snippet = { --- expand = function(args) --- require('luasnip').lsp_expand(args.body) --- end, --- }, --- mapping = { --- [''] = cmp.mapping.select_prev_item(), --- [''] = cmp.mapping.select_next_item(), --- [''] = cmp.mapping.scroll_docs(-4), --- [''] = cmp.mapping.scroll_docs(4), --- [''] = cmp.mapping.complete(), --- [''] = cmp.mapping.close(), --- [''] = cmp.mapping.confirm { --- behavior = cmp.ConfirmBehavior.Replace, --- select = true, --- }, --- [''] = function(fallback) --- if cmp.visible() then --- cmp.select_next_item() --- elseif luasnip.expand_or_jumpable() then --- luasnip.expand_or_jump() --- else --- fallback() --- end --- end, --- [''] = function(fallback) --- if cmp.visible() then --- cmp.select_prev_item() --- elseif luasnip.jumpable(-1) then --- luasnip.jump(-1) --- else --- fallback() --- end --- end, --- }, --- sources = { --- { name = 'nvim_lsp' }, --- { name = 'luasnip' }, --- }, --- } diff --git a/config/nvim/lua/keymaps.lua b/config/nvim/lua/keymaps.lua index 2b0feea1..54b45033 100644 --- a/config/nvim/lua/keymaps.lua +++ b/config/nvim/lua/keymaps.lua @@ -12,6 +12,7 @@ local normal_mode_maps = { { key = 'n', map = [[bnext]] }, { key = 'p', map = [[bprev]] }, { key = 'q', map = [[bw]] }, + { key = 'v', map = [[CHADopen]] }, -- fzf { key = ';', map = [[Buffers]] }, diff --git a/config/nvim/lua/lsp/deno.lua b/config/nvim/lua/lsp/deno.lua new file mode 100644 index 00000000..0e063664 --- /dev/null +++ b/config/nvim/lua/lsp/deno.lua @@ -0,0 +1,9 @@ +local lspconfig = require'lspconfig' +local lspstatus = require'lsp-status' +local coq = require'coq' + +lspconfig.denols.setup{ + on_attach=function(client) lspstatus.on_attach(client) return end, + capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), +} + diff --git a/config/nvim/lua/lsp/init.lua b/config/nvim/lua/lsp/init.lua index 7b9115d5..2eb28dc2 100644 --- a/config/nvim/lua/lsp/init.lua +++ b/config/nvim/lua/lsp/init.lua @@ -3,9 +3,10 @@ require("lsp.rust-analyzer") require("lsp.lua-language-server") --- require("lsp.pyls") +require("lsp.deno") -- Set completeopt to have a better completion experience +-- vim.o.completeopt= "menuone,noinsert,noselect" vim.o.completeopt= "menuone,noselect" -- vim.api.nvim_command [[autocmd CursorHold lua vim.lsp.buf.document_highlight()]] diff --git a/config/nvim/lua/lsp/lua-language-server.lua b/config/nvim/lua/lsp/lua-language-server.lua index e9e80e78..e1c340ad 100644 --- a/config/nvim/lua/lsp/lua-language-server.lua +++ b/config/nvim/lua/lsp/lua-language-server.lua @@ -1,18 +1,23 @@ local lspconfig = require'lspconfig' --- local lspstatus = require('lsp-status') +local lspstatus = require('lsp-status') +local coq = require'coq' -require'lspconfig'.sumneko_lua.setup{ +lspconfig.sumneko_lua.setup{ cmd = { "lua-language-server" }, - on_attach=function(client) require'completion'.on_attach(client) require'lsp-status'.on_attach(client) return end, - -- on_attach=require'completion'.on_attach, + on_attach=function(client) lspstatus.on_attach(client) return end, + capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), filetypes = { "lua" }, log_level = 2, - root_dir = lspconfig.util.root_pattern(".git"), settings = { Lua = { + diagnostics = { + globals = {'vim'}, + }, telemetry = { - enable = false + enable = false, } } } } +-- lspconfig.sumenko_lua.setup(coq.lsp_ensure_capabilities()) +-- require'lspconfig'.sumneko_lua.setup{coq.lsp_ensure_capabilities()} diff --git a/config/nvim/lua/lsp/pyls.lua b/config/nvim/lua/lsp/pyls.lua index c32632f2..4e382515 100644 --- a/config/nvim/lua/lsp/pyls.lua +++ b/config/nvim/lua/lsp/pyls.lua @@ -1,6 +1,8 @@ local lspconfig = require'lspconfig' lspconfig.pyls.setup{ - cmd = { "pyls" }, - filetypes = { "python" }, + coq.lsp_ensure_capabilities{ + cmd = { "pyls" }, + filetypes = { "python" }, + } } diff --git a/config/nvim/lua/lsp/rust-analyzer.lua b/config/nvim/lua/lsp/rust-analyzer.lua index 11102753..4b8573ca 100644 --- a/config/nvim/lua/lsp/rust-analyzer.lua +++ b/config/nvim/lua/lsp/rust-analyzer.lua @@ -1,15 +1,17 @@ local lspconfig = require'lspconfig' - +local lspstatus = require'lsp-status' +local coq = require'coq' lspconfig.rust_analyzer.setup{ - on_attach=function(client) require'lsp-status'.on_attach(client) return end, - capabilities = require'lsp-status'.capabilities, + on_attach=function(client) lspstatus.on_attach(client) return end, + capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), cmd = { "rust-analyzer" }, filetypes = { "rust" }, root_dir = lspconfig.util.root_pattern("Cargo.toml"), settings = { ["rust-analyzer"] = { - assist = { + lruCapacity = 64, + assist = { importGranularity = "module", importPrefix = "by_self", }, @@ -25,9 +27,6 @@ lspconfig.rust_analyzer.setup{ allFeatures = true, } } - } + }, } -lspconfig.rust_analyzer.setup{ - capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -} diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 1fe45f8b..bcfb4437 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -54,15 +54,11 @@ return require('packer').startup(function() use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, } use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } + use { 'williamboman/nvim-lsp-installer' } use { 'nvim-lua/lsp-status.nvim' } + + use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' } } - - use { - 'hrsh7th/nvim-cmp', - requires = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'saadparwaiz1/cmp_luasnip', 'L3MON4D3/LuaSnip' }, - config = function() require'nvim-cmp' end, - } - use { 'folke/lsp-colors.nvim' } use { 'nvim-lua/lsp_extensions.nvim' } -- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end, @@ -75,13 +71,16 @@ return require('packer').startup(function() config = function() require'setup.toggleterm' end, } - use { 'airblade/vim-rooter' } + -- use { 'airblade/vim-rooter' } use { 'glepnir/dashboard-nvim' } - -- Treesitter {{{ - -- use { 'nvim-treesitter/nvim-treesitter' } - -- use { 'nvim-treesitter/completion-treesitter' } - --- }}} + -- Treesitter {{{ + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + + -- }}} --: rust {{{ use { @@ -91,4 +90,7 @@ return require('packer').startup(function() } -- }}} use { 'vim-python/python-syntax' } + + use { 'ms-jpq/chadtree' } + end) diff --git a/config/nvim/lua/nvim-cmp.lua b/config/nvim/lua/setup/nvim-cmp.lua similarity index 100% rename from config/nvim/lua/nvim-cmp.lua rename to config/nvim/lua/setup/nvim-cmp.lua diff --git a/config/nvim/lua/setup/toggleterm.lua b/config/nvim/lua/setup/toggleterm.lua index c6c590e0..d6ccbe7a 100644 --- a/config/nvim/lua/setup/toggleterm.lua +++ b/config/nvim/lua/setup/toggleterm.lua @@ -17,7 +17,6 @@ require("toggleterm").setup{ -- see :h nvim_win_open for details on borders however -- the 'curved' border is a custom border type -- not natively supported but implemented in this plugin. - -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open border = 'single', width = 30, diff --git a/config/nvim/lua/statusline.lua b/config/nvim/lua/statusline.lua index d5cc003b..b1359e16 100644 --- a/config/nvim/lua/statusline.lua +++ b/config/nvim/lua/statusline.lua @@ -121,12 +121,12 @@ gls.left[2] = { } } -gls.left[3] = { - ShowLspStatus = { - provider = lsp_status.status, - highlight = { colors.grey , colors.dark_black, 'bold' } - } -} +-- gls.left[3] = { +-- ShowLspStatus = { +-- provider = lsp_status.status, +-- highlight = { colors.grey , colors.dark_black, 'bold' } +-- } +-- } -- Right Side diff --git a/config/nvim/plugin/packer_compiled.lua b/config/nvim/plugin/packer_compiled.lua new file mode 100644 index 00000000..e486e4a9 --- /dev/null +++ b/config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,253 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/savy/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s)) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + chadtree = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/chadtree" + }, + ["comfortable-motion.vim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/comfortable-motion.vim" + }, + ["coq.artifacts"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/coq.artifacts" + }, + coq_nvim = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/coq_nvim" + }, + ["dashboard-nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/dashboard-nvim" + }, + ["diffview.nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/diffview.nvim" + }, + fzf = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/fzf" + }, + ["fzf.vim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/fzf.vim" + }, + ["galaxyline.nvim"] = { + config = { "\27LJ\1\2*\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\15statusline\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/galaxyline.nvim" + }, + ["lsp-colors.nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim" + }, + ["lsp-status.nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-status.nvim" + }, + ["lsp-trouble.nvim"] = { + config = { "\27LJ\1\0025\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\ftrouble\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-trouble.nvim" + }, + ["lsp_extensions.nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim" + }, + ["lspkind-nvim"] = { + config = { "\27LJ\1\0024\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\tinit\flspkind\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/lspkind-nvim" + }, + ["nvim-colorizer.lua"] = { + config = { "\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua" + }, + ["nvim-lsp-installer"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer" + }, + ["nvim-lspconfig"] = { + config = { "\27LJ\1\2#\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\blsp\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" + }, + ["nvim-toggleterm.lua"] = { + config = { "\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21setup.toggleterm\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-toggleterm.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/packer.nvim" + }, + ["python-syntax"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/python-syntax" + }, + ["rust.vim"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/rust.vim" + }, + sonokai = { + config = { "\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16colorscheme\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/sonokai" + }, + ["vim-commentary"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-commentary" + }, + ["vim-crates"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-crates" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-fugitive" + }, + ["vim-repeat"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-repeat" + }, + ["vim-speeddating"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-speeddating" + }, + ["vim-surround"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-surround" + }, + ["vim-toml"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-toml" + }, + ["vim-vinegar"] = { + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-vinegar" + }, + ["which-key.nvim"] = { + config = { "\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14which-key\frequire\0" }, + loaded = true, + path = "/home/savy/.local/share/nvim/site/pack/packer/start/which-key.nvim" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: lspkind-nvim +time([[Config for lspkind-nvim]], true) +try_loadstring("\27LJ\1\0024\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\tinit\flspkind\frequire\0", "config", "lspkind-nvim") +time([[Config for lspkind-nvim]], false) +-- Config for: nvim-lspconfig +time([[Config for nvim-lspconfig]], true) +try_loadstring("\27LJ\1\2#\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\blsp\frequire\0", "config", "nvim-lspconfig") +time([[Config for nvim-lspconfig]], false) +-- Config for: nvim-colorizer.lua +time([[Config for nvim-colorizer.lua]], true) +try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua") +time([[Config for nvim-colorizer.lua]], false) +-- Config for: which-key.nvim +time([[Config for which-key.nvim]], true) +try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") +time([[Config for which-key.nvim]], false) +-- Config for: galaxyline.nvim +time([[Config for galaxyline.nvim]], true) +try_loadstring("\27LJ\1\2*\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\15statusline\frequire\0", "config", "galaxyline.nvim") +time([[Config for galaxyline.nvim]], false) +-- Config for: nvim-toggleterm.lua +time([[Config for nvim-toggleterm.lua]], true) +try_loadstring("\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21setup.toggleterm\frequire\0", "config", "nvim-toggleterm.lua") +time([[Config for nvim-toggleterm.lua]], false) +-- Config for: lsp-trouble.nvim +time([[Config for lsp-trouble.nvim]], true) +try_loadstring("\27LJ\1\0025\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\ftrouble\frequire\0", "config", "lsp-trouble.nvim") +time([[Config for lsp-trouble.nvim]], false) +-- Config for: sonokai +time([[Config for sonokai]], true) +try_loadstring("\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16colorscheme\frequire\0", "config", "sonokai") +time([[Config for sonokai]], false) +if should_profile then save_profiles() end + +end) + +if not no_errors then + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end