gitsigns, vim opts, restructure
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
}
|
||||
+52
-52
@@ -1,64 +1,64 @@
|
||||
require("copilot").setup({
|
||||
require("copilot").setup({
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = true,
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
open = "<M-CR>"
|
||||
},
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right | horizontal | vertical
|
||||
ratio = 0.4
|
||||
},
|
||||
enabled = true,
|
||||
auto_refresh = true,
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
open = "<M-CR>"
|
||||
},
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right | horizontal | vertical
|
||||
ratio = 0.4
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
hide_during_completion = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<A-tab>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
hide_during_completion = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<A-tab>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
-- yaml = false,
|
||||
-- markdown = false,
|
||||
-- help = false,
|
||||
-- gitcommit = false,
|
||||
-- gitrebase = false,
|
||||
-- hgcommit = false,
|
||||
-- svn = false,
|
||||
-- cvs = false,
|
||||
-- python = false,
|
||||
-- html = false,
|
||||
-- css = false,
|
||||
-- sh = false,
|
||||
-- tex = false,
|
||||
-- typescript = false,
|
||||
-- java = false,
|
||||
-- swift = false,
|
||||
-- cpp = false,
|
||||
-- hypr = false,
|
||||
-- ["."] = false,
|
||||
-- yaml = false,
|
||||
-- markdown = false,
|
||||
-- help = false,
|
||||
-- gitcommit = false,
|
||||
-- gitrebase = false,
|
||||
-- hgcommit = false,
|
||||
-- svn = false,
|
||||
-- cvs = false,
|
||||
-- python = false,
|
||||
-- html = false,
|
||||
-- css = false,
|
||||
-- sh = false,
|
||||
-- tex = false,
|
||||
-- typescript = false,
|
||||
-- java = false,
|
||||
-- swift = false,
|
||||
-- cpp = false,
|
||||
-- hypr = false,
|
||||
-- ["."] = false,
|
||||
},
|
||||
copilot_node_command = 'node', -- Node.js version must be > 18.x
|
||||
server_opts_overrides = {},
|
||||
vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
|
||||
callback = function()
|
||||
vim.cmd( "CopilotChatSave AutoSave" )
|
||||
end,
|
||||
callback = function()
|
||||
vim.cmd( "CopilotChatSave AutoSave" )
|
||||
end,
|
||||
}),
|
||||
vim.api.nvim_create_autocmd( "VimEnter", {
|
||||
callback = function()
|
||||
vim.cmd( "CopilotChatLoad AutoSave" )
|
||||
end,
|
||||
callback = function()
|
||||
vim.cmd( "CopilotChatLoad AutoSave" )
|
||||
end,
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ require("focus").setup({
|
||||
enable = false,
|
||||
list = '+1',
|
||||
},
|
||||
signcolumn = true,
|
||||
signcolumn = false,
|
||||
winhighlight = false,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -103,24 +103,9 @@ local servers = {
|
||||
}
|
||||
|
||||
lspconfig.hyprls.setup {
|
||||
on_attach = nvlsp.on_attach,
|
||||
root_dir = function( fname )
|
||||
local root_files = {
|
||||
'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' },
|
||||
root_dir = vim.fs.root( 0, 'hyprland.conf' ),
|
||||
single_file_support = false,
|
||||
filetypes = { "conf" },
|
||||
}
|
||||
|
||||
-- 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.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.signcolumn = "yes:1"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user