update neovim config to use lazy, fix some issues with screens in general
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "*",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
config = function()
|
||||
local bufferline = require('bufferline')
|
||||
|
||||
bufferline.setup({
|
||||
options = {
|
||||
style_preset = bufferline.style_preset.no_italic,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "Files",
|
||||
highlight = "Directory",
|
||||
separator = true
|
||||
},
|
||||
},
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 0,
|
||||
reveal = { 'close' }
|
||||
},
|
||||
show_close_icon = false,
|
||||
separator_style = "slope",
|
||||
diagnostics = "nvim_lsp",
|
||||
}
|
||||
})
|
||||
end
|
||||
,
|
||||
keys = {
|
||||
{ "<leader>b", "<cmd>BufferLineCyclePrev<cr>", desc = "Go to previous tab" },
|
||||
{ "<leader>n", "<cmd>BufferLineCycleNext<cr>", desc = "Go to next tab" },
|
||||
{ "<leader>gb", "<cmd>BufferLinePick<cr>", desc = "Pick tab" },
|
||||
{ "<leader>w", "<cmd>bdelete!<cr>", desc = "Close tab" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"EdenEast/nightfox.nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("nightfox").setup({
|
||||
palettes = {
|
||||
carbonfox = {
|
||||
bg1 = "#0C0C0C",
|
||||
}
|
||||
}
|
||||
})
|
||||
vim.cmd.colorscheme("carbonfox")
|
||||
end
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
local augroup = vim.api.nvim_create_augroup("Lspformatting", {})
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
if (not bufnr) then
|
||||
return
|
||||
end
|
||||
|
||||
require 'illuminate'.on_attach(client)
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', '<cmd>lua vim.lsp.buf.format({ async = true })<CR>', bufopts)
|
||||
|
||||
-- format on save does not work for python for some reason
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({
|
||||
async = false,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local on_leave_group = vim.api.nvim_create_augroup("OnLeaveGroup", {})
|
||||
vim.api.nvim_create_autocmd("VimLeave", {
|
||||
group = on_leave_group,
|
||||
command = "silent !killall -q eslint_d",
|
||||
})
|
||||
|
||||
|
||||
return { {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
'RRethy/vim-illuminate',
|
||||
'j-hui/fidget.nvim',
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lspconfig")
|
||||
local lspconfig_defaults = lsp.util.default_config
|
||||
lspconfig_defaults.capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
lspconfig_defaults.capabilities,
|
||||
require('cmp_nvim_lsp').default_capabilities()
|
||||
)
|
||||
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
lsp.lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
lsp.clangd.setup { on_attach = on_attach }
|
||||
lsp.ts_ls.setup { on_attach = on_attach } -- typescript
|
||||
lsp.hls.setup { on_attach = on_attach } -- haskell
|
||||
lsp.pyright.setup { on_attach = on_attach,
|
||||
settings = {
|
||||
pyright = {
|
||||
disableOrganizeImports = true, -- Using Ruff
|
||||
},
|
||||
python = {
|
||||
analysis = {
|
||||
ignore = { '*' }, -- Using Ruff
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
lsp.ruff.setup { on_attach = on_attach }
|
||||
lsp.svelte.setup { on_attach = on_attach }
|
||||
lsp.marksman.setup { on_attach = on_attach }
|
||||
lsp.rust_analyzer.setup { on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = true,
|
||||
check = {
|
||||
enable = true,
|
||||
command = "clippy",
|
||||
features = "all"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lsp.tailwindcss.setup { on_attach = on_attach }
|
||||
|
||||
lsp.julials.setup {
|
||||
on_new_config = function(new_config, _)
|
||||
local julia = vim.fn.expand("~/.julia/environments/nvim-lspconfig/bin/julia")
|
||||
if lsp.util.path.is_file(julia) then
|
||||
vim.notify("running julials")
|
||||
new_config.cmd[1] = julia
|
||||
end
|
||||
end,
|
||||
on_attach = on_attach
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvimtools/none-ls.nvim',
|
||||
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
--capabilities.offsetEncoding = { "utf-16" }
|
||||
|
||||
local eslint_format = require("none-ls.formatting.eslint_d").with({
|
||||
extra_filetypes = { "svelte" },
|
||||
})
|
||||
|
||||
local eslint_diag = require("none-ls.diagnostics.eslint_d").with({
|
||||
extra_filetypes = { "svelte" },
|
||||
})
|
||||
|
||||
local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({
|
||||
extra_filetypes = { "svelte" },
|
||||
})
|
||||
|
||||
null_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
sources = {
|
||||
eslint_format,
|
||||
eslint_diag,
|
||||
eslint_code_actions,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.completion.tags,
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = { "nvim-lua/plenary.nvim",
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = {
|
||||
extensions = { 'nvim-tree', 'fzf', 'symbols-outline' },
|
||||
options = {
|
||||
component_separators = '',
|
||||
section_separators = { left = '', right = '' },
|
||||
theme = 'auto',
|
||||
globalstatus = true,
|
||||
},
|
||||
sections = {
|
||||
-- would be nice to open code actions but w/e
|
||||
lualine_b = {
|
||||
{
|
||||
'branch',
|
||||
'diff',
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic', 'nvim_lsp' },
|
||||
sections = { 'hint', 'warn', 'error' },
|
||||
colored = true,
|
||||
update_in_insert = true,
|
||||
always_visible = false,
|
||||
}
|
||||
},
|
||||
lualine_x = { 'filetype' },
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"danymat/neogen",
|
||||
config = function()
|
||||
require("neogen").setup({
|
||||
enabled = true,
|
||||
snippet_engine = "luasnip",
|
||||
placeholders_hl = "None", -- fixes weird bug where the entire page gets colored with this color
|
||||
languages = {
|
||||
python = {
|
||||
template = {
|
||||
annotation_convention = "google_docstrings"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
nmap('<leader>d', ":lua require('neogen').generate()<CR>")
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = "make install_jsregexp"
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets",
|
||||
'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-calc', 'hrsh7th/cmp-cmdline', 'f3fora/cmp-spell',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp', keyword_length = 1 },
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
{ name = 'luasnip', keyword_length = 2 },
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
luasnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<Up>'] = cmp.mapping.select_prev_item(select_opts),
|
||||
['<Down>'] = cmp.mapping.select_next_item(select_opts),
|
||||
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
|
||||
['<C-f>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<C-b>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}
|
||||
})
|
||||
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- to select something in the cmdline need to use <C-n>
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
end,
|
||||
} }
|
||||
Reference in New Issue
Block a user