Skip to content

Commit

Permalink
chore(v0.10): migrate to nvim-0.10 configs (#570)
Browse files Browse the repository at this point in the history
fix(install): deprecate brew install with --cask (#570)
  • Loading branch information
linrongbin16 committed May 17, 2024
1 parent 14b877d commit 47fae89
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
3 changes: 1 addition & 2 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ install_nerdfont() {
if [ "$OS" = "Darwin" ]; then
local font_name=$2
info "install $font_name nerd fonts with brew"
brew tap homebrew/cask-fonts
brew install --cask $font_name
brew install $font_name
else
mkdir -p ~/.local/share/fonts && cd ~/.local/share/fonts
local org="ryanoasis"
Expand Down
37 changes: 19 additions & 18 deletions lua/builtin/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

local constants = require("builtin.constants")

local function setup()
local function setup_diagnostic()
local highlights_def = {
DiagnosticError = { "ErrorMsg", "#ff0000" },
DiagnosticWarn = { "WarningMsg", "#FFFF00" },
Expand All @@ -27,9 +27,10 @@ local function setup()
severity_sort = true,
float = {
border = constants.window.border,
source = "always",
source = true,
header = "",
prefix = "",
suffix = "",
},
signs = {
text = {
Expand All @@ -41,29 +42,29 @@ local function setup()
},
})

local signs_def = {
DiagnosticSignError = constants.diagnostic.signs.error,
DiagnosticSignWarn = constants.diagnostic.signs.warning,
DiagnosticSignInfo = constants.diagnostic.signs.info,
DiagnosticSignHint = constants.diagnostic.signs.hint,
DiagnosticSignOk = constants.diagnostic.signs.ok,
}
for name, text in pairs(signs_def) do
vim.fn.sign_define(name, {
texthl = name,
text = text,
numhl = "",
})
end
-- local signs_def = {
-- DiagnosticSignError = constants.diagnostic.signs.error,
-- DiagnosticSignWarn = constants.diagnostic.signs.warning,
-- DiagnosticSignInfo = constants.diagnostic.signs.info,
-- DiagnosticSignHint = constants.diagnostic.signs.hint,
-- DiagnosticSignOk = constants.diagnostic.signs.ok,
-- }
-- for name, text in pairs(signs_def) do
-- vim.fn.sign_define(name, {
-- texthl = name,
-- text = text,
-- numhl = "",
-- })
-- end
end

local builtin_diagnostic_augroup =
vim.api.nvim_create_augroup("builtin_diagnostic_augroup", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
group = builtin_diagnostic_augroup,
callback = vim.schedule_wrap(setup),
callback = vim.schedule_wrap(setup_diagnostic),
})
vim.api.nvim_create_autocmd("VimEnter", {
group = builtin_diagnostic_augroup,
callback = vim.schedule_wrap(setup),
callback = vim.schedule_wrap(setup_diagnostic),
})
28 changes: 14 additions & 14 deletions lua/builtin/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ vim.lsp.handlers["textDocument/hover"] =
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, { border = constants.window.border })

local function make_desc(value)
local function make_opts(value)
return { buffer = true, desc = value }
end

--- @param next boolean
--- @param severity integer?
local function goto_diag(next, severity)
local function goto_diagnostic(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
return function()
go({ severity = severity })
Expand Down Expand Up @@ -144,7 +144,7 @@ local function lsp_key(name, optional)
configs.mode,
configs.lhs,
string.format("<CMD>%s<CR>", right_hand),
make_desc(configs.desc)
make_opts(configs.desc)
)
hit = hit + 1
break
Expand All @@ -157,7 +157,7 @@ local function lsp_key(name, optional)
configs.mode,
configs.lhs,
string.format("<CMD>%s<CR>", table.concat(right_hand, " ")),
make_desc(configs.desc)
make_opts(configs.desc)
)
hit = hit + 1
break
Expand Down Expand Up @@ -195,31 +195,31 @@ vim.api.nvim_create_autocmd("LspAttach", {
lsp_key("clangd_switch_source_header", true)

-- diagnostic
set_key("n", "]d", goto_diag(true), make_desc("Next diagnostic item"))
set_key("n", "[d", goto_diag(false), make_desc("Previous diagnostic item"))
set_key("n", "]d", goto_diagnostic(true), make_opts("Next diagnostic item"))
set_key("n", "[d", goto_diagnostic(false), make_opts("Previous diagnostic item"))
set_key(
"n",
"]e",
goto_diag(true, vim.diagnostic.severity.ERROR),
make_desc("Next diagnostic error")
goto_diagnostic(true, vim.diagnostic.severity.ERROR),
make_opts("Go to next error")
)
set_key(
"n",
"[e",
goto_diag(false, vim.diagnostic.severity.ERROR),
make_desc("Previous diagnostic error")
goto_diagnostic(false, vim.diagnostic.severity.ERROR),
make_opts("Go to previous error")
)
set_key(
"n",
"]w",
goto_diag(true, vim.diagnostic.severity.WARN),
make_desc("Next diagnostic warning")
goto_diagnostic(true, vim.diagnostic.severity.WARN),
make_opts("Go to next warning")
)
set_key(
"n",
"[w",
goto_diag(false, vim.diagnostic.severity.WARN),
make_desc("Previous diagnostic warning")
goto_diagnostic(false, vim.diagnostic.severity.WARN),
make_opts("Go to previous warning")
)
end,
})
1 change: 1 addition & 0 deletions lua/configs/romgrk/barbar-nvim/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require("barbar").setup({

local function setup_color()
vim.api.nvim_set_hl(0, "BufferCurrentIndex", { link = "BufferCurrent" })
vim.api.nvim_set_hl(0, "BufferInactiveIndex", { link = "BufferInactive" })
end

local barbar_augroup = vim.api.nvim_create_augroup("barbar_augroup", { clear = true })
Expand Down

0 comments on commit 47fae89

Please sign in to comment.