gitsigns, vim opts, restructure
This commit is contained in:
@@ -38,8 +38,6 @@ require "nvchad.autocmds"
|
|||||||
|
|
||||||
require("configs.set")
|
require("configs.set")
|
||||||
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
require "mappings"
|
require "mappings"
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "00dae9f5f4ad215d4561f2fd2f26478c48b0ca7f" },
|
"nvim-lspconfig": { "branch": "master", "commit": "00dae9f5f4ad215d4561f2fd2f26478c48b0ca7f" },
|
||||||
|
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" },
|
"nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "824bf8455fd670186986fb3eb46fcaa4c5460949" },
|
"nvim-treesitter": { "branch": "master", "commit": "824bf8455fd670186986fb3eb46fcaa4c5460949" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
|
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
require("auto-session").setup {
|
||||||
|
enabled = true,
|
||||||
|
root_dir = vim.fn.stdpath "data" .. "/sessions/",
|
||||||
|
auto_save = true,
|
||||||
|
auto_restore = true,
|
||||||
|
auto_create = true,
|
||||||
|
suppressed_dirs = nil,
|
||||||
|
allowed_dirs = nil,
|
||||||
|
auto_restore_last_session = false,
|
||||||
|
use_git_branch = false,
|
||||||
|
lazy_support = true,
|
||||||
|
bypass_save_filetypes = nil,
|
||||||
|
close_unsupported_windows = true,
|
||||||
|
args_allow_single_directory = true,
|
||||||
|
args_allow_files_auto_save = false,
|
||||||
|
continue_restore_on_error = true,
|
||||||
|
show_auto_restore_notif = false,
|
||||||
|
cwd_change_handling = false,
|
||||||
|
lsp_stop_on_restore = false,
|
||||||
|
log_level = "error",
|
||||||
|
|
||||||
|
session_lens = {
|
||||||
|
load_on_setup = true,
|
||||||
|
theme_conf = {
|
||||||
|
-- test
|
||||||
|
},
|
||||||
|
previewer = false,
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
delete_session = { "i", "<C-D>" },
|
||||||
|
alternate_session = { "i", "<C-S>" },
|
||||||
|
copy_session = { "i", "<C-Y>" },
|
||||||
|
},
|
||||||
|
|
||||||
|
session_control = {
|
||||||
|
control_dir = vim.fn.stdpath "data" .. "/auto_session/",
|
||||||
|
control_filename = "session_control.json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
|
||||||
|
callback = function()
|
||||||
|
vim.cmd( "SessionSave" )
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
require("copilot").setup({
|
require("copilot").setup({
|
||||||
panel = {
|
panel = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
auto_refresh = true,
|
auto_refresh = true,
|
||||||
@@ -61,4 +61,4 @@
|
|||||||
vim.cmd( "CopilotChatLoad AutoSave" )
|
vim.cmd( "CopilotChatLoad AutoSave" )
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ require("focus").setup({
|
|||||||
enable = false,
|
enable = false,
|
||||||
list = '+1',
|
list = '+1',
|
||||||
},
|
},
|
||||||
signcolumn = true,
|
signcolumn = false,
|
||||||
winhighlight = false,
|
winhighlight = false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -103,24 +103,9 @@ local servers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lspconfig.hyprls.setup {
|
lspconfig.hyprls.setup {
|
||||||
on_attach = nvlsp.on_attach,
|
root_dir = vim.fs.root( 0, 'hyprland.conf' ),
|
||||||
root_dir = function( fname )
|
single_file_support = false,
|
||||||
local root_files = {
|
filetypes = { "conf" },
|
||||||
'hyprland.conf',
|
|
||||||
'hypridle.conf',
|
|
||||||
'hyprlock.conf',
|
|
||||||
'hyprpaper.conf',
|
|
||||||
'hyprshade.conf',
|
|
||||||
}
|
|
||||||
local util = require 'lspconfig/util'
|
|
||||||
local root = util.root_pattern(unpack(root_files))(fname) or util.path.dirname(fname)
|
|
||||||
if root and string.match( root, '~/.config/hypr/' ) then
|
|
||||||
return root
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
filetypes = { 'conf' },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- lsps with default config
|
-- lsps with default config
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
vim.notify = require('notify')
|
||||||
|
local dap = require('dap')
|
||||||
|
|
||||||
|
require('notify').setup({
|
||||||
|
max_width = 40,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Utility functions shared between progress reports for LSP and DAP
|
||||||
|
|
||||||
|
local client_notifs = {}
|
||||||
|
|
||||||
|
local function get_notif_data(client_id, token)
|
||||||
|
if not client_notifs[client_id] then
|
||||||
|
client_notifs[client_id] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
if not client_notifs[client_id][token] then
|
||||||
|
client_notifs[client_id][token] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
return client_notifs[client_id][token]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local spinner_frames = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }
|
||||||
|
|
||||||
|
local function update_spinner(client_id, token)
|
||||||
|
local notif_data = get_notif_data(client_id, token)
|
||||||
|
|
||||||
|
if notif_data.spinner then
|
||||||
|
local new_spinner = (notif_data.spinner + 1) % #spinner_frames
|
||||||
|
notif_data.spinner = new_spinner
|
||||||
|
|
||||||
|
notif_data.notification = vim.notify(nil, nil, {
|
||||||
|
hide_from_history = true,
|
||||||
|
icon = spinner_frames[new_spinner],
|
||||||
|
replace = notif_data.notification,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.defer_fn(function()
|
||||||
|
update_spinner(client_id, token)
|
||||||
|
end, 100)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function format_title(title, client_name)
|
||||||
|
return client_name .. (#title > 0 and ": " .. title or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function format_message(message, percentage)
|
||||||
|
return (percentage and percentage .. "%\t" or "") .. (message or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- LSP integration
|
||||||
|
-- Make sure to also have the snippet with the common helper functions in your config!
|
||||||
|
|
||||||
|
vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
||||||
|
local client_id = ctx.client_id
|
||||||
|
|
||||||
|
local val = result.value
|
||||||
|
|
||||||
|
if not val.kind then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local notif_data = get_notif_data(client_id, result.token)
|
||||||
|
|
||||||
|
if val.kind == "begin" then
|
||||||
|
local message = format_message(val.message, val.percentage)
|
||||||
|
|
||||||
|
notif_data.notification = vim.notify(message, "info", {
|
||||||
|
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
|
||||||
|
icon = spinner_frames[1],
|
||||||
|
timeout = false,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
notif_data.spinner = 1
|
||||||
|
update_spinner(client_id, result.token)
|
||||||
|
elseif val.kind == "report" and notif_data then
|
||||||
|
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
|
||||||
|
replace = notif_data.notification,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
elseif val.kind == "end" and notif_data then
|
||||||
|
notif_data.notification =
|
||||||
|
vim.notify(val.message and format_message(val.message) or "Complete", "info", {
|
||||||
|
icon = "",
|
||||||
|
replace = notif_data.notification,
|
||||||
|
timeout = 3000,
|
||||||
|
})
|
||||||
|
|
||||||
|
notif_data.spinner = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- table from lsp severity to vim severity.
|
||||||
|
local severity = {
|
||||||
|
"error",
|
||||||
|
"warn",
|
||||||
|
"info",
|
||||||
|
"info", -- map both hint and info to info?
|
||||||
|
}
|
||||||
|
vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
|
||||||
|
vim.notify(method.message, severity[params.type])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- DAP integration
|
||||||
|
-- Make sure to also have the snippet with the common helper functions in your config!
|
||||||
|
|
||||||
|
dap.listeners.before['event_progressStart']['progress-notifications'] = function(session, body)
|
||||||
|
local notif_data = get_notif_data("dap", body.progressId)
|
||||||
|
|
||||||
|
local message = format_message(body.message, body.percentage)
|
||||||
|
notif_data.notification = vim.notify(message, "info", {
|
||||||
|
title = format_title(body.title, session.config.type),
|
||||||
|
icon = spinner_frames[1],
|
||||||
|
timeout = false,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
notif_data.notification.spinner = 1,
|
||||||
|
update_spinner("dap", body.progressId)
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.listeners.before['event_progressUpdate']['progress-notifications'] = function(session, body)
|
||||||
|
local notif_data = get_notif_data("dap", body.progressId)
|
||||||
|
notif_data.notification = vim.notify(format_message(body.message, body.percentage), "info", {
|
||||||
|
replace = notif_data.notification,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.listeners.before['event_progressEnd']['progress-notifications'] = function(session, body)
|
||||||
|
local notif_data = client_notifs["dap"][body.progressId]
|
||||||
|
notif_data.notification = vim.notify(body.message and format_message(body.message) or "Complete", "info", {
|
||||||
|
icon = "",
|
||||||
|
replace = notif_data.notification,
|
||||||
|
timeout = 3000
|
||||||
|
})
|
||||||
|
notif_data.spinner = nil
|
||||||
|
end
|
||||||
+39
-1
@@ -20,10 +20,48 @@ vim.opt.incsearch = true
|
|||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
vim.opt.scrolloff = 8
|
vim.opt.scrolloff = 8
|
||||||
vim.opt.signcolumn = "yes"
|
vim.opt.signcolumn = "yes:1"
|
||||||
vim.opt.isfname:append("@-@")
|
vim.opt.isfname:append("@-@")
|
||||||
|
|
||||||
vim.opt.updatetime = 50
|
vim.opt.updatetime = 50
|
||||||
|
|
||||||
vim.opt.colorcolumn = "80"
|
vim.opt.colorcolumn = "80"
|
||||||
|
|
||||||
|
vim.opt.textwidth = 80
|
||||||
|
vim.opt.formatoptions = "tcrqnja"
|
||||||
|
|
||||||
|
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||||
|
|
||||||
|
vim.o.laststatus = 3
|
||||||
|
|
||||||
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
vim.o.cursorline = true
|
||||||
|
vim.o.cursorlineopt = "number"
|
||||||
|
|
||||||
|
vim.opt.fillchars = { eob = " " }
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
vim.o.mouse = "a"
|
||||||
|
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.numberwidth = 3
|
||||||
|
vim.o.ruler = false
|
||||||
|
|
||||||
|
vim.opt.shortmess:append "sI"
|
||||||
|
|
||||||
|
vim.o.splitbelow = true
|
||||||
|
vim.o.splitright = true
|
||||||
|
vim.o.timeoutlen = 400
|
||||||
|
|
||||||
|
vim.opt.whichwrap:append "<>[]hl"
|
||||||
|
|
||||||
|
vim.g.loaded_node_provider = 0
|
||||||
|
vim.g.loaded_python3_provider = 0
|
||||||
|
vim.g.loaded_perl_provider = 0
|
||||||
|
vim.g.loaded_ruby_provider = 0
|
||||||
|
|
||||||
|
-- add binaries installed by mason.nvim to path
|
||||||
|
local is_windows = vim.fn.has "win32" ~= 0
|
||||||
|
local sep = is_windows and "\\" or "/"
|
||||||
|
local delim = is_windows and ";" or ":"
|
||||||
|
vim.env.PATH = table.concat({ vim.fn.stdpath "data", "mason", "bin" }, sep) .. delim .. vim.env.PATH
|
||||||
|
|||||||
+1
-2
@@ -2,5 +2,4 @@ require "nvchad.options"
|
|||||||
|
|
||||||
-- add yours here!
|
-- add yours here!
|
||||||
|
|
||||||
-- local o = vim.o
|
-- local o = vim.o o.cursorlineopt ='both' -- to enable cursorline!
|
||||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
|
||||||
|
|||||||
+10
-40
@@ -89,6 +89,13 @@ return {
|
|||||||
|
|
||||||
{ "lambdalisue/vim-suda" },
|
{ "lambdalisue/vim-suda" },
|
||||||
|
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-notify",
|
||||||
|
config = function()
|
||||||
|
require "configs.notify"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"ojroques/nvim-bufdel",
|
"ojroques/nvim-bufdel",
|
||||||
opts = {
|
opts = {
|
||||||
@@ -121,46 +128,9 @@ return {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"rmagatti/auto-session",
|
"rmagatti/auto-session",
|
||||||
opts = {
|
config = function()
|
||||||
enabled = true,
|
require "configs.auto-session"
|
||||||
root_dir = vim.fn.stdpath "data" .. "/sessions/",
|
end,
|
||||||
auto_save = true,
|
|
||||||
auto_restore = true,
|
|
||||||
auto_create = true,
|
|
||||||
suppressed_dirs = nil,
|
|
||||||
allowed_dirs = nil,
|
|
||||||
auto_restore_last_session = false,
|
|
||||||
use_git_branch = false,
|
|
||||||
lazy_support = true,
|
|
||||||
bypass_save_filetypes = nil,
|
|
||||||
close_unsupported_windows = true,
|
|
||||||
args_allow_single_directory = true,
|
|
||||||
args_allow_files_auto_save = false,
|
|
||||||
continue_restore_on_error = true,
|
|
||||||
show_auto_restore_notif = false,
|
|
||||||
cwd_change_handling = false,
|
|
||||||
lsp_stop_on_restore = false,
|
|
||||||
log_level = "error",
|
|
||||||
|
|
||||||
session_lens = {
|
|
||||||
load_on_setup = true,
|
|
||||||
theme_conf = {
|
|
||||||
-- test
|
|
||||||
},
|
|
||||||
previewer = false,
|
|
||||||
|
|
||||||
mappings = {
|
|
||||||
delete_session = { "i", "<C-D>" },
|
|
||||||
alternate_session = { "i", "<C-S>" },
|
|
||||||
copy_session = { "i", "<C-Y>" },
|
|
||||||
},
|
|
||||||
|
|
||||||
session_control = {
|
|
||||||
control_dir = vim.fn.stdpath "data" .. "/auto_session/",
|
|
||||||
control_filename = "session_control.json",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user