dotfiles/config/nvim/nvim.lua
2024-12-25 04:18:09 +00:00

169 lines
3.9 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 = {
formatCommand = {"black"},
pylsp = {
plugins = {
jedai_completion = {
fuzzy = true
},
pyflakes = {
enabled = true
},
pylsp_mypy = {
enabled = true
}
}
}
}
}
require'nvim-treesitter.configs'.setup {
ensure_installed = { },
auto_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
-- 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', 'glsl_analyzer', 'nixd', 'tinymist', 'rust_analyzer', 'vhdl_ls', 'vtsls' }
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
]]
-- Funky plugins
require("conform").setup({
formatters_by_ft = {
css = { "prettier", },
html = { "prettier", },
javascript = { "prettier", },
python = { "black" },
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
})
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("gitsigns").setup()
require("ibl").setup()
require("mini.pairs").setup()
require("mini.comment").setup()
require("mini.icons").setup()
require("neo-tree").setup()
require("nvim-web-devicons").setup()
require("render-markdown").setup()
require("telescope").setup()
require("toggleterm").setup{
direction = 'float',
float_opts = {
border = 'curved',
},
}
require("which-key").setup({ global = false })
require("spaceman").setup({
workspaces = {
"/etc/nixos",
{ "config", "/etc/nixos/config/" },
{ "home", "~/" },
"/opt/www/stitchy.moe" ,
},
directories = {
"~/Documents/Classes",
"~/Documents/Repos",
"~/Documents/Repos/ExtremeHeatTransfer",
"/opt/docker-containers/",
},
use_default_keymaps = true,
hooks = {
before_move = "Neotree close",
}
})