From 966f4fdc0b7bb331f30bdd90c796711c187d0f26 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Fri, 29 Nov 2024 21:19:14 -0500 Subject: [PATCH] Redo everything because of an LSP bug and it still didn't fix it :( --- README.md | 5 ++ init.lua | 8 +-- lazy-lock.json | 12 ++++ lua/autocmd.lua | 2 - lua/config/keybindings.lua | 41 +++++++++++++ lua/config/lazy.lua | 17 ++++++ lua/config/opts.lua | 36 +++++++++++ lua/keybindings.lua | 98 ------------------------------ lua/lsp.lua | 119 ------------------------------------- lua/nvim-cmp-cfg.lua | 47 --------------- lua/nvim_opts.lua | 47 --------------- lua/plugins.lua | 57 ------------------ lua/plugins/git.lua | 4 ++ lua/plugins/lsp.lua | 111 ++++++++++++++++++++++++++++++++++ lua/plugins/telescope.lua | 7 +++ lua/plugins/tokyonight.lua | 9 +++ lua/plugins/treesitter.lua | 10 ++++ lua/ts-context.lua | 22 ------- lua/ts_config.lua | 16 ----- plugin/quickfixlist.vim | 22 ------- 20 files changed, 255 insertions(+), 435 deletions(-) create mode 100644 README.md create mode 100644 lazy-lock.json delete mode 100644 lua/autocmd.lua create mode 100644 lua/config/keybindings.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/opts.lua delete mode 100644 lua/keybindings.lua delete mode 100644 lua/lsp.lua delete mode 100644 lua/nvim-cmp-cfg.lua delete mode 100644 lua/nvim_opts.lua delete mode 100644 lua/plugins.lua create mode 100644 lua/plugins/git.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/tokyonight.lua create mode 100644 lua/plugins/treesitter.lua delete mode 100644 lua/ts-context.lua delete mode 100644 lua/ts_config.lua delete mode 100644 plugin/quickfixlist.vim diff --git a/README.md b/README.md new file mode 100644 index 0000000..e95f618 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +```bash +mkdir -p ~/.config/.local/share/nvim +cd ~/.config/.local/share/nvim +git clone --filter=blob:none --branch=stable https://github.com/folke/lazy.nvim.git ./lazy/lazy.nvim +``` diff --git a/init.lua b/init.lua index c52ffe4..94822a9 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,3 @@ -require('plugins') -- Setup packer.nvim and install plugins -require('nvim_opts') -- Basic vim options -require('autocmd') -- Convenient Autocommands -require('lsp') -require('ts_config') +require("config.opts") +require("config.lazy") +require("config.keybindings") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..3588879 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,12 @@ +{ + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, + "nvim-cmp": { "branch": "main", "commit": "ed31156aa2cc14e3bc066c59357cc91536a2bc01" }, + "nvim-lspconfig": { "branch": "master", "commit": "e869c7e6af0a3c40a2b344a9765779d74dd12720" }, + "nvim-treesitter": { "branch": "master", "commit": "427a90ae70f66c2fdf2d9ad16a0f08e9697d90d9" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "tokyonight.nvim": { "branch": "main", "commit": "c2725eb6d086c8c9624456d734bd365194660017" }, + "vim-fugitive": { "branch": "master", "commit": "320b18fba2a4f2fe3c8225c778c687e0d2620384" }, + "vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" } +} diff --git a/lua/autocmd.lua b/lua/autocmd.lua deleted file mode 100644 index d297a3a..0000000 --- a/lua/autocmd.lua +++ /dev/null @@ -1,2 +0,0 @@ --- Highlight on yank -vim.cmd('au TextYankPost * lua vim.highlight.on_yank {on_visual = false}' )-- disabled in visual mode diff --git a/lua/config/keybindings.lua b/lua/config/keybindings.lua new file mode 100644 index 0000000..fcb32ee --- /dev/null +++ b/lua/config/keybindings.lua @@ -0,0 +1,41 @@ +local map = vim.keymap.set + +options = { noremap = true } + +-- FILE NAVIGATION +local builtin = require('telescope.builtin') +map('n', 'f', builtin.find_files, options) +map('n', 'af', builtin.git_files, options) +-- Grep project file contents with live results, respecting .gitignore +map('n', 'g', builtin.live_grep, options) +-- Telescope fuzzy search for buffers +map('n', 'b', builtin.buffers, options) + +map('n', 'ga', '', options) -- ga to switch to last used buffer + +-- Quick Fix Lists +-- global -- using control +map('n', '', 'cnextzz', options) -- Go to next item in global qfixlist +map('n', '', 'cprevzz', options) -- Go to previous item in global qfixlist +-- Toggle the window if there are items in the qfixlist; allow recursive +map('n', 'Q', 'call ToggleQFList(1)', {}) -- see plugin/navigation.vim for ToggleQFList definition +-- local -- using leader +map('n', 'j', 'lnextzz', options) -- Go to next item in local qfixlist +map('n', 'k', 'lprevzz', options) -- Go to previous item in global qfixlist +-- Toggle the window if there are items in the qfixlist; allow recursive +map('n', 'q', 'call ToggleQFList(0)', {}) -- see plugin/navigation.vim for ToggleQFList definition + +-- GIT +-- top level commands +map('n', 'gs', 'keepalt Git', options) -- Show git status +map('n', 'gc', 'G commit -v', options) -- git commit +map('n', 'gp', 'G push', {}) -- git push +map('n', 'gd', 'G diff', options) +map('n', 'gds', 'G diff --staged', options) + +-- staging +map('n', 'dp', 'diffput', options) + +-- merge +map('n', 'gh', 'diffget //2', options) -- merge from left pane +map('n', 'gl', 'diffget //3', options) -- merge from right pane diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..572345d --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,17 @@ +-- See README.md for bootstrapping +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + pkg = { enabled = false }, + rocks = { enabled = false }, + custom_keys = { + -- Disable default keybindings + ["l"] = false, + ["i"] = false, + ["t"] = false, + }, +}) diff --git a/lua/config/opts.lua b/lua/config/opts.lua new file mode 100644 index 0000000..1b75b4e --- /dev/null +++ b/lua/config/opts.lua @@ -0,0 +1,36 @@ +vim.g.mapleader = " " + +-- basic UI +vim.o.background = 'dark' +vim.o.termguicolors = true -- enable 24 bit colors in TUI +vim.g.syntax = true +vim.wo.number = true +vim.wo.relativenumber = true +vim.o.signcolumn = 'yes' +vim.o.splitright = true +vim.o.splitbelow = true +vim.o.colorcolumn = '80' + +-- text +vim.wo.wrap = false +vim.wo.foldenable = false +vim.o.mouse = 'a' -- enable mouse in all modes +vim.o.tabstop = 4 -- Display width of a +vim.o.softtabstop = 4 -- How large inserted tabs are +vim.o.expandtab = false -- Insert instead of spaces +vim.o.shiftwidth = 4 -- "Number of spaces used for each step of an (auto)indent" +vim.o.scrolloff = 8 -- Start scrolling when 8 away from top/bottom + +-- search +vim.o.hlsearch = false +vim.o.incsearch = true -- Incremental highlighting while typing a search query +vim.o.ignorecase = true +vim.o.smartcase = true -- Match case if a capital letter is used + +-- temporary file configuration +vim.o.swapfile = false +vim.o.undofile = true +vim.o.dir = '/tmp' + +-- Buffers +vim.o.hidden = true -- Allow hidden buffers without saving diff --git a/lua/keybindings.lua b/lua/keybindings.lua deleted file mode 100644 index 035a3f2..0000000 --- a/lua/keybindings.lua +++ /dev/null @@ -1,98 +0,0 @@ -local map = vim.keymap.set - --- Avoid infinitely recursive definitions -options = { noremap = true } - --- Navigation -map('n', 'gh', '0', options) -- make gh go to beginning of line -map('n', 'gl', '$', options) -- make gl go to end of line - --- WINDOW MANAGEMENT - --- FILE NAVIGATION -map('n', 'f', 'Telescope git_files', options) -map('n', 'af', 'Telescope find_files', options) --- Grep project file contents with live results, respecting .gitignore -map('n', 'g', "lua require('telescope.builtin').live_grep()", options) --- Telescope fuzzy search for buffers -map('n', 'b', "lua require('telescope.builtin').buffers()", options) - -map('n', 'ga', '', options) -- ga to switch to last used buffer - --- CODE NAVIGATOIN - --- Quick Fix Lists --- global -- using control -map('n', '', 'cnextzz', options) -- Go to next item in global qfixlist -map('n', '', 'cprevzz', options) -- Go to previous item in global qfixlist --- Toggle the window if there are items in the qfixlist; allow recursive -map('n', 'Q', 'call ToggleQFList(1)', {}) -- see plugin/navigation.vim for ToggleQFList definition --- local -- using leader -map('n', 'j', 'lnextzz', options) -- Go to next item in local qfixlist -map('n', 'k', 'lprevzz', options) -- Go to previous item in global qfixlist --- Toggle the window if there are items in the qfixlist; allow recursive -map('n', 'q', 'call ToggleQFList(0)', {}) -- see plugin/navigation.vim for ToggleQFList definition - --- GIT --- top level commands -map('n', 'gs', 'keepalt Git', options) -- Show git status -map('n', 'gc', 'G commit -v', options) -- git commit -map('n', 'gp', 'G push', {}) -- git push -map('n', 'gd', 'G diff', options) -map('n', 'gds', 'G diff --staged', options) - --- staging -map('n', 'dp', 'diffput', options) - --- merge -map('n', 'gh', 'diffget //2', options) -- merge from left pane -map('n', 'gl', 'diffget //3', options) -- merge from right pane - -vim.keymap.set( - "i", - "(vimrc:copilot-dummy-map)", - 'copilot#Accept("")', - { silent = true, expr = true, desc = "Copilot dummy accept" } -) - --- remap copilot key to -vim.g.copilot_no_tab_map = true -vim.g.copilot_assume_mapped = true - -local map = vim.keymap.set -map("i", "", "copilot#Accept('')", {noremap = true, silent = true, expr=true, replace_keycodes = false }) - --- LSP --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts) - vim.keymap.set('n', 'k', function() vim.lsp.buf.hover() end, opts) - vim.keymap.set('n', 'r', function() vim.lsp.buf.rename() end, opts) - vim.keymap.set('n', 'a', function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set('n', 'gr', function() vim.lsp.buf.references() end, opts) - vim.keymap.set('n', 'd', function() vim.diagnostic.open_float() end, opts) - vim.keymap.set('n', '[d', function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set('n', ']d', function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set('n', 'Q', function() vim.diagnostic.set_qflist() end, opts) - vim.keymap.set('n', 'F', function() vim.lsp.buf.format() end, opts) -end - -local cmp = require('cmp') -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = { - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [''] = cmp.mapping.abort(), - } - -return { on_attach = on_attach, cmp_mappings = cmp_mappings } diff --git a/lua/lsp.lua b/lua/lsp.lua deleted file mode 100644 index dc736bc..0000000 --- a/lua/lsp.lua +++ /dev/null @@ -1,119 +0,0 @@ -local lsp = require('lsp-zero') - --- name = 'minimal', --- set_lsp_keymaps = false, --- manage_nvim_cmp = true, --- suggest_lsp_servers = false, ---}) - -local keybindings = require('keybindings') -local on_attach = keybindings.on_attach -local cmp_mapping = keybindings.cmp_mappings - -lsp.extend_lspconfig({ - lsp_attach = on_attach, - capabilities = require('cmp_nvim_lsp').default_capabilities(), -}) - -local cmp = require('cmp') -local cmp_config = { - preselect = 'none', - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert(cmp_mappings), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, - experimental = { - ghost_text = false -- conflicts with copilot.vim's preview - }, -} -cmp.setup(cmp_config) - -lsp.configure('rust_analyzer', { - settings = { - ["rust-analyzer"] = { - procMacro = { - enable = true, - ignored = { - leptos_macro = { "server" }, - }, - }, - cargo = { - allFeatures = true, - }, - } - } -}) - -lsp.configure('ts_ls', { - -- set commands to run the language server using npx - cmd = { "npx", "typescript-language-server", "--stdio" }, -}) - -lsp.configure('html', { - cmd = { "npx", "vscode-html-language-server", "--stdio" }, -}) - -lsp.configure('texlab', { - forwardSearch = { - executable = 'zathura', - args = { '--synctex-forward', '%l:1:%f', '%p' } - }, -}) - -lsp.configure('clangd', {}) - -lsp.configure('pylsp', {}) - --- From https://docs.astral.sh/ruff/editors/setup/#neovim -lsp.configure('ruff', { - init_options = { - settings = { - -- Ruff language server settings go here - } - } -}) - --- CSS -lsp.configure('cssls', { - cmd = { "npx", "vscode-css-language-server", "--stdio" }, - filetypes = { "css", "scss", "less" } -}) - --- Tailwind CSS -lsp.configure('tailwindcss', { - cmd = { "npx", "tailwindcss-language-server", "--stdio" }, - filetypes = { "html", "css", "scss", "javascript", "javascriptreact", "typescript", "typescriptreact" }, - init_options = { - userLanguages = { - eelixir = "html-eex", - eruby = "erb" - } - } -}) - -vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }), - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - if client == nil then - return - end - if client.name == 'ruff' then - -- Disable hover in favor of Pyright - client.server_capabilities.hoverProvider = false - end - end, - desc = 'LSP: Disable hover capability from Ruff', -}) - --- gopls -lsp.configure('gopls', {}) - -lsp.setup_servers({'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp', 'gopls', 'ts_ls', 'ruff'}) - -lsp.setup() diff --git a/lua/nvim-cmp-cfg.lua b/lua/nvim-cmp-cfg.lua deleted file mode 100644 index d2eadec..0000000 --- a/lua/nvim-cmp-cfg.lua +++ /dev/null @@ -1,47 +0,0 @@ --- luasnip setup -local luasnip = require 'luasnip' - --- nvim-cmp setup -local cmp = require 'cmp' -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - --{ name = 'luasnip' }, - }, -} diff --git a/lua/nvim_opts.lua b/lua/nvim_opts.lua deleted file mode 100644 index df1deac..0000000 --- a/lua/nvim_opts.lua +++ /dev/null @@ -1,47 +0,0 @@ -local o = vim.o -- globalopts -local g = vim.g -- global 2? -local wo = vim.wo -- window local -local bo = vim.bo -- buffer local - -g.mapleader = ' ' - --- basic UI -o.background = 'dark' -o.termguicolors = true -- enable 24 bit colors in TUI -vim.cmd 'colorscheme gruvbox' -g.syntax = true -wo.number = true -wo.relativenumber = true -o.signcolumn = 'yes' -o.splitright = true -o.splitbelow = true -o.colorcolumn = '80' - --- text -wo.wrap = false -wo.foldenable = false -o.mouse = 'a' -- enable mouse in all modes -o.tabstop = 4 -- Display width of a -o.softtabstop = 4 -- How large inserted tabs are -o.expandtab = false -- Insert instead of spaces -o.shiftwidth = 4 -- "Number of spaces used for each step of an (auto)indent" -o.scrolloff = 8 -- Start scrolling when 8 away from top/bottom - --- Set diagnostic updatetime -vim.o.updatetime = 300 - --- search -o.hlsearch = false -o.incsearch = true -- Incremental highlighting while typing a search query -o.ignorecase = true -o.smartcase = true -- Match case if a capital letter is used - --- temporary file configuration -o.swapfile = false -o.undofile = true -o.dir = '/tmp' - --- Buffers -o.hidden = true -- Allow hidden buffers without saving - -vim.opt.completeopt = {'menu','menuone','noselect'} diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100644 index e509e5c..0000000 --- a/lua/plugins.lua +++ /dev/null @@ -1,57 +0,0 @@ -local fn = vim.fn -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) -end - -local plugins = require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - use 'gruvbox-community/gruvbox' - - -- file management - use { - 'nvim-telescope/telescope.nvim', -- search and select tool - requires = { {'nvim-lua/plenary.nvim'} } - } - - -- git - use 'tpope/vim-fugitive' - use 'https://github.com/airblade/vim-gitgutter' - - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } - - use { - 'https://github.com/github/copilot.vim', - } - - -- lsp - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v4.x', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-buffer'}, -- Optional - - -- Snippets - {'L3MON4D3/LuaSnip'}, - }, - } - - if packer_bootstrap then - require('packer').sync() - end -end) - --- Required for rust.vim --- TODO: Convert to lua -vim.cmd([[filetype plugin indent on]]) - -return plugins diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..3126a68 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,4 @@ +return { + 'tpope/vim-fugitive', + 'airblade/vim-gitgutter', +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..507c58a --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,111 @@ +return { + -- Autocompletion + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + config = function() + local cmp = require('cmp') + + cmp.setup({ + sources = { + {name = 'nvim_lsp'}, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [''] = cmp.mapping.abort(), + }), + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + }) + end + }, + + -- LSP + { + 'neovim/nvim-lspconfig', + cmd = 'LspInfo', + event = {'BufReadPre', 'BufNewFile'}, + dependencies = { + {'hrsh7th/cmp-nvim-lsp'}, + }, + init = function() + -- Reserve a space in the gutter + -- This will avoid an annoying layout shift in the screen + vim.opt.signcolumn = 'yes' + end, + config = function() + local lsp_defaults = require('lspconfig').util.default_config + + -- Add cmp_nvim_lsp capabilities settings to lspconfig + -- This should be executed before you configure any language server + lsp_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() + ) + + -- LspAttach is where you enable features that only work + -- if there is a language server active in the file + vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = { buffer = event.buffer, remap = false } + + vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts) + vim.keymap.set('n', 'k', function() vim.lsp.buf.hover() end, opts) + vim.keymap.set('n', 'r', function() vim.lsp.buf.rename() end, opts) + vim.keymap.set('n', 'a', function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set('n', 'gr', function() vim.lsp.buf.references() end, opts) + vim.keymap.set('n', 'd', function() vim.diagnostic.open_float() end, opts) + vim.keymap.set('n', '[d', function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set('n', ']d', function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set('n', 'Q', function() vim.diagnostic.set_qflist() end, opts) + vim.keymap.set('n', 'F', function() vim.lsp.buf.format() end, opts) + end, + }) + + local lsp = require('lspconfig') + + -- require('lspconfig').gleam.setup({}) + -- require('lspconfig').ocamllsp.setup({}) + + lsp.rust_analyzer.setup({ + settings = { + ["rust-analyzer"] = { + procMacro = { + enable = true, + ignored = { + leptos_macro = { "server" }, + }, + }, + cargo = { + allFeatures = true, + }, + } + } + }) + + -- Workaround for rust_analzyer issue + for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do + local default_diagnostic_handler = vim.lsp.handlers[method] + vim.lsp.handlers[method] = function(err, result, context, config) + if err ~= nil and err.code == -32802 then + return + end + return default_diagnostic_handler(err, result, context, config) + end + end + end, + } +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..005fb35 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,7 @@ +return { + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + }, +} diff --git a/lua/plugins/tokyonight.lua b/lua/plugins/tokyonight.lua new file mode 100644 index 0000000..745aa35 --- /dev/null +++ b/lua/plugins/tokyonight.lua @@ -0,0 +1,9 @@ + -- the colorscheme should be available when starting Neovim +return { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + vim.cmd([[colorscheme tokyonight]]) + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..6d0fdad --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,10 @@ +return { + 'nvim-treesitter/nvim-treesitter', + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +} diff --git a/lua/ts-context.lua b/lua/ts-context.lua deleted file mode 100644 index 9dbae6d..0000000 --- a/lua/ts-context.lua +++ /dev/null @@ -1,22 +0,0 @@ -require('treesitter-context').setup{ - enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) - throttle = true, -- Throttles plugin updates (may improve performance) - max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. - patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. - -- For all filetypes - default = { - 'class', - 'function', - 'method', - 'for', - 'while', - -- 'if', - -- 'switch', - -- 'case', - }, - rust = { - 'loop_expression', - 'impl_item', - }, - }, -} diff --git a/lua/ts_config.lua b/lua/ts_config.lua deleted file mode 100644 index ca40756..0000000 --- a/lua/ts_config.lua +++ /dev/null @@ -1,16 +0,0 @@ -require('nvim-treesitter.configs').setup { - highlight = { - enable = true, - } -} - -require('nvim-treesitter.parsers').get_parser_configs().hare = { - install_info = { - url = "https://git.sr.ht/~ecmma/tree-sitter-hare", -- local path or git repo - files = {"src/parser.c"}, - -- optional entries: - generate_requires_npm = false, -- if stand-alone parser without npm dependencies - requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c - }, - filetype = "ha", -- if filetype does not match the parser name -} diff --git a/plugin/quickfixlist.vim b/plugin/quickfixlist.vim deleted file mode 100644 index f632a37..0000000 --- a/plugin/quickfixlist.vim +++ /dev/null @@ -1,22 +0,0 @@ -let g:qf_l = 0 -let g:qf_g = 0 - -fun! ToggleQFList(global) - if a:global - if g:qf_g == 1 - let g:qf_g = 0 - cclose - else - let g:qf_g = 1 - copen - end - else - if g:qf_l == 1 - let g:qf_l = 0 - lclose - else - let g:qf_l = 1 - lopen - end - endif -endfun