updates and new features
This commit is contained in:
parent
2cec265833
commit
2f4d3c23dc
13 changed files with 202 additions and 6 deletions
4
init.lua
4
init.lua
|
@ -2,6 +2,7 @@ require("user.options")
|
|||
require("user.keymaps")
|
||||
require("user.plugins")
|
||||
require("user.notify")
|
||||
require("user.navic")
|
||||
require("user.cmp")
|
||||
require("user.lsp")
|
||||
require("user.colorscheme")
|
||||
|
@ -26,3 +27,6 @@ require("user.spectre")
|
|||
require("user.dap")
|
||||
require("user.copilot")
|
||||
require("user.dressing")
|
||||
require("user.cybu")
|
||||
require("user.autocommands")
|
||||
require("user.gps")
|
||||
|
|
|
@ -21,7 +21,7 @@ bufferline.setup({
|
|||
tab_size = 21,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = true,
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
offsets = { { filetype = "NvimTree", text = "" } },
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
|
|
24
lua/user/cybu.lua
Normal file
24
lua/user/cybu.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local ok, cybu = pcall(require, "cybu")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
cybu.setup({
|
||||
display_time = 1750, -- time the cybu window is displayed
|
||||
style = {
|
||||
path = "relative", -- absolute, relative, tail (filename only)
|
||||
border = "rounded", -- single, double, rounded, none
|
||||
separator = " ", -- string used as separator
|
||||
prefix = "…", -- string used as prefix for truncated paths
|
||||
padding = 1, -- left & right padding in number of spaces
|
||||
hide_buffer_id = true,
|
||||
devicons = {
|
||||
enabled = true, -- enable or disable web dev icons
|
||||
colored = true, -- enable color for web dev icons
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<s-tab>", "<Plug>(CybuPrev)")
|
||||
vim.keymap.set("n", "<tab>", "<Plug>(CybuNext)")
|
||||
vim.keymap.set("n", "<c-i>", "<c-i>")
|
|
@ -3,10 +3,10 @@ if not dapui_status_ok then
|
|||
return
|
||||
end
|
||||
|
||||
local vtest_status_ok, vtest = pcall(require, "nvim-dap-virtual-text")
|
||||
if not vtest_status_ok then
|
||||
local vtext_status_ok, vtext = pcall(require, "nvim-dap-virtual-text")
|
||||
if not vtext_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapui.setup()
|
||||
vtest.setup()
|
||||
vtext.setup()
|
||||
|
|
33
lua/user/gps.lua
Normal file
33
lua/user/gps.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
local status_ok, gps = pcall(require, "nvim-gps")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
gps.setup({
|
||||
icons = {
|
||||
["class-name"] = " ",
|
||||
["function-name"] = " ",
|
||||
["method-name"] = " ",
|
||||
["container-name"] = "⛶ ",
|
||||
["tag-name"] = "炙 ",
|
||||
["mapping-name"] = " ",
|
||||
["sequence-name"] = " ",
|
||||
["null-name"] = "[] ",
|
||||
["boolean-name"] = "ﰰﰴ ",
|
||||
["integer-name"] = "# ",
|
||||
["float-name"] = " ",
|
||||
["string-name"] = " ",
|
||||
["array-name"] = " ",
|
||||
["object-name"] = " ",
|
||||
["number-name"] = "# ",
|
||||
["table-name"] = " ",
|
||||
["date-name"] = " ",
|
||||
["date-time-name"] = " ",
|
||||
["inline-table-name"] = " ",
|
||||
["time-name"] = " ",
|
||||
["module-name"] = " ",
|
||||
},
|
||||
separator = " > ",
|
||||
depth = 0,
|
||||
depth_limit_indicator = "..",
|
||||
})
|
|
@ -70,7 +70,7 @@ keymap("n", "<leader>duh", ":lua require('dap.ui.widgets').hover()<CR>", opts)
|
|||
keymap(
|
||||
"n",
|
||||
"<leader>duf",
|
||||
":lua local widgets=require('dap.ui.widgets');widgets.centered_float(widgets.scopes)<CR>",
|
||||
":lua local widgets=require('dap.ui.widgets').widgets.centered_float(widgets.scopes)<CR>",
|
||||
opts
|
||||
)
|
||||
keymap("n", "<leader>dro", ":lua require('dap').repl.open()<CR>", opts)
|
||||
|
|
|
@ -41,6 +41,15 @@ M.setup = function()
|
|||
})
|
||||
end
|
||||
|
||||
local function attach_navic(client, bufnr)
|
||||
vim.g.navic_silence = false
|
||||
local status_ok, navic = pcall(require, "nvim-navic")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
|
||||
local function lsp_highlight_document(client)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
|
@ -68,6 +77,7 @@ end
|
|||
M.on_attach = function(client, bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
lsp_highlight_document(client)
|
||||
attach_navic(client, bufnr)
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
|
|
@ -13,7 +13,6 @@ null_ls.setup({
|
|||
formatting.stylua,
|
||||
code_actions.eslint_d,
|
||||
diagnostics.eslint_d,
|
||||
diagnostics.cspell,
|
||||
formatting.eslint_d,
|
||||
},
|
||||
on_attach = function(client)
|
||||
|
|
|
@ -34,5 +34,6 @@ lualine.setup({
|
|||
"toggleterm",
|
||||
"fzf",
|
||||
"quickfix",
|
||||
"nvim-dap-ui",
|
||||
},
|
||||
})
|
||||
|
|
34
lua/user/navic.lua
Normal file
34
lua/user/navic.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local status_ok, navic = pcall(require, "nvim-navic")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
navic.setup({
|
||||
icons = {
|
||||
["class-name"] = " ",
|
||||
["function-name"] = " ",
|
||||
["method-name"] = " ",
|
||||
["container-name"] = "⛶ ",
|
||||
["tag-name"] = "炙 ",
|
||||
["mapping-name"] = " ",
|
||||
["sequence-name"] = " ",
|
||||
["null-name"] = "[] ",
|
||||
["boolean-name"] = "ﰰﰴ ",
|
||||
["integer-name"] = "# ",
|
||||
["float-name"] = " ",
|
||||
["string-name"] = " ",
|
||||
["array-name"] = " ",
|
||||
["object-name"] = " ",
|
||||
["number-name"] = "# ",
|
||||
["table-name"] = " ",
|
||||
["date-name"] = " ",
|
||||
["date-time-name"] = " ",
|
||||
["inline-table-name"] = " ",
|
||||
["time-name"] = " ",
|
||||
["module-name"] = " ",
|
||||
},
|
||||
highlight = true,
|
||||
separator = " > ",
|
||||
depth_limit = 0,
|
||||
depth_limit_indicator = "..",
|
||||
})
|
|
@ -36,6 +36,7 @@ vim.opt.incsearch = true
|
|||
vim.opt.colorcolumn = "120"
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars:append("lead:.")
|
||||
vim.opt.winbar = "%{%v:lua.require'user.winbar'.get_winbar()%}"
|
||||
|
||||
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
||||
vim.cmd([[set iskeyword+=-]])
|
||||
|
|
|
@ -74,6 +74,7 @@ return packer.startup(function(use)
|
|||
use("onsails/lspkind.nvim")
|
||||
use("glepnir/lspsaga.nvim")
|
||||
use("Maan2003/lsp_lines.nvim")
|
||||
use("SmiteshP/nvim-navic")
|
||||
|
||||
-- Telescope
|
||||
use("nvim-telescope/telescope.nvim")
|
||||
|
@ -84,6 +85,7 @@ return packer.startup(function(use)
|
|||
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
|
||||
use("p00f/nvim-ts-rainbow")
|
||||
use("JoosepAlviste/nvim-ts-context-commentstring")
|
||||
use("SmiteshP/nvim-gps")
|
||||
|
||||
-- Autopairs
|
||||
use("windwp/nvim-autopairs")
|
||||
|
@ -155,6 +157,7 @@ return packer.startup(function(use)
|
|||
|
||||
-- UI
|
||||
use("stevearc/dressing.nvim")
|
||||
use("ghillb/cybu.nvim")
|
||||
|
||||
-- Undo Tree
|
||||
use("mbbill/undotree")
|
||||
|
|
87
lua/user/winbar.lua
Normal file
87
lua/user/winbar.lua
Normal file
|
@ -0,0 +1,87 @@
|
|||
local M = {}
|
||||
|
||||
local navic = require("nvim-navic")
|
||||
local gps = require("nvim-gps")
|
||||
|
||||
local function is_empty(s)
|
||||
return s == nil or s == ""
|
||||
end
|
||||
|
||||
M.winbar_filetype_exclude = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
}
|
||||
|
||||
local excludes = function()
|
||||
if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then
|
||||
vim.opt_local.winbar = nil
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function get_filename()
|
||||
return "%#WinBarFilename#" .. "%t" .. "%*"
|
||||
end
|
||||
|
||||
local function get_location()
|
||||
local location = navic.get_location()
|
||||
local gps_location = gps.get_location()
|
||||
|
||||
if not is_empty(location) then
|
||||
return "%#WinBarContext#" .. " " .. ">" .. " " .. location .. "%*"
|
||||
elseif not is_empty(gps_location) then
|
||||
return "%#WinBarContext#" .. " " .. ">" .. " " .. gps_location .. "%*"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function get_fileicon()
|
||||
local hl_winbar_file_icon = "WinBarFileIcon"
|
||||
local file_path = vim.fn.expand("%:~:.:h")
|
||||
local filename = vim.fn.expand("%:t")
|
||||
local file_type = vim.fn.expand("%:e")
|
||||
local file_icon = ""
|
||||
local file_icon_color = ""
|
||||
|
||||
file_path = file_path:gsub("^%.", "")
|
||||
file_path = file_path:gsub("^%/", "")
|
||||
|
||||
if not is_empty(filename) then
|
||||
local default = false
|
||||
|
||||
if is_empty(file_type) then
|
||||
file_type = ""
|
||||
default = true
|
||||
end
|
||||
file_icon, file_icon_color =
|
||||
require("nvim-web-devicons").get_icon_color(filename, file_type, { default = default })
|
||||
vim.api.nvim_set_hl(0, hl_winbar_file_icon, { fg = file_icon_color })
|
||||
end
|
||||
|
||||
return "%#WinBarContext#" .. "%#" .. hl_winbar_file_icon .. "#" .. file_icon .. " " .. "%*"
|
||||
end
|
||||
|
||||
function M.get_winbar()
|
||||
if excludes() then
|
||||
return ""
|
||||
end
|
||||
if navic.is_available() then
|
||||
return get_fileicon() .. get_filename() .. get_location()
|
||||
else
|
||||
return get_fileicon() .. get_filename()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
Reference in a new issue