mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
5 Commits
v0.10.2
...
47a651be55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47a651be55 | ||
|
|
074a53a664 | ||
|
|
efcda5cf6f | ||
|
|
c7fb090e4c | ||
|
|
a02f317a1d |
10
README.md
10
README.md
@@ -9,20 +9,20 @@
|
||||
<a>
|
||||
<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"/>
|
||||
</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" />
|
||||
</a>
|
||||
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
||||
<img src="https://img.shields.io/badge/Neovim-0.10.2-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
|
||||
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
|
||||
</a>
|
||||
<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.1">
|
||||
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.10.1?style=flat-square" />
|
||||
<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" />
|
||||
|
||||
2
init.lua
2
init.lua
@@ -13,7 +13,7 @@ vim.loader.enable()
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
local expected_version = "0.10.2"
|
||||
local expected_version = "0.10.3"
|
||||
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 .
|
||||
|
||||
Reference in New Issue
Block a user