Skip to content

Commit

Permalink
feat: upgrade plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1v3r committed Oct 13, 2024
1 parent 75915a1 commit a6b9273
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 131 deletions.
159 changes: 80 additions & 79 deletions lazy-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lua/plugins/configs/completion/null-ls.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return function()
local settings = require("r1v3r.settings")
local null_ls = require("null-ls")
local formatting = null_ls.builtins.formatting
local formatter_config_dir = "completion.formatters."
Expand Down Expand Up @@ -30,7 +31,7 @@ return function()
filetypes = { "lua" },
extra_args = require(formatter_config_dir .. "stylua"),
}),
formatting.rustfmt,
-- formatting.rustfmt, -- deprecated format plugin: https://github.com/nvimtools/none-ls.nvim/issues/58
formatting.goimports_reviser.with({
extra_args = require(formatter_config_dir .. "goimports-reviser"),
}),
Expand All @@ -42,6 +43,7 @@ return function()
log_level = "warn",
update_in_insert = false,
sources = sources,
default_timeout = settings.format_timeout,
})

require("completion.mason-null-ls").setup()
Expand Down
43 changes: 36 additions & 7 deletions lua/plugins/configs/editor/better-escape.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
return function()
require("better_escape").setup({
mapping = { "kk" }, -- a table with mappings to use
timeout = vim.o.timeoutlen, -- the time in which the keys must be hit in ms. Use option timeoutlen by default
clear_empty_lines = false, -- clear line after escaping if there is only whitespace
keys = "<Esc>", -- keys used for escaping, if it is a function will use the result everytime
-- example(recommended)
-- keys = function()
-- return vim.api.nvim_win_get_cursor(0)[2] > 1 and '<ESC>l' or '<ESC>'
-- end,
default_mappings = false,
mappings = {
i = {
k = {
k = function()
vim.api.nvim_input("<esc>")
local current_line = vim.api.nvim_get_current_line()
if current_line:match("^%s+k$") then
vim.schedule(function()
vim.api.nvim_set_current_line("")
end)
end
end,
},
},
-- c = {
-- k = {
-- k = "<Esc>",
-- },
-- },
-- t = {
-- k = {
-- k = "<C-\\><C-n>",
-- },
-- },
-- v = {
-- k = {
-- k = "<Esc>",
-- },
-- },
-- s = {
-- k = {
-- k = "<Esc>",
-- },
-- },
},
})
end
10 changes: 5 additions & 5 deletions lua/plugins/configs/tool/which-key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ return function()
group = icons.misc.Add,
},

