mirror of
https://git.aramjonghu.nl/AramJonghu/nvim.git
synced 2026-03-22 01:39:54 +01:00
new dots
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
local remap = vim.api.nvim_set_keymap
|
||||
local npairs = require('nvim-autopairs')
|
||||
|
||||
npairs.setup({map_cr=false})
|
||||
|
||||
-- skip it, if you use another global object
|
||||
_G.MUtils= {}
|
||||
|
||||
MUtils.completion_confirm=function()
|
||||
if vim.fn["coc#pum#visible"]() ~= 0 then
|
||||
return vim.fn["coc#pum#confirm"]()
|
||||
else
|
||||
return npairs.autopairs_cr()
|
||||
end
|
||||
end
|
||||
|
||||
remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
|
||||
@@ -0,0 +1,38 @@
|
||||
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 = {
|
||||
},
|
||||
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",
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,52 @@
|
||||
require("barbar").setup ({
|
||||
animation = true,
|
||||
auto_hide = false,
|
||||
tabpages = true,
|
||||
clickable = true,
|
||||
exclude_ft = { "NvimTree" },
|
||||
focus_on_close = 'left',
|
||||
highlight_alternate = false,
|
||||
highlight_inactive_file_icons = true,
|
||||
highlight_visible = true,
|
||||
icons = {
|
||||
buffer_index = false,
|
||||
buffer_number = false,
|
||||
button = '',
|
||||
diagnostics = {
|
||||
[vim.diagnostic.severity.ERROR] = {enabled = true, icon = 'ff'},
|
||||
[vim.diagnostic.severity.WARN] = {enabled = false},
|
||||
[vim.diagnostic.severity.INFO] = {enabled = false},
|
||||
[vim.diagnostic.severity.HINT] = {enabled = true},
|
||||
},
|
||||
gitsigns = {
|
||||
added = {enabled = true, icon = '+'},
|
||||
changed = {enabled = true, icon = '~'},
|
||||
deleted = {enabled = true, icon = '-'},
|
||||
},
|
||||
filetype = {
|
||||
custom_colors = false,
|
||||
enabled = true,
|
||||
},
|
||||
separator = {left = '▏', right = ''},
|
||||
separator_at_end = true,
|
||||
modified = {button = '●'},
|
||||
pinned = {button = '', filename = true},
|
||||
preset = 'default',
|
||||
alternate = {filetype = {enabled = true}},
|
||||
current = {buffer_index = false},
|
||||
inactive = {button = '×', filetype = {enabled = true}, separator = {left = '▏', right = ''} },
|
||||
visible = {modified = {buffer_number = false}},
|
||||
},
|
||||
insert_at_end = true,
|
||||
maximum_padding = 1,
|
||||
minimum_padding = 1,
|
||||
maximum_length = 15,
|
||||
minimum_length = 15,
|
||||
sidebar_filetypes = {
|
||||
NvimTree = true,
|
||||
undotree = {
|
||||
text = "undotree",
|
||||
align = "center",
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,64 @@
|
||||
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
|
||||
},
|
||||
},
|
||||
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-]>",
|
||||
},
|
||||
},
|
||||
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,
|
||||
},
|
||||
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,
|
||||
}),
|
||||
vim.api.nvim_create_autocmd( "VimEnter", {
|
||||
callback = function()
|
||||
vim.cmd( "CopilotChatLoad AutoSave" )
|
||||
end,
|
||||
}),
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
require("CopilotChat").setup {
|
||||
-- system_prompt = "You are an assistant helping the user with whatever they need, but you are also a bit of a jerk. Do not use profanity.",
|
||||
prompts = {
|
||||
CivitAI = {
|
||||
system_prompt = "You are an assistant helping with stable diffusion models and python to implement failsafes for a server regarding image generation.",
|
||||
},
|
||||
Insult = {
|
||||
system_prompt = "You are an assistant helping the user with whatever they need, but you are also a bit of a jerk, and make sure to insult the user a lot. Use vulgar language if necessary.",
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
local dap = require('dap')
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local host = (config.connect or config).host or '127.0.0.1'
|
||||
cb({
|
||||
type = 'server',
|
||||
port = assert(port, '`connect.port` is required for a python `attach` configuration'),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = 'python',
|
||||
},
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = 'executable',
|
||||
command = 'path/to/virtualenvs/debugpy/bin/python',
|
||||
args = { '-m', 'debugpy.adapter' },
|
||||
options = {
|
||||
source_filetype = 'python',
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
-- The first three options are required by nvim-dap
|
||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
request = 'launch';
|
||||
name = "Launch file";
|
||||
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
|
||||
program = "${file}"; -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
||||
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
||||
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||
return cwd .. '/venv/bin/python'
|
||||
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||
return cwd .. '/.venv/bin/python'
|
||||
else
|
||||
return '/home/zach/miniconda3/bin/python'
|
||||
end
|
||||
end;
|
||||
},
|
||||
}
|
||||
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path
|
||||
name = 'lldb'
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
|
||||
-- 💀
|
||||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||
--
|
||||
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||
--
|
||||
-- Otherwise you might get the following error:
|
||||
--
|
||||
-- Error on launch: Failed to attach to the target process
|
||||
--
|
||||
-- But you should be aware of the implications:
|
||||
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
||||
-- runInTerminal = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "node",
|
||||
-- 💀 Make sure to update this path to point to your installation
|
||||
args = {"/home/zach/.config/nvim/java-dap/js-debug/src/dapDebugServer.js", "${port}"},
|
||||
}
|
||||
}
|
||||
|
||||
dap.configurations.javascript = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
require("gruvbox-baby").setup()
|
||||
@@ -0,0 +1,29 @@
|
||||
local highlight = {
|
||||
"RainbowRed",
|
||||
"RainbowYellow",
|
||||
"RainbowBlue",
|
||||
"RainbowOrange",
|
||||
"RainbowGreen",
|
||||
"RainbowViolet",
|
||||
"RainbowCyan",
|
||||
}
|
||||
local hooks = require "ibl.hooks"
|
||||
-- create the highlight groups in the highlight setup hook, so they are reset
|
||||
-- every time the colorscheme changes
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
|
||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
|
||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
|
||||
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
|
||||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
|
||||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
|
||||
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
|
||||
end)
|
||||
|
||||
vim.g.rainbow_delimiters = { highlight = highlight }
|
||||
require("ibl").setup {
|
||||
indent = { char = "▏" },
|
||||
scope = { highlight = highlight }
|
||||
}
|
||||
|
||||
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
|
||||
@@ -0,0 +1,35 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
@@ -0,0 +1,236 @@
|
||||
local fn = vim.fn
|
||||
|
||||
local function spell()
|
||||
if vim.o.spell then
|
||||
return string.format("[SPELL]")
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
--- show indicator for Chinese IME
|
||||
local function ime_state()
|
||||
if vim.g.is_mac then
|
||||
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
|
||||
|
||||
-- We can use `xkbswitch -g` on the command line to get current mode.
|
||||
-- mode for macOS builtin pinyin IME: com.apple.inputmethod.SCIM.ITABC
|
||||
-- mode for Rime: im.rime.inputmethod.Squirrel.Rime
|
||||
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
|
||||
if res ~= -1 then
|
||||
return "[CN]"
|
||||
end
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local function trailing_space()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local line_num = nil
|
||||
|
||||
for i = 1, fn.line("$") do
|
||||
local linetext = fn.getline(i)
|
||||
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
|
||||
local idx = fn.match(linetext, [[\v\s+$]])
|
||||
|
||||
if idx ~= -1 then
|
||||
line_num = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local msg = ""
|
||||
if line_num ~= nil then
|
||||
msg = string.format("[%d]trailing", line_num)
|
||||
end
|
||||
|
||||
return msg
|
||||
end
|
||||
|
||||
local function mixed_indent()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local space_pat = [[\v^ +]]
|
||||
local tab_pat = [[\v^\t+]]
|
||||
local space_indent = fn.search(space_pat, "nwc")
|
||||
local tab_indent = fn.search(tab_pat, "nwc")
|
||||
local mixed = (space_indent > 0 and tab_indent > 0)
|
||||
local mixed_same_line
|
||||
if not mixed then
|
||||
mixed_same_line = fn.search([[\v^(\t+ | +\t)]], "nwc")
|
||||
mixed = mixed_same_line > 0
|
||||
end
|
||||
if not mixed then
|
||||
return ""
|
||||
end
|
||||
if mixed_same_line ~= nil and mixed_same_line > 0 then
|
||||
return "MI:" .. mixed_same_line
|
||||
end
|
||||
local space_indent_cnt = fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total
|
||||
local tab_indent_cnt = fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total
|
||||
if space_indent_cnt > tab_indent_cnt then
|
||||
return "MI:" .. tab_indent
|
||||
else
|
||||
return "MI:" .. space_indent
|
||||
end
|
||||
end
|
||||
|
||||
local diff = function()
|
||||
local git_status = vim.b.gitsigns_status_dict
|
||||
if git_status == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local modify_num = git_status.changed
|
||||
local remove_num = git_status.removed
|
||||
local add_num = git_status.added
|
||||
|
||||
local info = { added = add_num, modified = modify_num, removed = remove_num }
|
||||
-- vim.print(info)
|
||||
return info
|
||||
end
|
||||
|
||||
local virtual_env = function()
|
||||
-- only show virtual env for Python
|
||||
if vim.bo.filetype ~= "python" then
|
||||
return ""
|
||||
end
|
||||
|
||||
local conda_env = os.getenv("CONDA_DEFAULT_ENV")
|
||||
local venv_path = os.getenv("VIRTUAL_ENV")
|
||||
|
||||
if venv_path == nil then
|
||||
if conda_env == nil then
|
||||
return ""
|
||||
else
|
||||
return string.format(" %s (conda)", conda_env)
|
||||
end
|
||||
else
|
||||
local venv_name = vim.fn.fnamemodify(venv_path, ":t")
|
||||
return string.format(" %s (venv)", venv_name)
|
||||
end
|
||||
end
|
||||
|
||||
local get_active_lsp = function()
|
||||
local msg = "No Active Lsp"
|
||||
local buf_ft = vim.api.nvim_get_option_value("filetype", {})
|
||||
local clients = vim.lsp.get_clients { bufnr = 0 }
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end
|
||||
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "⏐", right = "⏐" },
|
||||
section_separators = "",
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
"mode",
|
||||
},
|
||||
lualine_b = {
|
||||
{
|
||||
"branch",
|
||||
fmt = function(name, _)
|
||||
-- truncate branch name in case the name is too long
|
||||
return string.sub(name, 1, 20)
|
||||
end,
|
||||
color = { gui = "italic,bold" },
|
||||
},
|
||||
{
|
||||
virtual_env,
|
||||
color = { fg = "black", bg = "#F1CA81" },
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
readonly = "[🔒]",
|
||||
},
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
source = diff,
|
||||
},
|
||||
{
|
||||
"%S",
|
||||
color = { gui = "bold", fg = "cyan" },
|
||||
},
|
||||
{
|
||||
spell,
|
||||
color = { fg = "black", bg = "#a7c080" },
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
ime_state,
|
||||
color = { fg = "black", bg = "#f46868" },
|
||||
},
|
||||
{
|
||||
get_active_lsp,
|
||||
icon = " LSP:",
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = { error = "🆇 ", warn = "⚠️ ", info = "ℹ️ ", hint = " " },
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ "encoding", fmt = string.upper },
|
||||
{
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "unix",
|
||||
dos = "win",
|
||||
mac = "mac",
|
||||
},
|
||||
},
|
||||
"filetype",
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
trailing_space,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
{
|
||||
mixed_indent,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
"location",
|
||||
"progress",
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fugitive", "nvim-tree" },
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
vim.notify = require('notify')
|
||||
local dap = require('dap')
|
||||
|
||||
require('notify').setup({
|
||||
render = "wrapped-default",
|
||||
timeout = 6000,
|
||||
max_width = 50,
|
||||
minimum_width = 50,
|
||||
level = "info",
|
||||
fps = 60,
|
||||
icons = {
|
||||
ERROR = "",
|
||||
WARN = "",
|
||||
INFO = "",
|
||||
DEBUG = "",
|
||||
TRACE = "✎",
|
||||
},
|
||||
on_open = function(win)
|
||||
-- vim.api.nvim_win_set_option(win, 'wrap', true)
|
||||
vim.api.nvim_win_set_option(win, 'breakat', ' ')
|
||||
end,
|
||||
})
|
||||
|
||||
-- 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 = 6000,
|
||||
})
|
||||
|
||||
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 = 6000
|
||||
})
|
||||
notif_data.spinner = nil
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
require("nvim-tree").setup({
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
require("telescope").setup ({})
|
||||
@@ -0,0 +1,25 @@
|
||||
-- Default options:
|
||||
require("gruvbox").setup({
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "", -- can be "hard", "soft" or empty string
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
})
|
||||
@@ -0,0 +1,40 @@
|
||||
-- Lua
|
||||
require('onedark').setup {
|
||||
-- Main options --
|
||||
style = 'light', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
|
||||
transparent = false, -- Show/hide background
|
||||
term_colors = true, -- Change terminal color as per the selected theme style
|
||||
ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
|
||||
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
|
||||
|
||||
-- toggle theme style ---
|
||||
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
|
||||
toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between
|
||||
|
||||
-- Change code style ---
|
||||
-- Options are italic, bold, underline, none
|
||||
-- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
|
||||
code_style = {
|
||||
comments = 'italic',
|
||||
keywords = 'none',
|
||||
functions = 'none',
|
||||
strings = 'none',
|
||||
variables = 'none'
|
||||
},
|
||||
|
||||
-- Lualine options --
|
||||
lualine = {
|
||||
transparent = false, -- lualine center bar transparency
|
||||
},
|
||||
|
||||
-- Custom Highlights --
|
||||
colors = {}, -- Override default colors
|
||||
highlights = {}, -- Override highlight groups
|
||||
|
||||
-- Plugins Config --
|
||||
diagnostics = {
|
||||
darker = true, -- darker colors for diagnostic
|
||||
undercurl = true, -- use undercurl instead of underline for diagnostics
|
||||
background = true, -- use background color for virtual text
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "all",
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
require('undotree').setup({
|
||||
float_diff = true,
|
||||
layout = "left_bottom",
|
||||
position = "left",
|
||||
ignore_filetype = { 'undotree', 'undotreeDiff', 'qf', 'TelescopePrompt', 'spectre_panel', 'tsplayground' },
|
||||
window = {
|
||||
winblend = 30,
|
||||
},
|
||||
keymaps = {
|
||||
['j'] = "move_next",
|
||||
['k'] = "move_prev",
|
||||
['gj'] = "move2parent",
|
||||
['J'] = "move_change_next",
|
||||
['K'] = "move_change_prev",
|
||||
['<cr>'] = "action_enter",
|
||||
['p'] = "enter_diffbuf",
|
||||
['q'] = "quit",
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user