147 lines
3.4 KiB
Lua
147 lines
3.4 KiB
Lua
-- This will need some refactoring as it is mostly a
|
|
-- copy and paste from the previous single-file .vim config
|
|
|
|
require'lspconfig'.rust_analyzer.setup{}
|
|
require'lspconfig'.texlab.setup{}
|
|
require'lspconfig'.svls.setup{}
|
|
require'lspconfig'.pylsp.setup{
|
|
settings = {
|
|
pylsp = {
|
|
plugins = {
|
|
pycodestyle = {
|
|
ignore = {'W391'},
|
|
maxLineLength = 100
|
|
},
|
|
pylint = {
|
|
enabled = false
|
|
},
|
|
pyflakes = {
|
|
enabled = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
require'lspconfig'.ccls.setup{
|
|
init_options = {
|
|
highlight = {
|
|
lsRanges = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-- Add additional capabilities supported by nvim-cmp
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
|
local lspconfig = require('lspconfig')
|
|
|
|
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
|
|
local servers = { 'clangd', 'rust_analyzer', 'ts_ls', 'typst_lsp', 'vhdl_ls' }
|
|
for _, lsp in ipairs(servers) do
|
|
lspconfig[lsp].setup {
|
|
-- on_attach = my_custom_on_attach,
|
|
capabilities = capabilities,
|
|
}
|
|
end
|
|
|
|
-- 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,
|
|
},
|
|
mapping = cmp.mapping.preset.insert({
|
|
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
|
|
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
|
|
-- C-b (back) C-f (forward) for snippet placeholder navigation.
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = true,
|
|
},
|
|
['<Tab>'] = 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' }),
|
|
['<S-Tab>'] = 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' },
|
|
},
|
|
}
|
|
|
|
--[[
|
|
u.-*'M'*-.u
|
|
x` _____ `x
|
|
o` _| ___| `o
|
|
, | |___ ,
|
|
3 |_ | E
|
|
' | _ | '
|
|
o, |_| |_| ,o
|
|
x". ."x
|
|
n"--.W.--"n
|
|
Kiloroy Was Here
|
|
]]
|
|
package.path = package.path .. ";/etc/nixos/config/nvim"
|
|
|
|
-- Funky plugins
|
|
require("bufferline").setup({ options = {
|
|
always_show_bufferline = true,
|
|
show_buffer_close_icons = false,
|
|
separator_style = "slope",
|
|
style_preset = {
|
|
require("bufferline").style_preset.no_italic,
|
|
},
|
|
offsets = {
|
|
{
|
|
filetype = "neo-tree",
|
|
text = "File Explorer",
|
|
highlight = "Directory",
|
|
text_align = "left",
|
|
},
|
|
},
|
|
},})
|
|
require("ibl").setup()
|
|
require("gitsigns").setup()
|
|
require("which-key").setup({ global = false })
|
|
require("telescope").setup()
|
|
require("neo-tree").setup()
|
|
require("spaceman").setup({
|
|
workspaces = {
|
|
"/etc/nixos",
|
|
{ "config", "/etc/nixos/config/" },
|
|
{ "home", "~/" },
|
|
},
|
|
directories = {
|
|
"~/Documents/Classes",
|
|
"~/Documents/Repos",
|
|
},
|
|
use_default_keymaps = true,
|
|
hooks = {
|
|
before_move = "Neotree close",
|
|
}
|
|
})
|
|
|
|
vim.keymap.set("n", "<leader>e", function()
|
|
require("neo-tree.command").execute({ action = "show", position = "right", toggle = true, dir = vim.loop.cwd() })
|
|
end, { desc = "Open Neotree", remap = true })
|