Archived
0
0
Fork 0

updates and new features

This commit is contained in:
Daryl Ronningen 2022-07-17 16:36:31 -07:00
parent 2cec265833
commit 2f4d3c23dc
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
13 changed files with 202 additions and 6 deletions

View file

@ -2,6 +2,7 @@ require("user.options")
require("user.keymaps") require("user.keymaps")
require("user.plugins") require("user.plugins")
require("user.notify") require("user.notify")
require("user.navic")
require("user.cmp") require("user.cmp")
require("user.lsp") require("user.lsp")
require("user.colorscheme") require("user.colorscheme")
@ -26,3 +27,6 @@ require("user.spectre")
require("user.dap") require("user.dap")
require("user.copilot") require("user.copilot")
require("user.dressing") require("user.dressing")
require("user.cybu")
require("user.autocommands")
require("user.gps")

View file

@ -21,7 +21,7 @@ bufferline.setup({
tab_size = 21, tab_size = 21,
diagnostics = "nvim_lsp", diagnostics = "nvim_lsp",
diagnostics_update_in_insert = true, diagnostics_update_in_insert = true,
offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, offsets = { { filetype = "NvimTree", text = "" } },
show_buffer_icons = true, show_buffer_icons = true,
show_buffer_close_icons = true, show_buffer_close_icons = true,
show_close_icon = true, show_close_icon = true,

24
lua/user/cybu.lua Normal file
View 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>")

View file

@ -3,10 +3,10 @@ if not dapui_status_ok then
return return
end end
local vtest_status_ok, vtest = pcall(require, "nvim-dap-virtual-text") local vtext_status_ok, vtext = pcall(require, "nvim-dap-virtual-text")
if not vtest_status_ok then if not vtext_status_ok then
return return
end end
dapui.setup() dapui.setup()
vtest.setup() vtext.setup()

33
lua/user/gps.lua Normal file
View 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 = "..",
})

View file

@ -70,7 +70,7 @@ keymap("n", "<leader>duh", ":lua require('dap.ui.widgets').hover()<CR>", opts)
keymap( keymap(
"n", "n",
"<leader>duf", "<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 opts
) )
keymap("n", "<leader>dro", ":lua require('dap').repl.open()<CR>", opts) keymap("n", "<leader>dro", ":lua require('dap').repl.open()<CR>", opts)

View file

@ -41,6 +41,15 @@ M.setup = function()
}) })
end 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 function lsp_highlight_document(client)
local status_ok, illuminate = pcall(require, "illuminate") local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then if not status_ok then
@ -68,6 +77,7 @@ end
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
lsp_keymaps(bufnr) lsp_keymaps(bufnr)
lsp_highlight_document(client) lsp_highlight_document(client)
attach_navic(client, bufnr)
end end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()

View file

@ -13,7 +13,6 @@ null_ls.setup({
formatting.stylua, formatting.stylua,
code_actions.eslint_d, code_actions.eslint_d,
diagnostics.eslint_d, diagnostics.eslint_d,
diagnostics.cspell,
formatting.eslint_d, formatting.eslint_d,
}, },
on_attach = function(client) on_attach = function(client)

View file

@ -34,5 +34,6 @@ lualine.setup({
"toggleterm", "toggleterm",
"fzf", "fzf",
"quickfix", "quickfix",
"nvim-dap-ui",
}, },
}) })

34
lua/user/navic.lua Normal file
View 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 = "..",
})

View file

@ -36,6 +36,7 @@ vim.opt.incsearch = true
vim.opt.colorcolumn = "120" vim.opt.colorcolumn = "120"
vim.opt.list = true vim.opt.list = true
vim.opt.listchars:append("lead:.") vim.opt.listchars:append("lead:.")
vim.opt.winbar = "%{%v:lua.require'user.winbar'.get_winbar()%}"
vim.cmd("set whichwrap+=<,>,[,],h,l") vim.cmd("set whichwrap+=<,>,[,],h,l")
vim.cmd([[set iskeyword+=-]]) vim.cmd([[set iskeyword+=-]])

View file

@ -74,6 +74,7 @@ return packer.startup(function(use)
use("onsails/lspkind.nvim") use("onsails/lspkind.nvim")
use("glepnir/lspsaga.nvim") use("glepnir/lspsaga.nvim")
use("Maan2003/lsp_lines.nvim") use("Maan2003/lsp_lines.nvim")
use("SmiteshP/nvim-navic")
-- Telescope -- Telescope
use("nvim-telescope/telescope.nvim") use("nvim-telescope/telescope.nvim")
@ -84,6 +85,7 @@ return packer.startup(function(use)
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use("p00f/nvim-ts-rainbow") use("p00f/nvim-ts-rainbow")
use("JoosepAlviste/nvim-ts-context-commentstring") use("JoosepAlviste/nvim-ts-context-commentstring")
use("SmiteshP/nvim-gps")
-- Autopairs -- Autopairs
use("windwp/nvim-autopairs") use("windwp/nvim-autopairs")
@ -155,6 +157,7 @@ return packer.startup(function(use)
-- UI -- UI
use("stevearc/dressing.nvim") use("stevearc/dressing.nvim")
use("ghillb/cybu.nvim")
-- Undo Tree -- Undo Tree
use("mbbill/undotree") use("mbbill/undotree")

87
lua/user/winbar.lua Normal file
View 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