Compare commits
5 Commits
5cc63de54c
...
0ec4557f5d
| Author | SHA1 | Date | |
|---|---|---|---|
|
0ec4557f5d
|
|||
|
9f6f878fb7
|
|||
|
8742b343b3
|
|||
|
51cf93a90e
|
|||
|
19567ee2b5
|
@@ -50,6 +50,7 @@
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "2a5ceff981501cff8f46871d5402cd3378a8ab6a" },
|
||||
"telescope-glyph.nvim": { "branch": "master", "commit": "f63f01e129e71cc25b79637610674bbf0be5ce9d" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "78857db9e8d819d3cc1a9a7bdc1d39d127a36495" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
local map = vim.keymap.set
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local notify = require("notify")
|
||||
local dsplit = require("util.open-docs-in-split")
|
||||
|
||||
local function term_factory(cfg)
|
||||
cfg["on_stderr"] = function(_, job, data, name)
|
||||
notify(name .. " encountered an error on job: " .. job .. "\nData: " .. data)
|
||||
end
|
||||
cfg["on_stdout"] = function(_, job, data, name)
|
||||
notify(name .. " output for job" .. job .. "\nData: " .. data)
|
||||
end
|
||||
return Terminal:new(cfg)
|
||||
cfg["on_stderr"] = function(_, job, data, name)
|
||||
notify(name .. " encountered an error on job: " .. job .. "\nData: " .. data, "error")
|
||||
end
|
||||
cfg["on_stdout"] = function(_, job, data, name)
|
||||
notify(name .. " output for job" .. job .. "\nData: " .. data, "info")
|
||||
end
|
||||
return Terminal:new(cfg)
|
||||
end
|
||||
|
||||
local function term_toggle(term)
|
||||
term:toggle()
|
||||
term:toggle()
|
||||
end
|
||||
|
||||
local opts = { silent = true, noremap = true }
|
||||
local notsilent = { silent = false, noremap = true }
|
||||
|
||||
local function ReloadConfig()
|
||||
dofile(vim.fn.stdpath("config") .. "/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/keymaps.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/autocmds.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/options.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/plugins.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/toggleterm.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ai/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/lsp/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/colorscheme/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/keymaps.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/autocmds.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/options.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/core/plugins.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/toggleterm.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ai/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/lsp/init.lua")
|
||||
dofile(vim.fn.stdpath("config") .. "/lua/plugins/colorscheme/init.lua")
|
||||
end
|
||||
|
||||
-- Leader key
|
||||
@@ -47,8 +48,8 @@ vim.api.nvim_create_user_command("Keymaps", "edit ~/.config/nvim/lua/core/keymap
|
||||
map("n", "<C-u>", "<C-u>zz", opts)
|
||||
map("n", "n", "nzzzv", opts)
|
||||
map("n", "N", "Nzzzv", opts)
|
||||
map("x", "<leader>p", '"_dP', opts) -- paste without yanking
|
||||
map("v", "<", "<gv", opts) -- reselect after indent
|
||||
map("x", "<leader>p", '"_dP', opts) -- paste without yanking
|
||||
map("v", "<", "<gv", opts) -- reselect after indent
|
||||
map("v", ">", ">gv", opts)
|
||||
map("v", "J", ":m '>+1<CR>gv=gv", opts) -- move lines
|
||||
map("v", "K", ":m '<-2<CR>gv=gv", opts)
|
||||
@@ -66,18 +67,18 @@ map("n", "<leader>bp", ":bprev<CR>", opts)
|
||||
--{{{ Terminal mappings
|
||||
|
||||
local programs_map = {
|
||||
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true },
|
||||
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true },
|
||||
oP = { cmd = "ipython", display_name = "ipython-full", direction = "tab", hidden = true },
|
||||
on = { cmd = "ncmpcpp", display_name = "ncmpcpp", direction = "tab", hidden = true },
|
||||
ob = { cmd = "btop", display_name = "btop", direction = "tab", hidden = true },
|
||||
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true },
|
||||
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true },
|
||||
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true },
|
||||
oP = { cmd = "ipython", display_name = "ipython-full", direction = "tab", hidden = true },
|
||||
on = { cmd = "ncmpcpp", display_name = "ncmpcpp", direction = "tab", hidden = true },
|
||||
ob = { cmd = "btop", display_name = "btop", direction = "tab", hidden = true },
|
||||
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true },
|
||||
}
|
||||
|
||||
for key, value in pairs(programs_map) do
|
||||
map("n", "<leader>" .. key, function()
|
||||
term_toggle(term_factory(value))
|
||||
end, opts)
|
||||
map("n", "<leader>" .. key, function()
|
||||
term_toggle(term_factory(value))
|
||||
end, opts)
|
||||
end
|
||||
|
||||
map("v", "op", "<C-\\><C-N>:ToggleTerm name=ipython")
|
||||
@@ -98,10 +99,10 @@ map("n", "<leader>-", ":ToggleTerm direction='horizontal'<CR>", opts)
|
||||
map("n", "<leader>|", ":ToggleTerm direction='vertical'<CR>", opts)
|
||||
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { buffer = 0 }
|
||||
map("t", "<esc>", [[<C-\><C-n>]], opts)
|
||||
map("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
||||
-- map("t", "<space>", "<space>", { buffer = 0, silent = true }) -- fix space in terminal
|
||||
local opts = { buffer = 0 }
|
||||
map("t", "<esc>", [[<C-\><C-n>]], opts)
|
||||
map("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
||||
-- map("t", "<space>", "<space>", { buffer = 0, silent = true }) -- fix space in terminal
|
||||
end
|
||||
|
||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||
@@ -122,6 +123,7 @@ map("n", "gl", vim.lsp.codelens.run, opts)
|
||||
map("n", "gr", ":Telescope lsp_references<CR>", opts)
|
||||
map("n", "gs", vim.lsp.buf.signature_help, opts)
|
||||
map("n", "K", vim.lsp.buf.hover, opts)
|
||||
map("n", "<leader>kv", dsplit, opts)
|
||||
map("n", "<leader>cd", ":Telescope lsp_definitions<CR>")
|
||||
map("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
map("n", "<leader>cci", ":Telescope lsp_incoming_calls<CR>")
|
||||
@@ -133,11 +135,12 @@ map("n", "<leader>cR", ":lua vim.lsp.buf.rename()<CR>")
|
||||
map("n", "<leader>cs", ":Telescope lsp_document_symbols<CR>")
|
||||
map("n", "<leader>ct", ":Telescope lsp_type_definitions<CR>")
|
||||
map("n", "<leader>cw", ":Telescope lsp_dynamic_workspace_symbols<CR>")
|
||||
map("n", "<leader>cd", ":Telescope diagnostics<CR>")
|
||||
map("n", "<leader>cDs", ":Telescope diagnostics<CR>")
|
||||
map("n", "<leader>cd", ":Telescope diagnostics theme=dropdown layout_config={width=0.8}<CR>")
|
||||
map("n", "<leader>cDs", ":Telescope diagnostics theme=dropdown layout_config={width=0.8}<CR>")
|
||||
map("n", "<leader>cDn", ":lua vim.diagnostic.goto_next()<CR>")
|
||||
map("n", "<leader>cDp", ":lua vim.diagnostic.goto_prev()<CR<CR>")
|
||||
map("n", "<leader>cl", ":lua vim.diagnostic.setloclist()<CR>")
|
||||
map("n", "<leader>cH", open_doc_in_vsplit, opts)
|
||||
--}}}
|
||||
|
||||
--{{{ Code Companion and Copilot
|
||||
@@ -157,30 +160,43 @@ map("v", "<leader>Ct", ":CodeCompanion /tests<CR>", notsilent)
|
||||
|
||||
--{{{ Telescope mappings
|
||||
-- {{{ Telescope Finders
|
||||
map("n", "//", ":Telescope current_buffer_fuzzy_find<CR>", opts)
|
||||
map("n", "??", ":Telescope lsp_document_symbols<CR>", opts)
|
||||
map("n", "//", ":Telescope current_buffer_fuzzy_find previewer=false<CR>", opts)
|
||||
map("n", "??", ":Telescope lsp_document_symbols theme=dropdown layout_config={width=0.5}<CR>", opts)
|
||||
map(
|
||||
"n",
|
||||
"<leader>fc",
|
||||
':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
"n",
|
||||
"<leader>fc",
|
||||
':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
)
|
||||
-- map('n', '<leader>ob', ':Telescope file_browser<CR>')
|
||||
map(
|
||||
"n",
|
||||
"<leader>ff",
|
||||
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
|
||||
opts
|
||||
"n",
|
||||
"<leader>Tc",
|
||||
':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
)
|
||||
map("n", "<leader>Tn", ":Telescope notify theme=dropdown layout_config={width=0.75}<CR>", opts)
|
||||
|
||||
map(
|
||||
"n",
|
||||
"<leader>ff",
|
||||
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
|
||||
opts
|
||||
)
|
||||
map("n", "<leader>fg", ":Telescope live_grep<CR>", opts)
|
||||
map(
|
||||
"n",
|
||||
"<leader>fG",
|
||||
':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
"n",
|
||||
"<leader>Tg",
|
||||
':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
)
|
||||
map(
|
||||
"n",
|
||||
"<leader>fG",
|
||||
':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
|
||||
opts
|
||||
)
|
||||
map("n", "<leader>fb", ":Telescope file_browser<CR>", opts)
|
||||
map("n", "<leader>fr", ":Telescope oldfiles<CR>", opts)
|
||||
map("n", "<leader>fr", ":Telescope oldfiles theme=dropdown layout_config={width=0.5}<CR>", opts)
|
||||
-- }}}
|
||||
|
||||
--{{{ Telescope Help
|
||||
@@ -188,15 +204,15 @@ map("n", "<leader>hc", ":Telescope commands<CR>")
|
||||
map("n", "<leader>hv", ":Telescope vim_options<CR>")
|
||||
map("n", "<leader>hk", ":Telescope keymaps<CR>")
|
||||
map("n", "<leader>hs", ":Telescope spell_suggest<CR>")
|
||||
map("n", "<leader>hm", ":Telescope man_pages<CR>")
|
||||
map("n", "<leader>hm", ":Telescope man_pages theme=dropdown layout_config={width=0.75}<CR>")
|
||||
--}}}
|
||||
|
||||
--{{{ Telescope Search
|
||||
map(
|
||||
"n",
|
||||
"<leader>sf",
|
||||
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
|
||||
opts
|
||||
"n",
|
||||
"<leader>sf",
|
||||
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
|
||||
opts
|
||||
)
|
||||
map("n", "<leader>sF", ":Telescope fidget<CR>")
|
||||
map("n", "<leader>sg", ":Telescope live_grep<CR>")
|
||||
@@ -210,6 +226,8 @@ map("n", "<leader>gc", ":Telescope git_commits<CR>", opts)
|
||||
map("n", "<leader>gf", ":Telescope git_files<CR>", opts)
|
||||
--}}}
|
||||
|
||||
map("n", "<leader>Tr", ":Telescope reloader<CR>", opts)
|
||||
|
||||
map("n", "Q", ":Telescope cmdline<CR>", opts)
|
||||
map("n", "<leader><leader>", ":Telescope cmdline<CR>", opts)
|
||||
--}}}
|
||||
@@ -236,6 +254,6 @@ map("n", "gpi", ':lua require("goto-preview").goto_preview_implementation()<CR>'
|
||||
map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
map("n", "<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
--}}}
|
||||
|
||||
@@ -86,13 +86,19 @@ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
||||
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])
|
||||
vim.lsp.handlers["window/showMessage"] = function(err, result, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
local lvl = ({
|
||||
"ERROR",
|
||||
"WARN",
|
||||
"INFO",
|
||||
"DEBUG",
|
||||
})[result.type]
|
||||
vim.notify("LSP Message: " .. result.message, lvl, {
|
||||
title = "LSP | " .. client.name,
|
||||
timeout = 5000,
|
||||
keep = function()
|
||||
return lvl == "ERROR" or lvl == "WARN"
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -63,17 +63,6 @@ local border = {
|
||||
{ "│", "FloatBorder" },
|
||||
}
|
||||
|
||||
-- set border for floating windows and signature help
|
||||
l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||
l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||
|
||||
-- lsp status
|
||||
-- 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
|
||||
|
||||
@@ -6,3 +6,4 @@ ts.load_extension("color_names")
|
||||
ts.load_extension("cmdline")
|
||||
ts.load_extension("file_browser")
|
||||
ts.load_extension("codecompanion")
|
||||
ts.load_extension("ui-select")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local notify = require("notify")
|
||||
local spinner_frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
local M = {}
|
||||
local timeout = 3000
|
||||
|
||||
function M:init()
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {})
|
||||
@@ -75,11 +76,11 @@ end
|
||||
function M:report_exit_status(handle, request)
|
||||
local title = handle.title or (" Requesting assistance (" .. request.data.strategy .. ")")
|
||||
if request.data.status == "success" then
|
||||
notify("Completed", "info", { replace = handle.notification_id, title = title })
|
||||
notify("Completed", "info", { replace = handle.notification_id, title = title, timeout = timeout })
|
||||
elseif request.data.status == "error" then
|
||||
notify(" Error", "error", { replace = handle.notification_id, title = title })
|
||||
notify(" Error", "error", { replace = handle.notification_id, title = title, timeout = timeout })
|
||||
else
|
||||
notify(" Cancelled", "warn", { replace = handle.notification_id, title = title })
|
||||
notify(" Cancelled", "warn", { replace = handle.notification_id, title = title, timeout = timeout })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
local M = require("lualine.component"):extend()
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
local M = require("lualine.component"):extend()
|
||||
|
||||
M.processing = false
|
||||
M.spinner_index = 1
|
||||
M.processing = false
|
||||
M.spinner_index = 1
|
||||
|
||||
local spinner_symbols = {
|
||||
"⠋",
|
||||
"⠙",
|
||||
"⠹",
|
||||
"⠸",
|
||||
"⠼",
|
||||
"⠴",
|
||||
"⠦",
|
||||
"⠧",
|
||||
"⠇",
|
||||
"⠏",
|
||||
}
|
||||
local spinner_symbols_len = 10
|
||||
local spinner_symbols = {
|
||||
"⠋",
|
||||
"⠙",
|
||||
"⠹",
|
||||
"⠸",
|
||||
"⠼",
|
||||
"⠴",
|
||||
"⠦",
|
||||
"⠧",
|
||||
"⠇",
|
||||
"⠏",
|
||||
}
|
||||
local spinner_symbols_len = 10
|
||||
|
||||
-- Initializer
|
||||
function M:init(options)
|
||||
M.super.init(self, options)
|
||||
-- Initializer
|
||||
function M:init(options)
|
||||
M.super.init(self, options)
|
||||
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionRequest*",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
if request.match == "CodeCompanionRequestStarted" then
|
||||
self.processing = true
|
||||
elseif request.match == "CodeCompanionRequestFinished" then
|
||||
self.processing = false
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionRequest*",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
if request.match == "CodeCompanionRequestStarted" then
|
||||
self.processing = true
|
||||
elseif request.match == "CodeCompanionRequestFinished" then
|
||||
self.processing = false
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Function that runs every time statusline is updated
|
||||
function M:update_status()
|
||||
if self.processing then
|
||||
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1
|
||||
return spinner_symbols[self.spinner_index]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
-- Function that runs every time statusline is updated
|
||||
function M:update_status()
|
||||
if self.processing then
|
||||
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1
|
||||
return spinner_symbols[self.spinner_index]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "catppuccin",
|
||||
-- theme = 'dracula',
|
||||
-- theme = 'horizon',
|
||||
-- theme = 'onedark',
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {
|
||||
M,
|
||||
{
|
||||
"copilot",
|
||||
symbols = {
|
||||
status = {
|
||||
icons = {
|
||||
enabled = " ",
|
||||
sleep = " ", -- auto-trigger disabled
|
||||
disabled = " ",
|
||||
warning = " ",
|
||||
unknown = " ",
|
||||
},
|
||||
hl = {
|
||||
enabled = "#50FA7B",
|
||||
sleep = "#AEB7D0",
|
||||
disabled = "#6272A4",
|
||||
warning = "#FFB86C",
|
||||
unknown = "#FF5555",
|
||||
},
|
||||
},
|
||||
spinners = "dots", -- has some premade spinners
|
||||
spinner_color = "#6272A4",
|
||||
},
|
||||
show_colors = false,
|
||||
show_loading = true,
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "", -- e712
|
||||
dos = "", -- e70f
|
||||
mac = "", -- e711
|
||||
},
|
||||
},
|
||||
"encoding",
|
||||
"fileformat",
|
||||
{ "filetype", colored = true, icon_only = false },
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true, -- Displays file status (readonly status, modified status)
|
||||
path = 0, -- 0: Just the filename
|
||||
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
|
||||
symbols = {
|
||||
modified = "[+]", -- Text to show when the file is modified.
|
||||
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
|
||||
unnamed = "[No Name]", -- Text to show for unnamed buffers.
|
||||
},
|
||||
},
|
||||
M,
|
||||
},
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" },
|
||||
})
|
||||
end,
|
||||
depends = { "kyazdani42/nvim-web-devicons" },
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "catppuccin",
|
||||
-- theme = 'dracula',
|
||||
-- theme = 'horizon',
|
||||
-- theme = 'onedark',
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {
|
||||
M,
|
||||
{
|
||||
"copilot",
|
||||
symbols = {
|
||||
status = {
|
||||
icons = {
|
||||
enabled = " ",
|
||||
sleep = " ", -- auto-trigger disabled
|
||||
disabled = " ",
|
||||
warning = " ",
|
||||
unknown = " ",
|
||||
},
|
||||
hl = {
|
||||
enabled = "#50FA7B",
|
||||
sleep = "#AEB7D0",
|
||||
disabled = "#6272A4",
|
||||
warning = "#FFB86C",
|
||||
unknown = "#FF5555",
|
||||
},
|
||||
},
|
||||
spinners = "dots", -- has some premade spinners
|
||||
spinner_color = "#6272A4",
|
||||
},
|
||||
show_colors = true,
|
||||
show_loading = true,
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "", -- e712
|
||||
dos = "", -- e70f
|
||||
mac = "", -- e711
|
||||
},
|
||||
},
|
||||
"encoding",
|
||||
"fileformat",
|
||||
{ "filetype", colored = true, icon_only = false },
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true, -- Displays file status (readonly status, modified status)
|
||||
path = 0, -- 0: Just the filename
|
||||
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
|
||||
symbols = {
|
||||
modified = "[+]", -- Text to show when the file is modified.
|
||||
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
|
||||
unnamed = "[No Name]", -- Text to show for unnamed buffers.
|
||||
},
|
||||
},
|
||||
M,
|
||||
},
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" },
|
||||
})
|
||||
end,
|
||||
depends = { "kyazdani42/nvim-web-devicons" },
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ return {
|
||||
"nat-418/telescope-color-names.nvim",
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
"ghassan0/telescope-glyph.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release",
|
||||
@@ -40,6 +41,7 @@ return {
|
||||
-- actions.which_key shows the mappings for your picker,
|
||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
["<C-h>"] = "which_key",
|
||||
["<C-u"] = false,
|
||||
},
|
||||
},
|
||||
file_ignore_patterns = { "^node_modules/", "^env/", "^__pycache__/" },
|
||||
@@ -106,6 +108,15 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
width = 0.5,
|
||||
prompt = " ",
|
||||
results_height = 15,
|
||||
previewer = true,
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
44
lua/util/open-docs-in-split.lua
Normal file
44
lua/util/open-docs-in-split.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
function open_doc_in_vsplit()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
if word == "" then
|
||||
vim.notify("No word under cursor", vim.log.levels.INFO)
|
||||
return
|
||||
end
|
||||
|
||||
-- Try to get LSP hover documentation
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
local results = vim.lsp.buf_request_sync(0, "textDocument/hover", params, 1000) or {}
|
||||
local doc_lines = nil
|
||||
|
||||
for _, res in pairs(results) do
|
||||
local contents = res.result and res.result.contents
|
||||
if contents then
|
||||
doc_lines = vim.lsp.util.convert_input_to_markdown_lines(contents)
|
||||
doc_lines = vim.lsp.util.trim_empty_lines(doc_lines)
|
||||
if #doc_lines > 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if doc_lines and #doc_lines > 0 then
|
||||
-- Open a new vertical split for LSP hover documentation
|
||||
vim.cmd("vnew")
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
-- Set the buffer to unmodifiable scratch buffer
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, doc_lines)
|
||||
vim.bo[bufnr].modifiable = false
|
||||
vim.bo[bufnr].bufhidden = "wipe"
|
||||
vim.bo[bufnr].filetype = "markdown"
|
||||
return
|
||||
end
|
||||
|
||||
-- Fallback to vim help command
|
||||
local help_cmd = "vertical help " .. word
|
||||
local ok, _ = pcall(vim.cmd, help_cmd)
|
||||
if not ok then
|
||||
vim.notify("No documentation available for '" .. word .. "'", vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
|
||||
return open_doc_in_vsplit
|
||||
Reference in New Issue
Block a user