window = {
win = {
border = "none",
position = "bottom",
margin = { 1, 0, 1, 0 },
padding = { 1, 1, 1, 1 },
winblend = 0,
padding = { 1, 2 }, -- extra window padding [top/bottom, right/left]
wo = {
winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent
},
},
})
end
36 changes: 6 additions & 30 deletions lua/plugins/configs/ui/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
return function()
require("gitsigns").setup({
signs = {
add = {
hl = "GitSignsAdd",
text = "",
numhl = "GitSignsAddNr",
linehl = "GitSignsAddLn",
},
change = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "_",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "~",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
on_attach = require("r1v3r.keymaps").gitsigns,
watch_gitdir = { interval = 1000, follow_files = true },
Expand Down
9 changes: 7 additions & 2 deletions lua/plugins/configs/ui/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,20 @@ return function()
lsp = {
function()
local buf_ft = vim.api.nvim_get_option_value("filetype", { scope = "local" })
local clients = vim.lsp.get_active_clients()
local clients = vim.lsp.get_clients()
local lsp_lists = {}
local available_servers = {}
-- 如果没有活跃的 LSP 客户端,直接返回提示
if next(clients) == nil then
return icons.misc.NoActiveLsp -- No server available
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
-- 确保 client.config 存在 filetypes
---@diagnostic disable-next-line: undefined-field
local filetypes = client.config and client.config.filetypes or {}
local client_name = client.name

-- 检查当前缓冲区的文件类型是否被该 LSP 客户端支持
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
-- Avoid adding servers that already exists.
if not lsp_lists[client_name] then
Expand Down
1 change: 1 addition & 0 deletions lua/plugins/tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ tool["mfussenegger/nvim-dap"] = {
"rcarriga/nvim-dap-ui",
config = require("tool.dap.dapui"),
},
{ "nvim-neotest/nvim-nio" },
{ "jay-babu/mason-nvim-dap.nvim" },
{ "leoluz/nvim-dap-go" },
},
Expand Down
2 changes: 1 addition & 1 deletion lua/r1v3r/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function autocmd.group(definitions)
vim.api.nvim_command("augroup " .. group_name)
vim.api.nvim_command("autocmd!")
for _, def in ipairs(definition) do
local command = table.concat(vim.tbl_flatten({ "autocmd", def }), " ")
local command = table.concat(vim.list_extend({ "autocmd" }, def), " ")
vim.api.nvim_command(command)
end
vim.api.nvim_command("augroup END")
Expand Down
8 changes: 4 additions & 4 deletions lua/r1v3r/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ end

local function setEditorPlugKeys()
-- Plugin: accelerated-jk
map("u", "<Plug>(accelerated_jk_gk)"):mode("n"):noremap():set()
map("e", "<Plug>(accelerated_jk_gj)"):mode("n"):noremap():set()
map("gu", "<Plug>(accelerated_jk_k)"):mode("n"):noremap():set()
map("ge", "<Plug>(accelerated_jk_j)"):mode("n"):noremap():set()
map("u", "<Plug>(accelerated_jk_k)"):mode("n"):noremap():set()
map("e", "<Plug>(accelerated_jk_j)"):mode("n"):noremap():set()
map("gu", "<Plug>(accelerated_jk_gk)"):mode("n"):noremap():set()
map("ge", "<plug>(accelerated_jk_gj)"):mode("n"):noremap():set()

-- Plugin: persisted.nvim
map("<LEADER>ss", "SessionSave"):mode("n"):cmd():noremap():desc("session: save"):set()
Expand Down
2 changes: 1 addition & 1 deletion lua/r1v3r/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function options.o()
-- Use visual bell instead of beeping sound
visualbell = true,
-- Set the time interval for writing swap and backup files
updatetime = 100,
updatetime = 300,
-- Enable blockwise virtual editing
virtualedit = "block",
-- Automatically change the current directory to the directory of the current file
Expand Down
2 changes: 1 addition & 1 deletion lua/r1v3r/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local Lazy = {}

-- check: check if lazy.nvim exists, if not, download it
function Lazy.check()
if not vim.loop.fs_stat(lazy_path) then
if not vim.fn.isdirectory(lazy_path) then
local lazy_repo = use_ssh and "[email protected]:folke/lazy.nvim.git" or "https://github.com/folke/lazy.nvim.git"
api.nvim_command("!git clone --filter=blob:none --branch=stable " .. lazy_repo .. " " .. lazy_path)
end
Expand Down
5 changes: 5 additions & 0 deletions lua/r1v3r/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ settings["background"] = "dark"
-- Parameters will be automatically completed as you type.
-- Example: { sky = "#04A5E5" }
---@type palette
---@diagnostic disable-next-line: missing-fields
settings["palette_overwrite"] = {}

-- Set the options for neovim's gui clients like `neovide` and `neovim-qt` here.
Expand Down Expand Up @@ -72,6 +73,10 @@ settings["neovide_config"] = {
---@type boolean
settings["format_on_save"] = true

-- Set format timeout here (in ms).
---@type number
settings["format_timeout"] = 1000

-- Set it to false if the notification after formatting is annoying.
---@type boolean
settings["format_notify"] = true
Expand Down

0 comments on commit a6b9273

Please sign in to comment.