mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
5 Commits
076cce2131
...
04527faf75
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04527faf75 | ||
|
|
94497c0a73 | ||
|
|
70e9943aac | ||
|
|
074a53a664 | ||
|
|
efcda5cf6f |
@ -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>
|
||||
|
||||
2
init.lua
2
init.lua
@ -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")
|
||||
|
||||
@ -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" })
|
||||
|
||||
@ -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 .
|
||||
|
||||
@ -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" },
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user