Redo everything because of an LSP bug and it still didn't fix it :(
parent
3db2dd6fb7
commit
966f4fdc0b
@ -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
|
||||
```
|
@ -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")
|
||||
|
@ -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" }
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
-- Highlight on yank
|
||||
vim.cmd('au TextYankPost * lua vim.highlight.on_yank {on_visual = false}' )-- disabled in visual mode
|
@ -0,0 +1,41 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
options = { noremap = true }
|
||||
|
||||
-- FILE NAVIGATION
|
||||
local builtin = require('telescope.builtin')
|
||||
map('n', '<leader>f', builtin.find_files, options)
|
||||
map('n', '<leader>af', builtin.git_files, options)
|
||||
-- Grep project file contents with live results, respecting .gitignore
|
||||
map('n', '<leader>g', builtin.live_grep, options)
|
||||
-- Telescope fuzzy search for buffers
|
||||
map('n', '<leader>b', builtin.buffers, options)
|
||||
|
||||
map('n', 'ga', '<C-^><CR>', options) -- ga to switch to last used buffer
|
||||
|
||||
-- Quick Fix Lists
|
||||
-- global -- using control
|
||||
map('n', '<C-n>', '<cmd>cnext<CR>zz', options) -- Go to next item in global qfixlist
|
||||
map('n', '<C-p>', '<cmd>cprev<CR>zz', options) -- Go to previous item in global qfixlist
|
||||
-- Toggle the window if there are items in the qfixlist; allow recursive
|
||||
map('n', 'Q', '<cmd>call ToggleQFList(1)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
|
||||
-- local -- using leader
|
||||
map('n', '<leader>j', '<cmd>lnext<CR>zz', options) -- Go to next item in local qfixlist
|
||||
map('n', '<leader>k', '<cmd>lprev<CR>zz', options) -- Go to previous item in global qfixlist
|
||||
-- Toggle the window if there are items in the qfixlist; allow recursive
|
||||
map('n', '<leader>q', '<cmd>call ToggleQFList(0)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
|
||||
|
||||
-- GIT
|
||||
-- top level commands
|
||||
map('n', '<leader>gs', '<cmd>keepalt Git<CR>', options) -- Show git status
|
||||
map('n', '<leader>gc', '<cmd>G commit -v<CR>', options) -- git commit
|
||||
map('n', '<leader>gp', '<cmd>G push<CR>', {}) -- git push
|
||||
map('n', '<leader>gd', '<cmd>G diff<CR>', options)
|
||||
map('n', '<leader>gds', '<cmd>G diff --staged<CR>', options)
|
||||
|
||||
-- staging
|
||||
map('n', '<leader>dp', '<cmd>diffput<CR>', options)
|
||||
|
||||
-- merge
|
||||
map('n', '<leader>gh', '<cmd>diffget //2<CR>', options) -- merge from left pane
|
||||
map('n', '<leader>gl', '<cmd>diffget //3<CR>', options) -- merge from right pane
|
@ -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
|
||||
["<localleader>l"] = false,
|
||||
["<localleader>i"] = false,
|
||||
["<localleader>t"] = false,
|
||||
},
|
||||
})
|
@ -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 <Tab>
|
||||
vim.o.softtabstop = 4 -- How large inserted tabs are
|
||||
vim.o.expandtab = false -- Insert <Tab> 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
|
@ -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', '<leader>f', '<cmd>Telescope git_files<CR>', options)
|
||||
map('n', '<leader>af', '<cmd>Telescope find_files<CR>', options)
|
||||
-- Grep project file contents with live results, respecting .gitignore
|
||||
map('n', '<leader>g', "<cmd>lua require('telescope.builtin').live_grep()<CR>", options)
|
||||
-- Telescope fuzzy search for buffers
|
||||
map('n', '<leader>b', "<cmd>lua require('telescope.builtin').buffers()<CR>", options)
|
||||
|
||||
map('n', 'ga', '<C-^><CR>', options) -- ga to switch to last used buffer
|
||||
|
||||
-- CODE NAVIGATOIN
|
||||
|
||||
-- Quick Fix Lists
|
||||
-- global -- using control
|
||||
map('n', '<C-n>', '<cmd>cnext<CR>zz', options) -- Go to next item in global qfixlist
|
||||
map('n', '<C-p>', '<cmd>cprev<CR>zz', options) -- Go to previous item in global qfixlist
|
||||
-- Toggle the window if there are items in the qfixlist; allow recursive
|
||||
map('n', 'Q', '<cmd>call ToggleQFList(1)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
|
||||
-- local -- using leader
|
||||
map('n', '<leader>j', '<cmd>lnext<CR>zz', options) -- Go to next item in local qfixlist
|
||||
map('n', '<leader>k', '<cmd>lprev<CR>zz', options) -- Go to previous item in global qfixlist
|
||||
-- Toggle the window if there are items in the qfixlist; allow recursive
|
||||
map('n', '<leader>q', '<cmd>call ToggleQFList(0)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
|
||||
|
||||
-- GIT
|
||||
-- top level commands
|
||||
map('n', '<leader>gs', '<cmd>keepalt Git<CR>', options) -- Show git status
|
||||
map('n', '<leader>gc', '<cmd>G commit -v<CR>', options) -- git commit
|
||||
map('n', '<leader>gp', '<cmd>G push<CR>', {}) -- git push
|
||||
map('n', '<leader>gd', '<cmd>G diff<CR>', options)
|
||||
map('n', '<leader>gds', '<cmd>G diff --staged<CR>', options)
|
||||
|
||||
-- staging
|
||||
map('n', '<leader>dp', '<cmd>diffput<CR>', options)
|
||||
|
||||
-- merge
|
||||
map('n', '<leader>gh', '<cmd>diffget //2<CR>', options) -- merge from left pane
|
||||
map('n', '<leader>gl', '<cmd>diffget //3<CR>', options) -- merge from right pane
|
||||
|
||||
vim.keymap.set(
|
||||
"i",
|
||||
"<Plug>(vimrc:copilot-dummy-map)",
|
||||
'copilot#Accept("")',
|
||||
{ silent = true, expr = true, desc = "Copilot dummy accept" }
|
||||
)
|
||||
|
||||
-- remap copilot key to <C-j>
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.g.copilot_assume_mapped = true
|
||||
|
||||
local map = vim.keymap.set
|
||||
map("i", "<C-j>", "copilot#Accept('<CR>')", {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', '<leader>k', function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set('n', '<leader>r', function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set('n', '<leader>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', '<leader>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', '<leader>Q', function() vim.diagnostic.set_qflist() end, opts)
|
||||
vim.keymap.set('n', '<leader>F', function() vim.lsp.buf.format() end, opts)
|
||||
end
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||||
local cmp_mappings = {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
}
|
||||
|
||||
return { on_attach = on_attach, cmp_mappings = cmp_mappings }
|
@ -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()
|
@ -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({
|
||||
['<C-j>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-k>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<C-n>'] = 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' }),
|
||||
['<C-p>'] = 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' },
|
||||
},
|
||||
}
|
@ -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 <Tab>
|
||||
o.softtabstop = 4 -- How large inserted tabs are
|
||||
o.expandtab = false -- Insert <Tab> 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'}
|
@ -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
|
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
'airblade/vim-gitgutter',
|
||||
}
|
@ -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({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
['<C-e>'] = 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', '<leader>k', function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set('n', '<leader>r', function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set('n', '<leader>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', '<leader>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', '<leader>Q', function() vim.diagnostic.set_qflist() end, opts)
|
||||
vim.keymap.set('n', '<leader>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,
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.8',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
}
|
@ -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,
|
||||
}
|
@ -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,
|
||||
}
|
@ -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',
|
||||
},
|
||||
},
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue