1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Li Peng
04527faf75
Merge 074a53a66451d3445031633599c9aaa7a5c80f95 into 94497c0a73e283d86895ca9ec528d3d86a787b63 2025-02-13 11:53:54 +08:00
jdhao
94497c0a73 snack config update 2025-02-13 00:41:35 +01:00
jdhao
70e9943aac update supported nvim version to latest stable
Update a few plugins
2025-02-12 23:32:21 +01:00
Li Peng
074a53a664 Only format C, CPP and Rust code 2025-01-04 09:01:31 +08:00
Li Peng
efcda5cf6f Setup LSP for Rust
Signed-off-by: Li Peng <lipeng@unisound.ai>
2025-01-03 14:46:53 +08:00
6 changed files with 52 additions and 15 deletions

View File

@ -10,7 +10,7 @@
<img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" />
</a>
<a href="https://github.com/neovim/neovim/releases/tag/stable">
<img src="https://img.shields.io/badge/Neovim-0.10.3-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
<img src="https://img.shields.io/badge/Neovim-0.10.4-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
</a>
<a href="https://github.com/jdhao/nvim-config/releases/latest">
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
@ -21,9 +21,6 @@
<a href="https://github.com/jdhao/nvim-config/graphs/commit-activity">
<img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" />
</a>
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.10.2">
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.10.2?style=flat-square" />
</a>
<a href="https://github.com/jdhao/nvim-config/graphs/contributors">
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />
</a>

View File

@ -13,7 +13,7 @@ vim.loader.enable()
local utils = require("utils")
local expected_version = "0.10.3"
local expected_version = "0.10.4"
utils.is_compatible_version(expected_version)
local config_dir = vim.fn.stdpath("config")

View File

@ -278,6 +278,32 @@ if utils.executable("lua-language-server") then
}
end
-- settings for rust-analyzer is copied from https://rust-analyzer.github.io/manual.html#nvim-lsp
if utils.executable("rust-analyzer") then
lspconfig.rust_analyzer.setup {
on_attach = custom_attach,
settings = {
['rust-analyzer'] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true
},
},
},
capabilities = capabilities,
}
end
-- Change diagnostic signs.
fn.sign_define("DiagnosticSignError", { text = "🆇", texthl = "DiagnosticSignError" })
fn.sign_define("DiagnosticSignWarn", { text = "⚠️", texthl = "DiagnosticSignWarn" })

View File

@ -54,6 +54,13 @@ api.nvim_create_autocmd({ "BufWritePre" }, {
end,
})
api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = {"*.c", "*.cc", "*.cpp", "*.h", "*.rs", "*.py"},
callback = function()
vim.lsp.buf.format { asnyc = false }
end,
})
-- Automatically reload the file if it is changed outside of Nvim, see https://unix.stackexchange.com/a/383044/221410.
-- It seems that `checktime` does not work in command line. We need to check if we are in command
-- line before executing this command, see also https://vi.stackexchange.com/a/20397/15292 .

View File

@ -278,15 +278,9 @@ local plugin_specs = {
-- Multiple cursor plugin like Sublime Text?
-- 'mg979/vim-visual-multi'
-- Autosave files on certain events
{ "907th/vim-auto-save", event = "InsertEnter" },
-- Show undo history visually
{ "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } },
-- better UI for some nvim actions
{ "stevearc/dressing.nvim" },
-- Manage your yank history
{
"gbprod/yanky.nvim",
@ -513,7 +507,23 @@ local plugin_specs = {
require("config.which-key")
end,
},
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
opts = {
-- more beautiful vim.ui.input
input = {
enabled = true,
win = {
relative = "cursor",
backdrop = true,
},
},
-- more beautiful vim.ui.select
picker = { enabled = true },
},
},
-- show and trim trailing whitespaces
{ "jdhao/whitespace.nvim", event = "VeryLazy" },

View File

@ -384,6 +384,3 @@ function! s:wilder_init() abort
echohl Error |echomsg "Wilder.nvim missing"| echohl None
endtry
endfunction
""""""""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""""""""""
let g:auto_save = 1 " enable AutoSave on Vim startup