mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-04 17:59:50 -05:00
lsp: added rust and some notification management
This commit is contained in:
parent
a5108f68c1
commit
f7ae8e97b0
6 changed files with 59 additions and 2 deletions
|
|
@ -82,11 +82,14 @@ with final.pkgs.lib; let
|
||||||
# Autoformatting
|
# Autoformatting
|
||||||
conform-nvim
|
conform-nvim
|
||||||
# Theme for neovim
|
# Theme for neovim
|
||||||
tokyonight-nvim
|
everforest
|
||||||
# QOL Plugin for visuals mostly
|
# QOL Plugin for visuals mostly
|
||||||
mini-nvim # https://github.com/echasnovski/mini.nvim/
|
mini-nvim # https://github.com/echasnovski/mini.nvim/
|
||||||
# Debugging
|
# Debugging
|
||||||
nvim-dap
|
nvim-dap
|
||||||
|
# Notifications
|
||||||
|
nvim-notify
|
||||||
|
fidget-nvim
|
||||||
|
|
||||||
# Copilot related plugins
|
# Copilot related plugins
|
||||||
CopilotChat-nvim
|
CopilotChat-nvim
|
||||||
|
|
@ -100,10 +103,12 @@ with final.pkgs.lib; let
|
||||||
clang-tools # provides clangd which is a c/c++ lsp
|
clang-tools # provides clangd which is a c/c++ lsp
|
||||||
jdt-language-server # java ls
|
jdt-language-server # java ls
|
||||||
nixd # nix LSP
|
nixd # nix LSP
|
||||||
|
rust-analyzer # rust LSP
|
||||||
|
|
||||||
# autoformatters
|
# autoformatters
|
||||||
alejandra # amazing nix autoformatter
|
alejandra # amazing nix autoformatter
|
||||||
stylua # lua formatter
|
stylua # lua formatter
|
||||||
|
rustfmt # rust formatter
|
||||||
# google-java-format # java formatter based off google guidelines
|
# google-java-format # java formatter based off google guidelines
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
|
|
|
||||||
40
nvim/ftplugin/rust.lua
Normal file
40
nvim/ftplugin/rust.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
-- Exit if the language server isn't available
|
||||||
|
if vim.fn.executable('rust-analyzer') ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local root_files = {
|
||||||
|
'Cargo.toml',
|
||||||
|
'rust-project.json',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Tab Width
|
||||||
|
vim.bo.tabstop = 2
|
||||||
|
vim.bo.shiftwidth = 2
|
||||||
|
vim.bo.expandtab = true
|
||||||
|
|
||||||
|
vim.lsp.start {
|
||||||
|
name = 'rust-analyzer',
|
||||||
|
cmd = { 'rust-analyzer' },
|
||||||
|
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||||
|
capabilities = require('user.lsp').make_client_capabilities(),
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
diagnostics = { enable = false },
|
||||||
|
imports = {
|
||||||
|
granularity = {
|
||||||
|
group = 'module',
|
||||||
|
},
|
||||||
|
prefix = 'self',
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
buildScripts = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -109,4 +109,5 @@ cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
|
||||||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||||
|
|
||||||
-- Vim Theme
|
-- Vim Theme
|
||||||
vim.cmd.colorscheme('tokyonight-night')
|
vim.g.everforest_background = 'hard'
|
||||||
|
vim.cmd.colorscheme('everforest')
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ require('conform').setup {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
nix = { 'alejandra' },
|
nix = { 'alejandra' },
|
||||||
|
rust = { 'rustfmt' },
|
||||||
-- Conform will run multiple formatters sequentially
|
-- Conform will run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
-- You can customize some of the format options for the filetype (:help conform.format)
|
-- You can customize some of the format options for the filetype (:help conform.format)
|
||||||
|
|
|
||||||
1
nvim/plugin/fidget.lua
Normal file
1
nvim/plugin/fidget.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
require('fidget').setup {}
|
||||||
9
nvim/plugin/notify.lua
Normal file
9
nvim/plugin/notify.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
vim.notify = require('notify')
|
||||||
|
-- vim.notify = require('notify').setup {
|
||||||
|
-- -- Configuration options
|
||||||
|
-- level = vim.log.levels.INFO, -- Set the minimum level of messages to display
|
||||||
|
-- timeout = 3000, -- Duration to display notifications (in ms)
|
||||||
|
-- stages = 'fade', -- Animation style for notifications
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- Set nvim-notify as the default notification handler
|
||||||
Loading…
Add table
Add a link
Reference in a new issue