Quality of life enhancements like dark mode theme switching, reduced autocomplete noise, etc
This commit is contained in:
parent
09efe3c65b
commit
eb42127795
7
init.lua
7
init.lua
|
@ -5,11 +5,6 @@ vim.g.mapleader = ' '
|
|||
vim.g.maplocalleader = ' '
|
||||
|
||||
local preferred_border = vim.g.pref_border_style or 'single'
|
||||
local preferred_transparency = vim.g.pref_blend or 0
|
||||
local layer_theme = vim.g.pref_layer_colorscheme
|
||||
local alt_theme = "catppuccin-mocha"
|
||||
local theme_light = "tokyonight-day"
|
||||
local theme_dark = "retrobox"
|
||||
|
||||
-- [[ Setting options ]]
|
||||
require('custom.options')
|
||||
|
@ -157,6 +152,7 @@ require('lazy').setup({
|
|||
},
|
||||
},
|
||||
},
|
||||
-- { "polirritmico/telescope-lazy-plugins.nvim" },
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -212,6 +208,7 @@ require('telescope').setup {
|
|||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
-- pcall(require("telescope").load_extension, "lazy_plugins")
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
|
|
|
@ -1,202 +1,52 @@
|
|||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
local M = {}
|
||||
-- function to create a list of commands and convert them to autocommands
|
||||
-------- This function is taken from https://github.com/norcalli/nvim_utils
|
||||
function M.nvim_create_augroups(definitions)
|
||||
for group_name, definition in pairs(definitions) do
|
||||
api.nvim_command('augroup ' .. group_name)
|
||||
api.nvim_command('autocmd!')
|
||||
for _, def in ipairs(definition) do
|
||||
local command = table.concat(vim.tbl_flatten { 'autocmd', def }, ' ')
|
||||
api.nvim_command(command)
|
||||
end
|
||||
api.nvim_command('augroup END')
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_autogroups(definitions)
|
||||
for group_name, commands in pairs(definitions) do
|
||||
local group = api.nvim_create_augroup(group_name, { clear = false })
|
||||
|
||||
for _, def in ipairs(commands) do
|
||||
local events = def[1]
|
||||
local pattern = def[2]
|
||||
local cmd_or_callback = def[3]
|
||||
local desc = def[4] and def[4].desc
|
||||
local is_callback = type(cmd_or_callback) ~= 'string'
|
||||
local opts = {
|
||||
group = group,
|
||||
pattern = pattern,
|
||||
desc = desc,
|
||||
-- callback = is_callback and cmd_or_callback or nil,
|
||||
-- command = not is_callback and cmd_or_callback or nil,
|
||||
}
|
||||
|
||||
if is_callback then
|
||||
opts.callback = cmd_or_callback
|
||||
else
|
||||
opts.command = cmd_or_callback
|
||||
end
|
||||
|
||||
print(group_name, events, type(cmd_or_callback), 'is_callback', is_callback, vim.inspect(opts))
|
||||
api.nvim_create_autocmd(events, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local autoCommands = {
|
||||
open_folds = {
|
||||
{ "BufReadPost,FileReadPost", "*", "normal zR" }
|
||||
-- [[ Structired for legendary.nvim's opts.autocmds ]]
|
||||
-- https://github.com/mrjones2014/legendary.nvim/blob/HEAD/doc/table_structures/AUTOCMDS.md
|
||||
return {
|
||||
{
|
||||
{ "BufAdd", "BufEnter", "ModeChanged" },
|
||||
function()
|
||||
local hl = "Conceal"
|
||||
hl = "DiagnosticVirtualTextInfo"
|
||||
vim.api.nvim_set_hl(0, 'VirtColumn', { link = hl })
|
||||
end,
|
||||
desc = "Override virtcolumn.nvim's default HL group",
|
||||
opts = { pattern = "*.*" },
|
||||
},
|
||||
tabs = {
|
||||
-- [[ Sort tabs automatically ]]
|
||||
{ 'BufAdd', '*', vim.g.pref_tab_order },
|
||||
-- {
|
||||
-- 'BufAdd', '*',
|
||||
-- function()
|
||||
-- print('Sorting tabs by', vim.g.pref_autoformat)
|
||||
-- vim.cmd(vim.g.pref_tab_order or [[BufferOrderByDirectory]])
|
||||
-- end,
|
||||
-- { desc = 'Auto sort tabs by `vim.g.pref_tab_order`' },
|
||||
-- }
|
||||
{
|
||||
{ "TextYankPost" },
|
||||
vim.highlight.on_yank,
|
||||
desc = "Reselect text after yanking",
|
||||
opts = { pattern = "*" },
|
||||
},
|
||||
{
|
||||
{ "BufAdd" },
|
||||
vim.g.pref_tab_order,
|
||||
desc = "Sort tabs by " .. vim.g.pref_tab_order,
|
||||
opts = { pattern = "*" },
|
||||
},
|
||||
{
|
||||
-- https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close#marvinth01
|
||||
{ "QuitPre" },
|
||||
function()
|
||||
local tree_wins = {}
|
||||
local floating_wins = {}
|
||||
local wins = vim.api.nvim_list_wins()
|
||||
for _, w in ipairs(wins) do
|
||||
local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
|
||||
if bufname:match("NvimTree_") ~= nil then
|
||||
table.insert(tree_wins, w)
|
||||
end
|
||||
if vim.api.nvim_win_get_config(w).relative ~= '' then
|
||||
table.insert(floating_wins, w)
|
||||
end
|
||||
end
|
||||
if 1 == #wins - #floating_wins - #tree_wins then
|
||||
-- Should quit, so we close all invalid windows.
|
||||
for _, w in ipairs(tree_wins) do
|
||||
vim.api.nvim_win_close(w, true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = "Do something when quitting??",
|
||||
-- opts = {},
|
||||
},
|
||||
}
|
||||
|
||||
M.nvim_create_augroups(autoCommands)
|
||||
-- M.create_autogroups(autoCommands)
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ 'BufDelete' }, {
|
||||
-- pattern = "*",
|
||||
-- callback = function()
|
||||
-- local bufs = vim.api.nvim_list_bufs()
|
||||
-- local loaded_bufs = {}
|
||||
-- for _, buf in ipairs(bufs) do
|
||||
-- if vim.api.nvim_buf_is_loaded(buf) then
|
||||
-- loaded_bufs[#loaded_bufs + 1] = buf
|
||||
-- end
|
||||
-- end
|
||||
-- if #loaded_bufs == 0 then
|
||||
-- vim.cmd([[:lua MiniStarter.open()]])
|
||||
-- end
|
||||
-- print('Buffer closed', #loaded_bufs, #bufs)
|
||||
-- -- local bufnr = fn.bufnr('%')
|
||||
-- -- print('Deleting buffer ' .. bufnr)
|
||||
-- -- if fn.bufname('%') == '' then
|
||||
-- -- require('mini.starter').open()
|
||||
-- -- end
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "QuitPre" }, {
|
||||
-- https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close#marvinth01
|
||||
callback = function()
|
||||
local tree_wins = {}
|
||||
local floating_wins = {}
|
||||
local wins = vim.api.nvim_list_wins()
|
||||
for _, w in ipairs(wins) do
|
||||
local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
|
||||
if bufname:match("NvimTree_") ~= nil then
|
||||
table.insert(tree_wins, w)
|
||||
end
|
||||
if vim.api.nvim_win_get_config(w).relative ~= '' then
|
||||
table.insert(floating_wins, w)
|
||||
end
|
||||
end
|
||||
if 1 == #wins - #floating_wins - #tree_wins then
|
||||
-- Should quit, so we close all invalid windows.
|
||||
for _, w in ipairs(tree_wins) do
|
||||
vim.api.nvim_win_close(w, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
vim.cmd([[highlight OobleckRulers guifg=#181825]])
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'ModeChanged', 'TextChanged' }, {
|
||||
pattern = { '*XXX' },
|
||||
desc = 'Draw virtual text "rulers" like in VSCode instead of colorcolumn',
|
||||
callback = function(opts)
|
||||
vim.o.colorcolumn = nil
|
||||
-- https://jdhao.github.io/2021/09/09/nvim_use_virtual_text/
|
||||
-- local bufn = opts.buf
|
||||
local bnr = vim.fn.bufnr('%')
|
||||
local ns_id = api.nvim_create_namespace('rulers')
|
||||
local rulers = { 80, 120 }
|
||||
-- local col_char = "│"
|
||||
local col_char = "┊"
|
||||
-- local col_char = "╷";
|
||||
-- local col_char = "░"
|
||||
|
||||
-- or vim.api.nvim_buf_line_count(0)
|
||||
local buf_lines_count = vim.fn.line('$')
|
||||
|
||||
for line = 0, buf_lines_count do
|
||||
for _, col_num in ipairs(rulers) do
|
||||
local opts = {
|
||||
id = (line * 1000) + col_num,
|
||||
virt_text_win_col = col_num,
|
||||
virt_text_hide = true,
|
||||
hl_mode = 'combine',
|
||||
-- hl_group = "ColorColumn",
|
||||
-- OobleckRulers Delimiter NonText Comment
|
||||
virt_text = { { col_char, { "Comment" } } },
|
||||
virt_text_pos = 'overlay',
|
||||
-- conceal = col_char,
|
||||
ui_watched = true,
|
||||
priority = 1,
|
||||
}
|
||||
|
||||
vim.api.nvim_buf_set_extmark(bnr, ns_id, line, 0, opts)
|
||||
end
|
||||
end
|
||||
|
||||
-- nvim_buf_del_extmark(bnr, ns_id, id)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
local general_auto_group = api.nvim_create_augroup('GenrealAutoStuff', { clear = false })
|
||||
vim.cmd([[
|
||||
" BufferCurrentERROR
|
||||
hi oobERROR guibg=DarkRed guifg=White
|
||||
hi oobWARN guibg=Gold guifg=White
|
||||
hi oobINFO guibg=LightBlue guifg=White
|
||||
hi oobHINT guibg=DarkCyan guifg=White
|
||||
]])
|
||||
api.nvim_create_autocmd({ 'BufEnter', 'ModeChanged' }, {
|
||||
pattern = { '*.*' },
|
||||
-- TODO: THings
|
||||
-- TODO (Spencer) - THings
|
||||
-- NOTE: THis is a note
|
||||
-- FIX: Fix This
|
||||
-- FIXME: Fix this
|
||||
-- BUG: There is a vbug in this highlighting?
|
||||
-- WARNING: THis is a warning
|
||||
-- WARN (spencer): this is a warning
|
||||
desc = "General auto run stuff that doesn't really need a discrete AutoCmd",
|
||||
group = general_auto_group,
|
||||
callback = function()
|
||||
vim.cmd([[
|
||||
" syntax match OobleckTODO /(?<=^[\W\s]+)(TODO|FIXME|BUG).*[:\-]/
|
||||
" syntax match OobleckWARN /(?<=^[\W\s]+)WARN.*[:\-]/
|
||||
" syntax match OobleckNOTE /(?<=^[\W\s]+)NOTE.*[:\-]/
|
||||
|
||||
syntax match oobERROR /\v<((FIX[ME]{0,2}|BUG|XXX))/ containedin=.*[Cc]omment
|
||||
syntax match oobWARN /\v<((WARN[ING]{0,3}))/ containedin=.*[Cc]omment
|
||||
syntax match oobHINT /\v<((NOTE))/ containedin=.*[Cc]omment
|
||||
syntax match oobINFO /\v<((TODO))/ containedin=.*[Cc]omment
|
||||
]])
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -57,4 +57,14 @@ return {
|
|||
Value = " ",
|
||||
Variable = " ",
|
||||
},
|
||||
modes = {
|
||||
insert = "✎",
|
||||
normal = "⦿",
|
||||
visual = "",
|
||||
select = "",
|
||||
["v-line"] = "",
|
||||
-- command = "˃:",
|
||||
command = "⌘",
|
||||
terminal = "˃ˍ",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -6,9 +6,14 @@ local globals = {
|
|||
pref_tab_order = 'BufferOrderByDirectory',
|
||||
pref_border_style = 'single',
|
||||
pref_blend = 0,
|
||||
-- pref_colorscheme = 'catppuccin',
|
||||
pref_colorscheme = 'nordic',
|
||||
pref_layer_colorscheme = 'gruvbox',
|
||||
-- pref_colorscheme_layers = 'nordic',
|
||||
pref_colorscheme_layers = "duskfox",
|
||||
-- pref_colorscheme_light = "catppuccin-latte",
|
||||
-- pref_colorscheme_dark = "retrobox",
|
||||
pref_colorscheme_light = "dawnfox",
|
||||
pref_colorscheme_dark = "terafox",
|
||||
pref_colorscheme = 'terafox',
|
||||
pref_colorscheme_alt = "nordfox",
|
||||
pref_autoformat = false,
|
||||
}
|
||||
|
||||
|
@ -43,8 +48,9 @@ local opts = {
|
|||
textwidth = 80,
|
||||
|
||||
-- Draw the column on the right side of the o.textwidth, not under it.
|
||||
colorcolumn = '80,120',
|
||||
-- colorcolumn = '81,121',
|
||||
colorcolumn = '+1,+41',
|
||||
-- colorcolumn = '+1,+41',
|
||||
-- Keep the current line vertically centered when scrolling or jumping in
|
||||
-- a buffer.
|
||||
scrolloff = 6,
|
||||
|
@ -52,6 +58,8 @@ local opts = {
|
|||
-- Code folding
|
||||
-- foldmethod = 'expr',
|
||||
-- foldexpr = 'nvim_treesitter#foldexpr()',
|
||||
|
||||
formatoptions = "ctqlwanjp",
|
||||
}
|
||||
|
||||
-- Set options from table
|
||||
|
|
|
@ -4,25 +4,26 @@ return {
|
|||
-- {
|
||||
-- -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-completion.md#default-config
|
||||
-- 'echasnovski/mini.completion',
|
||||
-- config = true,
|
||||
-- opts = {
|
||||
-- window = {
|
||||
-- info = { border = 'single' },
|
||||
-- signature = { border = 'single' },
|
||||
-- info = { border = vim.g.pref_border_style or 'single' },
|
||||
-- signature = { border = vim.g.pref_border_style or 'single' },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
{
|
||||
-- https://github.com/hrsh7th/nvim-cmp
|
||||
"hrsh7th/nvim-cmp",
|
||||
enabled = true,
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
-- { "hrsh7th/cmp-buffer" },
|
||||
-- { "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ 'hrsh7th/cmp-nvim-lsp-document-symbol' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
|
@ -37,7 +38,12 @@ return {
|
|||
-- config = true,
|
||||
-- },
|
||||
{ 'mmolhoek/cmp-scss' },
|
||||
{
|
||||
-- https://github.com/roginfarrer/cmp-css-variables#installation--setup
|
||||
"roginfarrer/cmp-css-variables",
|
||||
},
|
||||
{ 'onsails/lspkind.nvim' },
|
||||
{ "davidsierradz/cmp-conventionalcommits" },
|
||||
},
|
||||
opts = function()
|
||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||
|
@ -87,9 +93,14 @@ return {
|
|||
sources = cmp.config.sources({
|
||||
-- { name = "html-css" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
-- { name = "luasnip" },
|
||||
-- { name = "buffer" },
|
||||
{ name = "async-path" },
|
||||
{ name = 'conventionalcommits' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'nvim_lsp_document_symbol' },
|
||||
{ name = 'css-variables' },
|
||||
{ name = 'color_names'},
|
||||
}),
|
||||
formatting = {
|
||||
-- format = function(_, item)
|
||||
|
@ -114,7 +125,21 @@ return {
|
|||
},
|
||||
},
|
||||
sorting = defaults.sorting,
|
||||
view = {
|
||||
entries = {
|
||||
-- name = 'native',
|
||||
-- selection_order = 'near_cursor',
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
init = function()
|
||||
local cmp = require('cmp')
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'git' },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
local icons = require('custom.helpers.icons')
|
||||
local function get_hl(name)
|
||||
return vim.api.nvim_get_hl_by_name(name, true)
|
||||
end
|
||||
|
||||
return {
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
'tpope/vim-sleuth',
|
||||
|
@ -19,7 +24,7 @@ return {
|
|||
auto = 200,
|
||||
border = vim.g.pref_border_style,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
config = true,
|
||||
opts = {
|
||||
|
@ -34,13 +39,13 @@ return {
|
|||
config = function()
|
||||
-- See :h ibl.config
|
||||
local highlight = {
|
||||
"CursorColumn",
|
||||
"Whitespace",
|
||||
'CursorColumn',
|
||||
'Whitespace',
|
||||
}
|
||||
local opts = {
|
||||
indent = {
|
||||
-- highlight = highlight,
|
||||
char = "",
|
||||
char = '',
|
||||
},
|
||||
whitespace = {
|
||||
highlight = highlight,
|
||||
|
@ -51,27 +56,27 @@ return {
|
|||
-- highlight = highlight,
|
||||
show_start = true,
|
||||
show_end = true,
|
||||
char = "│",
|
||||
char = '│',
|
||||
-- char = "|",
|
||||
priority = 500,
|
||||
},
|
||||
}
|
||||
require('ibl').setup(opts);
|
||||
require('ibl').setup(opts)
|
||||
end,
|
||||
},
|
||||
'echasnovski/mini.align',
|
||||
'echasnovski/mini.bracketed',
|
||||
'echasnovski/mini.bufremove',
|
||||
{
|
||||
"echasnovski/mini.comment",
|
||||
'echasnovski/mini.comment',
|
||||
dependencies = {
|
||||
{ "JoosepAlviste/nvim-ts-context-commentstring", lazy = true },
|
||||
{ 'JoosepAlviste/nvim-ts-context-commentstring', lazy = true },
|
||||
},
|
||||
event = "VeryLazy",
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
options = {
|
||||
custom_commentstring = function()
|
||||
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
||||
return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
@ -80,8 +85,8 @@ return {
|
|||
'echasnovski/mini.move',
|
||||
{
|
||||
-- https://github.com/echasnovski/mini.pairs#default-config
|
||||
"echasnovski/mini.pairs",
|
||||
event = "VeryLazy",
|
||||
'echasnovski/mini.pairs',
|
||||
event = 'VeryLazy',
|
||||
config = true,
|
||||
opts = {
|
||||
mappings = {
|
||||
|
@ -102,95 +107,95 @@ return {
|
|||
{
|
||||
-- https://github.com/echasnovski/mini.surround#default-config
|
||||
'echasnovski/mini.surround',
|
||||
event = "VeryLazy",
|
||||
event = 'VeryLazy',
|
||||
config = true,
|
||||
opts = {
|
||||
search_method = "cover_or_nearest",
|
||||
search_method = 'cover_or_nearest',
|
||||
},
|
||||
},
|
||||
-- 'echasnovski/mini.hlpatterns',
|
||||
-- Better text-objects
|
||||
{
|
||||
"echasnovski/mini.ai",
|
||||
'echasnovski/mini.ai',
|
||||
enabled = false,
|
||||
-- keys = {
|
||||
-- { "a", mode = { "x", "o" } },
|
||||
-- { "i", mode = { "x", "o" } },
|
||||
-- },
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-treesitter-textobjects" },
|
||||
event = 'VeryLazy',
|
||||
dependencies = { 'nvim-treesitter-textobjects' },
|
||||
opts = function()
|
||||
local ai = require("mini.ai")
|
||||
local ai = require 'mini.ai'
|
||||
return {
|
||||
n_lines = 500,
|
||||
custom_textobjects = {
|
||||
o = ai.gen_spec.treesitter({
|
||||
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
|
||||
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
|
||||
a = { '@block.outer', '@conditional.outer', '@loop.outer' },
|
||||
i = { '@block.inner', '@conditional.inner', '@loop.inner' },
|
||||
}, {}),
|
||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
||||
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
||||
f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }, {}),
|
||||
c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }, {}),
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mini.ai").setup(opts)
|
||||
require('mini.ai').setup(opts)
|
||||
-- register all text objects with which-key
|
||||
require("lazyvim.util").on_load("which-key.nvim", function()
|
||||
require('lazyvim.util').on_load('which-key.nvim', function()
|
||||
---@type table<string, string|table>
|
||||
local i = {
|
||||
[" "] = "Whitespace",
|
||||
[' '] = 'Whitespace',
|
||||
['"'] = 'Balanced "',
|
||||
["'"] = "Balanced '",
|
||||
["`"] = "Balanced `",
|
||||
["("] = "Balanced (",
|
||||
[")"] = "Balanced ) including white-space",
|
||||
[">"] = "Balanced > including white-space",
|
||||
["<lt>"] = "Balanced <",
|
||||
["]"] = "Balanced ] including white-space",
|
||||
["["] = "Balanced [",
|
||||
["}"] = "Balanced } including white-space",
|
||||
["{"] = "Balanced {",
|
||||
["?"] = "User Prompt",
|
||||
_ = "Underscore",
|
||||
a = "Argument",
|
||||
b = "Balanced ), ], }",
|
||||
c = "Class",
|
||||
f = "Function",
|
||||
o = "Block, conditional, loop",
|
||||
q = "Quote `, \", '",
|
||||
t = "Tag",
|
||||
['`'] = 'Balanced `',
|
||||
['('] = 'Balanced (',
|
||||
[')'] = 'Balanced ) including white-space',
|
||||
['>'] = 'Balanced > including white-space',
|
||||
['<lt>'] = 'Balanced <',
|
||||
[']'] = 'Balanced ] including white-space',
|
||||
['['] = 'Balanced [',
|
||||
['}'] = 'Balanced } including white-space',
|
||||
['{'] = 'Balanced {',
|
||||
['?'] = 'User Prompt',
|
||||
_ = 'Underscore',
|
||||
a = 'Argument',
|
||||
b = 'Balanced ), ], }',
|
||||
c = 'Class',
|
||||
f = 'Function',
|
||||
o = 'Block, conditional, loop',
|
||||
q = 'Quote `, ", \'',
|
||||
t = 'Tag',
|
||||
}
|
||||
local a = vim.deepcopy(i)
|
||||
for k, v in pairs(a) do
|
||||
a[k] = v:gsub(" including.*", "")
|
||||
a[k] = v:gsub(' including.*', '')
|
||||
end
|
||||
|
||||
local ic = vim.deepcopy(i)
|
||||
local ac = vim.deepcopy(a)
|
||||
for key, name in pairs({ n = "Next", l = "Last" }) do
|
||||
i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic)
|
||||
a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac)
|
||||
for key, name in pairs { n = 'Next', l = 'Last' } do
|
||||
i[key] = vim.tbl_extend('force', { name = 'Inside ' .. name .. ' textobject' }, ic)
|
||||
a[key] = vim.tbl_extend('force', { name = 'Around ' .. name .. ' textobject' }, ac)
|
||||
end
|
||||
require("which-key").register({
|
||||
mode = { "o", "x" },
|
||||
require('which-key').register {
|
||||
mode = { 'o', 'x' },
|
||||
i = i,
|
||||
a = a,
|
||||
})
|
||||
}
|
||||
end)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"abecodes/tabout.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
'abecodes/tabout.nvim',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
cinfig = true,
|
||||
},
|
||||
{
|
||||
"ray-x/navigator.nvim",
|
||||
'ray-x/navigator.nvim',
|
||||
enabled = false,
|
||||
dependencies = {
|
||||
"ray-x/guihua",
|
||||
"neovim/nvim-lspconfig",
|
||||
'ray-x/guihua',
|
||||
'neovim/nvim-lspconfig',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -202,9 +207,118 @@ return {
|
|||
user_default_options = {
|
||||
css = true,
|
||||
css_fn = true,
|
||||
sass = { enable = true, parsers = { "css" }, },
|
||||
mode = "background",
|
||||
sass = { enable = true, parsers = { 'css' } },
|
||||
mode = 'background',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
-- https://github.com/johmsalas/text-case.nvim#all-options-with-their-default-value
|
||||
'johmsalas/text-case.nvim',
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('textcase').setup {}
|
||||
require('telescope').load_extension 'textcase'
|
||||
end,
|
||||
keys = {
|
||||
'ga', -- Default invocation prefix
|
||||
{ 'ga.', '<cmd>TextCaseOpenTelescope<CR>', mode = { 'n', 'x' }, desc = 'Telescope' },
|
||||
},
|
||||
cmd = {
|
||||
-- NOTE: The Subs command name can be customized via the option
|
||||
-- "substitude_command_name"
|
||||
'Subs',
|
||||
'TextCaseOpenTelescope',
|
||||
'TextCaseOpenTelescopeQuickChange',
|
||||
'TextCaseOpenTelescopeLSPChange',
|
||||
'TextCaseStartReplacingCommand',
|
||||
},
|
||||
-- If you want to use the interactive feature of the `Subs` command right
|
||||
-- away, text-case.nvim has to be loaded on startup. Otherwise, the
|
||||
-- interactive feature of the `Subs` will only be available after the first
|
||||
-- executing of it or after a keymap of text-case.nvim has been used.
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
-- [[ Cobination rulers styling ]]
|
||||
{
|
||||
-- https://github.com/xiyaowong/virtcolumn.nvim
|
||||
"xiyaowong/virtcolumn.nvim",
|
||||
enabled = true,
|
||||
event = "BufEnter *.*",
|
||||
-- init = function()
|
||||
-- vim.g.virtcolumn_char = "┊"
|
||||
-- end
|
||||
},
|
||||
{
|
||||
-- https://github.com/fmbarina/multicolumn.nvim#-configuration
|
||||
"fmbarina/multicolumn.nvim",
|
||||
enabled = true,
|
||||
event = "BufEnter *.*",
|
||||
config = function()
|
||||
local function gitcommit(buf, win)
|
||||
local is_first_line = vim.fn.line('.', win) == 1
|
||||
local error_hl = get_hl("DiagnosticVirtualTextError")
|
||||
return {
|
||||
scope = is_first_line and "line" or "window",
|
||||
-- TODO: Can I get these rules from a config file?
|
||||
rulers = { is_first_line and 51 or 73 },
|
||||
to_line_end = true,
|
||||
-- bg_color = error_hl.background,
|
||||
-- fg_color = error_hl.foreground,
|
||||
bg_color = "DarkRed",
|
||||
fg_color = "Gold",
|
||||
}
|
||||
end
|
||||
|
||||
local text_on_dark = "White"
|
||||
local text_on_light = "Black"
|
||||
local opts = {
|
||||
start = "enabled",
|
||||
update = "lazy_hold",
|
||||
exclude_floating = true,
|
||||
exclude_ft = { 'help', 'netrw', 'lazy', 'neotree', 'NeoTree' },
|
||||
sets = {
|
||||
default = {
|
||||
scope = "window",
|
||||
rulers = { 81, 121 },
|
||||
to_line_end = true,
|
||||
bg_color = get_hl("Conceal").background,
|
||||
fg_color = get_hl("DiagnosticVirtualTextWarn").foreground,
|
||||
-- always_on = true,
|
||||
},
|
||||
gitcommit = gitcommit,
|
||||
NeogitCommitMessage = gitcommit,
|
||||
},
|
||||
}
|
||||
|
||||
require('multicolumn').setup(opts);
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
event = "BufEnter *.*",
|
||||
-- config = true,
|
||||
opts = {
|
||||
-- TODO: THings
|
||||
-- TODO (Spencer) - THings
|
||||
-- NOTE: THis is a note
|
||||
-- FIX: Fix This
|
||||
-- FIXME: Fix this
|
||||
-- BUG: There is a vbug in this highlighting?
|
||||
-- WARNING: THis is a warning
|
||||
-- WARN (spencer): this is a warning
|
||||
-- sign_priority = 10,
|
||||
highlight = {
|
||||
multiline = false,
|
||||
multiline_context = 2,
|
||||
-- Match slugs followed by a name, or anything before a [:-] delimieter
|
||||
pattern = [[.*<(KEYWORDS).*(:|-)]],
|
||||
},
|
||||
-- keywords = { },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,38 @@
|
|||
|
||||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
{
|
||||
-- https://github.com/klen/nvim-config-local
|
||||
"klen/nvim-config-local",
|
||||
opts = {
|
||||
-- Default options (optional)
|
||||
|
||||
-- Config file patterns to load (lua supported)
|
||||
config_files = { ".nvim.lua", ".nvimrc", ".exrc" },
|
||||
|
||||
-- Where the plugin keeps files data
|
||||
hashfile = vim.fn.stdpath("data") .. "/config-local",
|
||||
|
||||
autocommands_create = true, -- Create autocommands (VimEnter, DirectoryChanged)
|
||||
commands_create = true, -- Create commands (ConfigLocalSource, ConfigLocalEdit, ConfigLocalTrust, ConfigLocalIgnore)
|
||||
silent = false, -- Disable plugin messages (Config loaded/ignored)
|
||||
lookup_parents = false, -- Lookup config files in parent directories
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
-- https://github.com/ahonn/vim-fileheader
|
||||
'ahonn/vim-fileheader',
|
||||
enabled = false,
|
||||
config = function()
|
||||
vim.notify('Configuring vim-fileheader')
|
||||
vim.g.fileheader_auto_add = 0
|
||||
vim.g.fileheader_auto_update = 0
|
||||
vim.g.fileheader_show_email = 0
|
||||
vim.g.fileheader_by_git_config = 0
|
||||
end
|
||||
},
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ return {
|
|||
settings = {
|
||||
separate_diagnostic_server = true,
|
||||
publish_diagnostic_on = "change",
|
||||
tsserver_path = "/Users/oobleck/Library/pnpm/tsserver",
|
||||
-- tsserver_path = "/Users/oobleck/Library/pnpm/tsserver",
|
||||
expose_as_code_action = "all",
|
||||
code_lens = "all",
|
||||
complete_function_calls = true,
|
||||
code_lens = "references_only",
|
||||
disable_member_code_lens = false,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ return {
|
|||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = "BufEnter",
|
||||
enabled = true,
|
||||
enabled = false,
|
||||
dependencies = { "mason.nvim" },
|
||||
Xinit = function()
|
||||
Util.on_very_lazy(function()
|
||||
|
@ -111,10 +111,10 @@ return {
|
|||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
'b0o/SchemaStore.nvim',
|
||||
{
|
||||
-- Configured elsewhere?
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
-- {
|
||||
-- -- Configured elsewhere?
|
||||
-- "hrsh7th/nvim-cmp",
|
||||
-- },
|
||||
-- {
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
-- cond = function()
|
||||
|
@ -126,8 +126,8 @@ return {
|
|||
'rmagatti/goto-preview',
|
||||
opts = {
|
||||
default_mappings = true,
|
||||
opacity = 0,
|
||||
dismiss_on_move = true,
|
||||
opacity = vim.g.pref_blend or 0,
|
||||
dismiss_on_move = false,
|
||||
},
|
||||
-- keys = {
|
||||
-- { 'gp', function() require('goto-preview').goto_preview_definition() end, desc = '[G]o to Definition [P]review' },
|
||||
|
@ -192,7 +192,7 @@ return {
|
|||
-- },
|
||||
},
|
||||
rust_analyzer = {},
|
||||
tsserver = { filetypes = { 'typescript', 'javascript' } },
|
||||
-- tsserver = { filetypes = { 'typescript', 'javascript' } },
|
||||
stylelint_lsp = {
|
||||
stylelintplus = {
|
||||
autoFixOnFormat = true,
|
||||
|
|
|
@ -1,8 +1,38 @@
|
|||
local layer_theme = vim.g.pref_layer_colorscheme or 'evening'
|
||||
local layer_theme = vim.g.pref_colorscheme_layers
|
||||
local icons = require('custom.helpers.icons')
|
||||
|
||||
return {
|
||||
-- Color schemes
|
||||
{
|
||||
-- https://github.com/EdenEast/nightfox.nvim#configuration
|
||||
"EdenEast/nightfox.nvim",
|
||||
enabled = true,
|
||||
opts = {
|
||||
transparent = true,
|
||||
inverse = {
|
||||
match_parens = true,
|
||||
visual = true,
|
||||
search = true,
|
||||
},
|
||||
modules = {
|
||||
neotree = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
whichkey = true,
|
||||
lsp_saga = true,
|
||||
lsp_trouble = true,
|
||||
["lazy.nvim"] = true,
|
||||
indent_blanklines = true,
|
||||
gitgutter = true,
|
||||
gitsigns = true,
|
||||
cmp = true,
|
||||
barbar = true,
|
||||
["dap-ui"] = true,
|
||||
mini = true,
|
||||
native_lsp = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
|
@ -26,6 +56,34 @@ return {
|
|||
-- end,
|
||||
},
|
||||
|
||||
{
|
||||
-- https://github.com/eliseshaffer/darklight.nvim#colorscheme
|
||||
'eliseshaffer/darklight.nvim',
|
||||
lazy = false,
|
||||
opts = {
|
||||
mode = 'colorscheme',
|
||||
light_mode_colorscheme = vim.g.pref_colorscheme_light or 'nordic',
|
||||
dark_mode_colorscheme = vim.g.pref_colorscheme_dark or 'nordic',
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
-- https://github.com/f-person/auto-dark-mode.nvim#using-lazy
|
||||
"f-person/auto-dark-mode.nvim",
|
||||
config = {
|
||||
update_interval = 1000,
|
||||
set_dark_mode = function()
|
||||
vim.api.nvim_set_option("background", "dark")
|
||||
vim.cmd("colorscheme " .. vim.g.pref_colorscheme_dark)
|
||||
end,
|
||||
set_light_mode = function()
|
||||
vim.api.nvim_set_option("background", "light")
|
||||
vim.cmd("colorscheme " .. vim.g.pref_colorscheme_light)
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- Other UI
|
||||
{
|
||||
-- Breadcrumbs dropbar (like IntelliJ's): Requires nvim 0.10+
|
||||
|
@ -68,6 +126,7 @@ return {
|
|||
-- Alt Nvim UI Components
|
||||
-- https://github.com/folke/noice.nvim#%EF%B8%8F-configuration
|
||||
"folke/noice.nvim",
|
||||
enabled = true,
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
-- cmdline = { enabled = false },
|
||||
|
@ -188,12 +247,31 @@ return {
|
|||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
-- https://github.com/mrjones2014/legendary.nvim#configuration
|
||||
'mrjones2014/legendary.nvim',
|
||||
priority = 99999,
|
||||
lazy = false,
|
||||
opts = {
|
||||
-- https://github.com/mrjones2014/legendary.nvim/blob/master/doc/EXTENSIONS.md
|
||||
extensions = {
|
||||
lazy_nvim = true,
|
||||
smart_splits = {},
|
||||
diffview = true,
|
||||
which_key = { auto_register = true },
|
||||
},
|
||||
-- https://github.com/mrjones2014/legendary.nvim/blob/HEAD/doc/table_structures/AUTOCMDS.md
|
||||
autocmds = require('custom.autocommands'),
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
dependencies = {
|
||||
'anuvyklack/keymap-amend.nvim',
|
||||
},
|
||||
event = "VeryLazy",
|
||||
-- event = "VeryLazy",
|
||||
lazy = false,
|
||||
priority = 88888,
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
|
@ -204,24 +282,6 @@ return {
|
|||
-- refer to the configuration section below
|
||||
}
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.files',
|
||||
enabled = false,
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'lewis6991/gitsigns.nvim',
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.tabline',
|
||||
enabled = false,
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'lewis6991/gitsigns.nvim',
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
-- https://github.com/romgrk/barbar.nvim#options
|
||||
'romgrk/barbar.nvim',
|
||||
|
@ -395,11 +455,13 @@ return {
|
|||
{
|
||||
-- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'powerline_dark',
|
||||
-- theme = 'powerline_dark',
|
||||
-- theme = 'PaperColor',
|
||||
component_separators = '/',
|
||||
-- section_separators = '',
|
||||
},
|
||||
|
@ -409,7 +471,7 @@ return {
|
|||
'mode',
|
||||
icons_enabled = true,
|
||||
fmt = function(str)
|
||||
return str:sub(1, 1)
|
||||
return icons.modes[str:lower()] or str:sub(1, 2)
|
||||
end
|
||||
}
|
||||
},
|
||||
|
@ -466,5 +528,27 @@ return {
|
|||
},
|
||||
config = true,
|
||||
cmd = "Glow",
|
||||
}
|
||||
},
|
||||
{
|
||||
-- https://github.com/mrjones2014/smart-splits.nvim#configuration
|
||||
'mrjones2014/smart-splits.nvim',
|
||||
dependencies = {
|
||||
{
|
||||
-- https://github.com/kwkarlwang/bufresize.nvim#default-configuration
|
||||
"kwkarlwang/bufresize.nvim",
|
||||
lazy = false,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
ignored_filetypes = { "NvimTree", "NeoTree" },
|
||||
log_level = "warn",
|
||||
resize_mode = {
|
||||
hooks = {
|
||||
on_leave = function()
|
||||
return require('bufresize').register
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -50,7 +50,16 @@ return {
|
|||
{
|
||||
-- https://github.com/sindrets/diffview.nvim#configuration
|
||||
'sindrets/diffview.nvim',
|
||||
config = true,
|
||||
opts = {
|
||||
file_panel = {
|
||||
-- listing_style = "list",
|
||||
},
|
||||
},
|
||||
config = function (opts)
|
||||
vim.keymap.set({'n'}, "<Leader>gd", "<cmd>DiffviewOpen<cr>", {desc = "Open [G]it [d]iff view"})
|
||||
-- vim.keymap.set({'n'}, "<Leader>gD", "<cmd>DiffviewClose<cr>", {desc = "Close [G]it [d]iff view"})
|
||||
require("diffview").setup(opts)
|
||||
end
|
||||
},
|
||||
-- {
|
||||
-- 'f-person/git-blame.nvim',
|
||||
|
@ -113,4 +122,17 @@ return {
|
|||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
-- https://github.com/isak102/telescope-git-file-history.nvim#configuration
|
||||
"isak102/telescope-git-file-history.nvim",
|
||||
dependencies = {
|
||||
"tpope/vim-fugitive",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
config = function ()
|
||||
local ts = require("telescope")
|
||||
ts.load_extension("git_file_history")
|
||||
vim.keymap.set('n', '<Leader>gh', ts.extensions.git_file_history.git_file_history, { desc = "Show [G]it file [h]istory"})
|
||||
end
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue