This commit is contained in:
sankalp committed 2024-04-27 00:09:57 +05:45
1 parent 4d702fab7e
commit f0ebf86684
55 files changed
+3839

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
require('core.options')
require('core.functions')
require('core.keymaps')
require('core.autocmd')
require('plugins.lazy')
-- Add user configs to this module
pcall(require, 'user')
+105
View File
@@ -0,0 +1,105 @@
local function augroup(name)
return vim.api.nvim_create_augroup('nvim2k_' .. name, { clear = true })
end
-- Strip trailing spaces before write
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup('strip_space'),
pattern = { '*' },
callback = function()
vim.cmd([[ %s/\s\+$//e ]])
end,
})
-- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
group = augroup('checktime'),
command = 'checktime',
})
-- Highlight on yank
vim.api.nvim_create_autocmd('TextYankPost', {
group = augroup('highlight_yank'),
callback = function()
vim.highlight.on_yank()
end,
})
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ 'VimResized' }, {
group = augroup('resize_splits'),
callback = function()
vim.cmd('tabdo wincmd =')
end,
})
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd('BufReadPost', {
group = augroup('last_loc'),
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd('FileType', {
group = augroup('close_with_q'),
pattern = {
'DressingSelect',
'Jaq',
'PlenaryTestPopup',
'fugitive',
'help',
'lir',
'lspinfo',
'man',
'notify',
'qf',
'spectre_panel',
'startuptime',
'tsplayground',
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
end,
})
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd('FileType', {
group = augroup('wrap_spell'),
pattern = { 'gitcommit', 'markdown' },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup('auto_create_dir'),
callback = function(event)
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
end,
})
-- Set arb filetype
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = augroup('set_file_type'),
pattern = { '*.arb' },
command = require('lib.util').get_file_type_cmd('arb'),
})
-- Disable format options
vim.api.nvim_create_autocmd('FileType', {
group = augroup('disable_formatoptions'),
pattern = '*',
callback = function()
vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' })
end,
})
+35
View File
@@ -0,0 +1,35 @@
-- Reload neovim config
vim.api.nvim_create_user_command('ReloadConfig', function()
for name, _ in pairs(package.loaded) do
if name:match('^plugins') then
package.loaded[name] = nil
end
end
dofile(vim.env.MYVIMRC)
vim.notify('Nvim configuration reloaded!', vim.log.levels.INFO)
end, {})
-- Copy relative path
vim.api.nvim_create_user_command('CRpath', function()
local path = vim.fn.expand('%')
vim.fn.setreg('+', path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
-- Copy absolute path
vim.api.nvim_create_user_command('CApath', function()
local path = vim.fn.expand('%:p')
vim.fn.setreg('+', path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
-- Switch to git root or file parent dir
vim.api.nvim_create_user_command('RootDir', function()
local root = require('lib.util').get_root_dir()
if root == '' then
return
end
vim.cmd('lcd ' .. root)
end, {})
+80
View File
@@ -0,0 +1,80 @@
local function map(mode, lhs, rhs, opts)
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
local opts = { noremap = true, silent = true }
-- Space as leader
map('n', '<Space>', '', opts)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Modes
-- normal_mode = "n", insert_mode = "i", visual_mode = "v",
-- visual_block_mode = "x", term_mode = "t", command_mode = "c",
-- Use jj as escape
map('i', 'jj', '<Esc>', opts)
map('t', 'JJ', '<C-\\><C-n>', opts)
-- Visual overwrite paste
map({ 'v', 'x' }, 'p', '"_dP', opts)
-- Do not copy on x
map({ 'v', 'x' }, 'x', '"_x', opts)
-- Increment/decrement
map({ 'n', 'v', 'x' }, '-', '<C-x>', opts)
map({ 'n', 'v', 'x' }, '=', '<C-a>', opts)
-- Move to line beginning and end
map({ 'n', 'v', 'x' }, 'gl', '$', { desc = 'End of line' })
map({ 'n', 'v', 'x' }, 'gh', '^', { desc = 'Beginning of line' })
-- Center Cursors
map('n', 'J', 'mzJ`z', opts)
map('n', '<C-d>', '<C-d>zz', opts)
map('n', '<C-u>', '<C-u>zz', opts)
map('n', 'n', 'nzzzv', opts)
map('n', 'N', 'Nzzzv', opts)
-- Better up/down
map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
map('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
-- Move text up and down
map({ 'v', 'x' }, 'J', ":move '>+1<CR>gv-gv", opts)
map({ 'v', 'x' }, 'K', ":move '<-2<CR>gv-gv", opts)
-- Clear search, diff update and redraw
map({ 'i', 'n' }, '<esc>', '<cmd>noh<cr><esc>', { desc = 'Escape and clear hlsearch' })
-- Consistent n/N search navigation
map('n', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
map('n', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
-- Better indenting
map('v', '<', '<gv')
map('v', '>', '>gv')
-- Add undo breakpoints
map('i', ',', ',<c-g>u')
map('i', '.', '.<c-g>u')
map('i', ';', ';<c-g>u')
-- Codeium
map('i', '<M-;>', function () return vim.fn['codeium#Accept']() end, { expr = true, silent = true })
map('i', '<M-]>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true, silent = true })
map('i', '<M-[>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true, silent = true })
map('i', '<M-c>', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true })
map('n', '<leader>e', function()
require("oil").toggle_float()
end)
+90
View File
@@ -0,0 +1,90 @@
local options = {
ai = true,
autoindent = true,
autowrite = true,
backspace = 'indent,eol,start',
backup = false, -- creates a backup file
breakindent = true,
clipboard = 'unnamedplus', -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = 'menu,menuone,noselect', -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
confirm = true, -- Confirm to save changes before exiting modified buffer
cursorline = true, -- highlight the current line
expandtab = true, -- convert tabs to spaces
fileencoding = 'utf-8', -- the encoding written to a file
formatoptions = 'jlnqt', -- set formatoptions, check help fo-table
grepformat = '%f:%l:%c:%m',
grepprg = 'rg --vimgrep',
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
inccommand = 'split', -- preview incremental substitute
laststatus = 3,
list = true,
listchars = { trail = '', tab = '', nbsp = '_', extends = '>', precedes = '<' }, -- highlight
mouse = 'a', -- allow the mouse to be used in neovim
number = true, -- set numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
pumblend = 10, -- Popup blen
pumheight = 10, -- pop up menu height
relativenumber = true, -- set relative numbered lines
scrolloff = 10, -- is one of my fav
sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal',
shiftround = true, -- Round indent
shiftwidth = 4, -- the number of spaces inserted for each indentation
showcmd = false,
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 0, -- always show tabs
si = true,
sidescrolloff = 8,
signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
smarttab = true,
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
tabstop = 4, -- insert 2 spaces for a tab
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
undolevels = 10000,
updatetime = 50, -- faster completion (4000ms default)
wildmenu = true, -- wildmenu
wildmode = 'longest:full,full', -- Command-line completion mode
winminwidth = 5, -- Minimum window width
wrap = false, -- display lines as one long line
writebackup = false, -- do not edit backups
}
vim.cmd([[
setlocal spell spelllang=en "Set spellcheck language to en
setlocal spell! "Disable spell checks by default
filetype plugin indent on
if has('win32')
let g:python3_host_prog = $HOME . '/scoop/apps/python/current/python.exe'
endif
]])
vim.opt.path:append({ '**' })
-- Undercurl
vim.cmd([[let &t_Cs = "\e[4:3m"]])
vim.cmd([[let &t_Ce = "\e[4:0m"]])
vim.opt.shortmess:append({ W = true, I = true, c = true })
if vim.fn.has('nvim-0.9.0') == 1 then
vim.opt.splitkeep = 'screen'
vim.opt.shortmess:append({ C = true })
end
-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0
for k, v in pairs(options) do
vim.opt[k] = v
end
vim.cmd('set whichwrap+=<,>,[,],h,l')
vim.cmd([[set iskeyword+=-]])
+156
View File
@@ -0,0 +1,156 @@
return {
diagnostics = {
Error = '',
Hint = '󰠠 ',
Information = '',
Question = '',
Warning = '',
},
documents = {
File = '',
FileEmpty = '',
Files = '',
Folder = '',
FolderEmpty = '',
OpenFolder = '',
OpenFolderEmpty = '',
SymLink = '',
SymlinkFolder = '',
Import = '',
},
git = {
Add = '',
AddAlt = '',
Branch = '',
Diff = '',
DiffAlt = '',
Ignore = '◌ ',
Mod = '',
Octoface = '',
Remove = '',
RemoveAlt = '',
Rename = '',
Repo = '',
Tag = '',
Untrack = '',
},
kind = {
Class = '',
Color = '',
Constant = '',
Constructor = '󰈏 ',
Enum = '',
EnumMember = '',
Event = '',
Field = '',
File = '',
Folder = '',
Function = '󰊕 ',
Interface = '',
Keyword = '',
Method = '',
Module = '',
Operator = '',
Property = '',
Reference = '',
Snippet = '',
Struct = '',
Text = '',
TypeParameter = '',
Unit = '',
Value = '',
Variable = '',
},
type = {
Array = '',
Boolean = '⏻ ',
Number = '',
Object = '',
String = '',
},
ui = {
AI = '',
Arrow = '',
ArrowClosed = '',
ArrowLeft = '',
ArrowOpen = '',
ArrowRight = '',
Bluetooth = '',
Bookmark = '',
Bug = '',
Calendar = '',
Camera = '',
Check = '',
ChevronRight = '',
Circle = '',
CircleSmall = '● ',
CircleSmallEmpty = '○ ',
Clipboard = '',
Close = '',
Code = '',
Collection = '',
Color = '',
Command = '',
Comment = '',
Corner = '└ ',
Dashboard = '',
Database = '',
Download = '',
Edge = '│ ',
Electric = '',
Fire = '',
Firefox = '',
Game = '',
Gear = '',
GitHub = '',
Heart = '',
History = '',
Home = '',
Incoming = '',
Keyboard = '',
Ligthbulb = '󰌵 ',
List = '',
Lock = '',
Minus = '‒ ',
Music = '󰝚 ',
NeoVim = '',
NewFile = '',
None = ' ',
Note = '',
Outgoing = '',
Package = '',
Paint = '',
Pause = '',
Pencil = '',
Person = '',
Pin = '',
Play = '',
Plug = '',
Plus = '',
Power = '',
PowerlineArrowLeft = '',
PowerlineArrowRight = '',
PowerlineLeftRound = '',
PowerlineRightRound = '',
Project = '',
Question = '',
Reload = '',
Rocket = '',
Save = '󰆓 ',
Search = '',
Separator = '▊ ',
SignIn = '',
SignOut = '',
Sleep = '󰒲 ',
Star = '',
Table = '',
Telescope = '',
Terminal = '',
Test = '',
Time = '',
Trash = '',
Vim = '',
Wifi = '',
Windows = '',
},
}
+51
View File
@@ -0,0 +1,51 @@
local util = {}
util.get_user_config = function(key, default)
local status_ok, user = pcall(require, 'user')
if not status_ok then
return default
end
local user_config = user[key]
if user_config == nil then
return default
end
return user_config
end
util.get_root_dir = function()
local bufname = vim.fn.expand('%:p')
if vim.fn.filereadable(bufname) == 0 then
return
end
local parent = vim.fn.fnamemodify(bufname, ':h')
local git_root = vim.fn.systemlist('git -C ' .. parent .. ' rev-parse --show-toplevel')
if #git_root > 0 and git_root[1] ~= '' then
return git_root[1]
else
return parent
end
end
util.get_file_type_cmd = function(extension)
local root = util.get_root_dir()
if extension == 'arb' and root then
local gemfile_exists = vim.fn.filereadable(root .. '/Gemfile') == 1
local pubspec_exists = vim.fn.filereadable(root .. '/pubspec.yaml') == 1
if gemfile_exists then
return 'setfiletype ruby'
end
if pubspec_exists then
return 'setfiletype json'
end
end
return ''
end
util.is_present = function(bin)
return vim.fn.executable(bin) == 1
end
return util
+35
View File
@@ -0,0 +1,35 @@
local ai = require('mini.ai')
ai.setup({
custom_textobjects = {
o = ai.gen_spec.treesitter({
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' }, {}),
t = { '<([%p%w]-)%f[^<%w][^<>]->.-</%1>', '^<.->().*()</[^/]->$' },
},
mappings = {
-- Main textobject prefixes
around = 'a',
inside = 'i',
-- Next/last variants
around_next = 'an',
inside_next = 'in',
around_last = 'al',
inside_last = 'il',
-- Move cursor to corresponding edge of `a` textobject
goto_left = 'g[',
goto_right = 'g]',
},
-- How to search for object
-- 'cover', 'cover_or_next', 'cover_or_prev','cover_or_nearest', 'next', 'previous', 'nearest'.
search_method = 'cover_or_next',
n_lines = 500,
silent = false,
})
+26
View File
@@ -0,0 +1,26 @@
local npairs = require('nvim-autopairs')
npairs.setup({
check_ts = true,
ts_config = {
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
java = false,
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-s>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0,
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
+105
View File
@@ -0,0 +1,105 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
require('luasnip/loaders/from_vscode').lazy_load()
local icons = require('lib.icons')
local kind_icons = icons.kind
vim.api.nvim_set_hl(0, 'CmpItemKindCopilot', { fg = '#6CC644' })
cmp.setup({
completion = {
completeopt = 'menu,menuone,preview,noselect',
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.select_next_item(),
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-1), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(1), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-y>'] = cmp.config.disable,
['<C-c>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
formatting = {
fields = { 'kind', 'abbr', 'menu' },
expandable_indicator = true,
format = function(entry, vim_item)
-- Kind icons
vim_item.kind = kind_icons[vim_item.kind]
if entry.source.name == 'copilot' then
vim_item.kind = icons.git.Octoface
vim_item.kind_hl_group = 'CmpItemKindCopilot'
end
vim_item.menu = ({
codeium = '[Codeium]',
nvim_lsp = '[LSP]',
luasnip = '[Snippet]',
buffer = '[Buffer]',
path = '[Path]',
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'nvim_lua' },
{ name = 'luasnip', keyword_length = 2 },
{ name = 'buffer', keyword_length = 3 },
{ name = 'codeium'},
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
documentation = {
border = 'rounded',
winhighlight = 'NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None',
},
completion = {
border = 'rounded',
winhighlight = 'NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None',
},
scrollbar = true,
},
experimental = {
ghost_text = true,
},
})
+4
View File
@@ -0,0 +1,4 @@
require('codeium').setup({
})
+26
View File
@@ -0,0 +1,26 @@
local comment = require('mini.comment')
require('ts_context_commentstring').setup({
enable_autocmd = false,
-- languages = { typescript = '// %s' },
})
comment.setup({
options = {
custom_commentstring = function()
return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring
end,
ignore_blank_line = true,
start_of_line = false,
pad_comment_parts = true,
},
mappings = {
-- Toggle comment (like `gcip` - comment inner paragraph) for both
comment = 'gc',
comment_line = 'gcc',
comment_visual = 'gc',
-- Define 'comment' textobject (like `dgc` - delete whole comment block)
textobject = 'gc',
},
})
+47
View File
@@ -0,0 +1,47 @@
local copilot = require('copilot')
copilot.setup({
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = '[[',
jump_next = ']]',
accept = '<CR>',
refresh = 'gr',
open = '<M-CR>',
},
layout = {
position = 'bottom',
ratio = 0.4,
},
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = '<M-l>',
accept_word = false,
accept_line = false,
next = '<M-]>',
prev = '<M-[>',
dismiss = '<C-]>',
},
},
filetypes = {
yaml = true,
markdown = true,
help = true,
gitcommit = true,
gitrebase = true,
hgcommit = true,
svn = true,
cvs = true,
['.'] = true,
},
copilot_node_command = 'node', -- Node.js version must be > 16.x
server_opts_overrides = {},
})
require('copilot_cmp').setup()
+107
View File
@@ -0,0 +1,107 @@
local dap = require('dap')
local dapui = require('dapui')
local icons = require('lib.icons')
dapui.setup({
icons = { expanded = icons.ui.ArrowClosed, collapsed = icons.ui.ArrowOpen },
mappings = {
expand = { '<CR>', '<2-LeftMouse>' },
open = 'o',
remove = 'd',
edit = 'e',
repl = 'r',
toggle = 't',
},
expand_lines = vim.fn.has('nvim-0.7'),
layouts = {
{
elements = {
{ id = 'scopes', size = 0.25 },
'breakpoints',
'stacks',
'watches',
},
size = 40,
position = 'right',
},
{
elements = {
'repl',
'console',
},
size = 0.25,
position = 'bottom',
},
},
floating = {
max_height = nil,
max_width = nil,
border = 'rounded',
mappings = {
close = { 'q', '<Esc>' },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil,
},
})
vim.fn.sign_define('DapBreakpoint', { text = icons.ui.Bug, texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close()
end
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close()
end
dap.adapters.python = {
type = 'executable',
command = '/usr/bin/python',
args = { '-m', 'debugpy.adapter' },
}
dap.configurations.python = {
{
type = 'python',
request = 'launch',
name = 'Launch file',
program = '${file}',
pythonPath = function()
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 '/usr/bin/python'
end
end,
},
}
dap.adapters.ruby = {
type = 'executable',
command = 'bundle',
args = { 'exec', 'readapt', 'stdio' },
}
dap.configurations.ruby = {
{
type = 'ruby',
request = 'launch',
name = 'Rails',
program = 'bundle',
programArgs = { 'exec', 'rails', 's' },
useBundler = true,
},
}
vim.api.nvim_create_user_command('DapUIToggle', function()
require('dapui').toggle()
end, {})
+4
View File
@@ -0,0 +1,4 @@
local lsp_lines = require('lsp_lines')
lsp_lines.setup()
vim.diagnostic.config({ virtual_text = false })
+49
View File
@@ -0,0 +1,49 @@
local lspconfig = require('lspconfig')
local cmp_lsp = require('cmp_nvim_lsp')
local icons = require('lib.icons').diagnostics
local auto_install = require('lib.util').get_user_config('auto_install', true)
local installed_servers = {}
if auto_install then
installed_servers = require('plugins.list').lsp_servers
end
local lsp_capabilities = cmp_lsp.default_capabilities()
local default_setup = function(server)
lspconfig[server].setup({
capabilities = lsp_capabilities,
})
end
local signs = { Error = icons.Error, Warn = icons.Warning, Hint = icons.Hint, Info = icons.Information }
for type, icon in pairs(signs) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end
require('mason-lspconfig').setup({
ensure_installed = installed_servers,
handlers = {
default_setup,
lua_ls = function()
lspconfig.lua_ls.setup({
capabilities = lsp_capabilities,
settings = {
Lua = {
runtime = { version = 'LuaJIT' },
diagnostics = { globals = { 'vim' } },
workspace = { library = { vim.env.VIMRUNTIME } },
format = {
enable = true,
defaultConfig = {
align_continuous_assign_statement = false,
align_continuous_rect_table_field = false,
align_array_table = false,
},
},
},
},
})
end,
},
})
+21
View File
@@ -0,0 +1,21 @@
local lspsaga = require('lspsaga')
local icons = require('lib.icons')
lspsaga.setup({
ui = {
theme = 'round',
border = 'rounded',
devicon = true,
title = true,
winblend = 1,
expand = icons.ui.ArrowOpen,
collapse = icons.ui.ArrowClosed,
preview = icons.ui.List,
code_action = icons.diagnostics.Hint,
diagnostic = icons.ui.Bug,
incoming = icons.ui.Incoming,
outgoing = icons.ui.Outgoing,
hover = icons.ui.Comment,
},
})
+35
View File
@@ -0,0 +1,35 @@
local mason = require('mason')
local icons = require('lib.icons')
mason.setup({
-- - "prepend": Use mason binary, "append": Use system binary
PATH = 'append',
log_level = vim.log.levels.INFO,
max_concurrent_installers = 8,
ui = {
check_outdated_packages_on_open = true,
border = 'rounded',
width = 0.8,
height = 0.8,
icons = {
package_installed = icons.ui.Gear,
package_pending = icons.ui.Download,
package_uninstalled = icons.ui.Plus,
},
keymaps = {
toggle_package_expand = '<CR>',
install_package = 'i',
update_package = 'u',
check_package_version = 'c',
update_all_packages = 'U',
check_outdated_packages = 'C',
uninstall_package = 'x',
cancel_installation = '<C-c>',
apply_language_filter = '<C-f>',
},
},
})
+15
View File
@@ -0,0 +1,15 @@
local neodev = require('neodev')
neodev.setup({
library = {
enabled = true,
runtime = true,
types = true,
plugins = true, -- installed opt or start plugins in packpath
-- you can also specify the list of plugins to make available as a workspace library
-- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" },
},
setup_jsonls = true,
lspconfig = true,
pathStrict = true,
})
+19
View File
@@ -0,0 +1,19 @@
local neotest = require('neotest')
neotest.setup({
adapters = {
require('neotest-rspec')({
rspec_cmd = function()
return vim.tbl_flatten({
'bundle',
'exec',
'rspec',
})
end,
}),
require('neotest-jest')({
jestCommand = 'npx jest --',
jestConfigFile = 'jest.config.js',
}),
},
})
+51
View File
@@ -0,0 +1,51 @@
local null_ls = require('null-ls')
local action = null_ls.builtins.code_actions
local comp = null_ls.builtins.completion
local diag = null_ls.builtins.diagnostics
local format = null_ls.builtins.formatting
local hover = null_ls.builtins.hover
-- Buily in sources: https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md
null_ls.setup({
debug = false,
border = 'rounded',
log_level = 'info',
diagnostics_format = '#{c} #{m} (#{s})',
sources = {
action.proselint, -- markdown actions
action.refactoring,
action.ts_node_action, -- treesitter node actions
comp.spell, -- spell completion
comp.tags, -- tags completion
diag.actionlint, -- github action lint
diag.credo, -- elixir diagnostics
diag.golangci_lint,
diag.hadolint, -- docker lint
diag.proselint, -- markdown lint
diag.reek, -- ruby code smell
diag.rubocop, -- ruby diagnostics
diag.todo_comments,
diag.trail_space, -- trailing space check
diag.vint, -- vim lint
diag.write_good, -- english writing style
format.mix, -- elixir formatter
format.prettier, -- js, md, css, etc formatter
format.rubocop, -- ruby formatter
format.shfmt, -- shell formatter
format.stylua, -- lua formatter
hover.dictionary, -- show word dictionary on hover
hover.printenv, -- show env on hover
},
})
local auto_install = require('lib.util').get_user_config('auto_install', true)
local installed_sources = {}
if auto_install then
installed_sources = require('plugins.list').null_ls_sources
end
require('mason-null-ls').setup({
ensure_installed = installed_sources,
automatic_installation = auto_install,
})
+25
View File
@@ -0,0 +1,25 @@
local refactoring = require('refactoring')
refactoring.setup({
prompt_func_return_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
prompt_func_param_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
printf_statements = {},
print_var_statements = {},
})
+20
View File
@@ -0,0 +1,20 @@
local ror = require('ror')
local icons = require('lib.icons')
ror.setup({
test = {
message = {
file = 'Running test file...',
line = 'Running single test...',
},
coverage = {
up = 'DiffAdd',
down = 'DiffDelete',
},
notification = {
timeout = false,
},
pass_icon = icons.ui.Check,
fail_icon = icons.ui.Close,
},
})
+14
View File
@@ -0,0 +1,14 @@
local sniprun = require('sniprun')
sniprun.setup({
display = { 'VirtualTextOk', 'VirtualTextErr' },
show_no_output = { 'Classic', 'TempFloatingWindow' },
display_options = {
terminal_width = 45,
notification_timeout = 5,
},
inline_messages = 0,
borders = 'single',
})
+25
View File
@@ -0,0 +1,25 @@
local surround = require('mini.surround')
surround.setup({
custom_surroundings = nil,
mappings = {
add = 'gsa',
delete = 'gsd',
find = 'gsf',
find_left = 'gsF',
highlight = 'gsh',
replace = 'gsr',
update_n_lines = 'gsn',
suffix_last = 'l', -- Suffix to search with "prev" method
suffix_next = 'n', -- Suffix to search with "next" method
},
-- How to search for surrounding
-- 'cover', 'cover_or_next', 'cover_or_prev','cover_or_nearest', 'next', 'previous', 'nearest'.
search_method = 'cover_or_nearest',
highlight_duration = 500,
n_lines = 20,
respect_selection_type = false,
silent = false,
})
+115
View File
@@ -0,0 +1,115 @@
local textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['a='] = { query = '@assignment.outer', desc = 'Select outer part of an assignment' },
['i='] = { query = '@assignment.inner', desc = 'Select inner part of an assignment' },
['al='] = { query = '@assignment.lhs', desc = 'Select left hand side of an assignment' },
['ar='] = {
query = '@assignment.rhs',
desc = 'Select right hand side of an assignment',
},
['a:'] = { query = '@property.outer', desc = 'Select outer part of an object property' },
['i:'] = { query = '@property.inner', desc = 'Select inner part of an object property' },
['l:'] = { query = '@property.lhs', desc = 'Select left part of an object property' },
['r:'] = { query = '@property.rhs', desc = 'Select right part of an object property' },
['aa'] = {
query = '@parameter.outer',
desc = 'Select outer part of a parameter/argument',
},
['ia'] = {
query = '@parameter.inner',
desc = 'Select inner part of a parameter/argument',
},
['ai'] = { query = '@conditional.outer', desc = 'Select outer part of a conditional' },
['ii'] = { query = '@conditional.inner', desc = 'Select inner part of a conditional' },
['al'] = { query = '@loop.outer', desc = 'Select outer part of a loop' },
['il'] = { query = '@loop.inner', desc = 'Select inner part of a loop' },
['af'] = { query = '@call.outer', desc = 'Select outer part of a function call' },
['if'] = { query = '@call.inner', desc = 'Select inner part of a function call' },
['am'] = {
query = '@function.outer',
desc = 'Select outer part of a method/function definition',
},
['im'] = {
query = '@function.inner',
desc = 'Select inner part of a method/function definition',
},
['ac'] = { query = '@class.outer', desc = 'Select outer part of a class' },
['ic'] = { query = '@class.inner', desc = 'Select inner part of a class' },
},
},
swap = {
enable = true,
swap_next = {
['<leader>rna'] = '@parameter.inner', -- swap object property with next
['<leader>rn:'] = '@property.outer', -- swap parameters/argument with next
['<leader>rnm'] = '@function.outer', -- swap function with next
},
swap_previous = {
['<leader>rpa'] = '@parameter.inner', -- swap parameters/argument with prev
['<leader>rp:'] = '@property.outer', -- swap object property with prev
['<leader>rpm'] = '@function.outer', -- swap function with previous
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']f'] = { query = '@call.outer', desc = 'Next function call start' },
[']m'] = { query = '@function.outer', desc = 'Next method/function def start' },
[']c'] = { query = '@class.outer', desc = 'Next class start' },
[']i'] = { query = '@conditional.outer', desc = 'Next conditional start' },
[']l'] = { query = '@loop.outer', desc = 'Next loop start' },
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
[']S'] = { query = '@scope', query_group = 'locals', desc = 'Next scope' },
[']z'] = { query = '@fold', query_group = 'folds', desc = 'Next fold' },
},
goto_next_end = {
[']F'] = { query = '@call.outer', desc = 'Next function call end' },
[']M'] = { query = '@function.outer', desc = 'Next method/function def end' },
[']C'] = { query = '@class.outer', desc = 'Next class end' },
[']I'] = { query = '@conditional.outer', desc = 'Next conditional end' },
[']L'] = { query = '@loop.outer', desc = 'Next loop end' },
},
goto_previous_start = {
['[f'] = { query = '@call.outer', desc = 'Prev function call start' },
['[m'] = { query = '@function.outer', desc = 'Prev method/function def start' },
['[c'] = { query = '@class.outer', desc = 'Prev class start' },
['[i'] = { query = '@conditional.outer', desc = 'Prev conditional start' },
['[l'] = { query = '@loop.outer', desc = 'Prev loop start' },
},
goto_previous_end = {
['[F'] = { query = '@call.outer', desc = 'Prev function call end' },
['[M'] = { query = '@function.outer', desc = 'Prev method/function def end' },
['[C'] = { query = '@class.outer', desc = 'Prev class end' },
['[I'] = { query = '@conditional.outer', desc = 'Prev conditional end' },
['[L'] = { query = '@loop.outer', desc = 'Prev loop end' },
},
},
}
local ts_repeat_move = require('nvim-treesitter.textobjects.repeatable_move')
-- vim way: ; goes to the direction you were moving.
vim.keymap.set({ 'n', 'x', 'o' }, ';', ts_repeat_move.repeat_last_move)
vim.keymap.set({ 'n', 'x', 'o' }, ',', ts_repeat_move.repeat_last_move_opposite)
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
vim.keymap.set({ 'n', 'x', 'o' }, 'f', ts_repeat_move.builtin_f)
vim.keymap.set({ 'n', 'x', 'o' }, 'F', ts_repeat_move.builtin_F)
vim.keymap.set({ 'n', 'x', 'o' }, 't', ts_repeat_move.builtin_t)
vim.keymap.set({ 'n', 'x', 'o' }, 'T', ts_repeat_move.builtin_T)
return textobjects
+78
View File
@@ -0,0 +1,78 @@
local treesitter = require('nvim-treesitter.configs')
local textobjects = require('plugins.lang.textobjects')
local auto_install = require('lib.util').get_user_config('auto_install', true)
local installed_parsers = {}
if auto_install then
installed_parsers = require('plugins.list').ts_parsers
end
treesitter.setup({
ensure_installed = installed_parsers,
sync_install = false,
ignore_install = {},
auto_install = true,
textobjects = textobjects,
autopairs = { enable = true },
endwise = { enable = true },
autotag = { enable = true },
matchup = { enable = true },
indent = { enable = true },
highlight = {
enable = true,
disable = {},
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
textsubjects = {
enable = true,
prev_selection = ',',
keymaps = {
['.'] = { 'textsubjects-smart', desc = 'Select the current text subject' },
['a;'] = {
'textsubjects-container-outer',
desc = 'Select outer container (class, function, etc.)',
},
['i;'] = {
'textsubjects-container-inner',
desc = 'Select inside containers (classes, functions, etc.)',
},
},
},
refactor = {
highlight_definitions = {
enable = true,
clear_on_cursor_move = true,
},
highlight_current_scope = { enable = true },
smart_rename = {
enable = true,
keymaps = {
smart_rename = '<leader>rr',
},
},
navigation = {
enable = true,
keymaps = {
goto_definition = '<leader>rd',
list_definitions = '<leader>rl',
list_definitions_toc = '<leader>rh',
goto_next_usage = '<leader>rj',
goto_previous_usage = '<leader>rk',
},
},
},
})
+109
View File
@@ -0,0 +1,109 @@
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'--single-branch',
'https://github.com/folke/lazy.nvim.git',
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
local status_ok, lazy = pcall(require, 'lazy')
if not status_ok then
return
end
local icons = require('lib.icons')
local plugins = require('plugins.list').plugins
lazy.setup({
root = vim.fn.stdpath('data') .. '/lazy',
defaults = { lazy = true },
spec = plugins,
lockfile = vim.fn.stdpath('config') .. '/lua/plugins/lock.json',
concurrency = 8,
dev = { path = '~/Projects/GitHub/', patterns = {}, fallback = false },
install = { missing = true, colorscheme = { 'dracula' } },
git = {
log = { '--since=3 days ago' },
timeout = 120,
url_format = 'https://github.com/%s.git',
filter = true,
},
ui = {
size = { width = 0.9, height = 0.8 },
wrap = true,
border = 'rounded',
icons = {
cmd = icons.ui.Terminal,
config = icons.ui.Gear,
event = icons.ui.Electric,
ft = icons.documents.File,
init = icons.ui.Rocket,
import = icons.documents.Import,
keys = icons.ui.Keyboard,
lazy = icons.ui.Sleep,
loaded = icons.ui.CircleSmall,
not_loaded = icons.ui.CircleSmallEmpty,
plugin = icons.ui.Package,
runtime = icons.ui.NeoVim,
source = icons.ui.Code,
start = icons.ui.Play,
task = icons.ui.Check,
list = {
icons.ui.CircleSmall,
icons.ui.Arrow,
icons.ui.Star,
icons.ui.Minus,
},
},
browser = nil,
throttle = 20,
custom_keys = {
['<localleader>l'] = function(plugin)
require('lazy.util').float_term({ 'lazygit', 'log' }, {
cwd = plugin.dir,
})
end,
['<localleader>t'] = function(plugin)
require('lazy.util').float_term(nil, {
cwd = plugin.dir,
})
end,
},
},
diff = { cmd = 'git' },
checker = { enabled = false, concurrency = nil, notify = true, frequency = 3600 },
change_detection = { enabled = true, notify = true },
performance = {
cache = { enabled = true },
reset_packpath = true,
rtp = {
reset = true,
paths = {},
disabled_plugins = {
'gzip',
'tarPlugin',
'zipPlugin',
'tohtml',
-- 'tutor',
-- 'matchit',
-- 'matchparen',
-- 'netrwPlugin',
},
},
},
readme = {
root = vim.fn.stdpath('state') .. '/lazy/readme',
files = { 'README.md', 'lua/**/README.md' },
skip_if_doc_exists = true,
},
state = vim.fn.stdpath('state') .. '/lazy/state.json',
})
+539
View File
@@ -0,0 +1,539 @@
local function load_config(package)
return function()
require('plugins.' .. package)
end
end
local plugins = {
-- UI
{
'Mofiqul/dracula.nvim',
config = load_config('ui.dracula'),
lazy = false,
priority = 1000,
},
{
'nvim-lualine/lualine.nvim',
config = load_config('ui.lualine'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'lukas-reineke/indent-blankline.nvim',
config = load_config('ui.indentline'),
main = 'ibl',
event = { 'BufReadPre', 'BufNewFile' },
},
{
'HiPhish/rainbow-delimiters.nvim',
config = load_config('ui.rainbow'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'rcarriga/nvim-notify',
config = load_config('ui.notify'),
event = 'VeryLazy',
cmd = 'Notifications',
},
{
'stevearc/dressing.nvim',
config = load_config('ui.dressing'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'nvimdev/dashboard-nvim',
config = load_config('ui.dashboard'),
-- Only load when no arguments
event = function()
if vim.fn.argc() == 0 then
return 'VimEnter'
end
end,
cmd = 'Dashboard',
},
{
'gelguy/wilder.nvim',
build = function()
vim.cmd([[silent UpdateRemotePlugins]])
end,
config = load_config('ui.wilder'),
keys = { ':', '/', '?' },
},
{
'folke/zen-mode.nvim',
dependencies = {
'folke/twilight.nvim',
config = load_config('ui.twilight'),
},
config = load_config('ui.zen-mode'),
cmd = { 'ZenMode', 'Twilight' },
},
-- Language
{
'mfussenegger/nvim-dap',
dependencies = {
'rcarriga/nvim-dap-ui',
},
config = load_config('lang.dap'),
cmd = { 'DapUIToggle', 'DapToggleRepl', 'DapToggleBreakpoint' },
},
{
'nvim-neotest/neotest',
dependencies = {
'nvim-neotest/nvim-nio',
'olimorris/neotest-rspec',
'haydenmeade/neotest-jest',
},
config = load_config('lang.neotest'),
cmd = 'Neotest',
},
{
'michaelb/sniprun',
build = 'bash ./install.sh',
config = load_config('lang.sniprun'),
cmd = 'SnipRun',
},
{
'ThePrimeagen/refactoring.nvim',
config = load_config('lang.refactoring'),
},
{
'windwp/nvim-autopairs',
config = load_config('lang.autopairs'),
event = 'InsertEnter',
},
{
'echasnovski/mini.comment',
version = '*',
dependencies = 'JoosepAlviste/nvim-ts-context-commentstring',
config = load_config('lang.comment'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'echasnovski/mini.surround',
version = '*',
config = load_config('lang.surround'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'echasnovski/mini.ai',
version = '*',
config = load_config('lang.ai'),
event = { 'BufReadPre', 'BufNewFile' },
},
-- Tresitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
dependencies = {
'nvim-treesitter/nvim-treesitter-refactor',
'nvim-treesitter/nvim-treesitter-textobjects',
'RRethy/nvim-treesitter-endwise',
'RRethy/nvim-treesitter-textsubjects',
'windwp/nvim-ts-autotag',
},
config = load_config('lang.treesitter'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'ckolkey/ts-node-action',
dependencies = { 'nvim-treesitter' },
},
-- LSP
{
'neovim/nvim-lspconfig',
dependencies = {
'williamboman/mason-lspconfig.nvim',
'hrsh7th/cmp-nvim-lsp',
},
config = load_config('lang.lspconfig'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'folke/neodev.nvim',
ft = { 'lua', 'vim' },
config = load_config('lang.neodev'),
},
{
'nvimdev/lspsaga.nvim',
config = load_config('lang.lspsaga'),
event = 'LspAttach',
},
{
'Maan2003/lsp_lines.nvim',
config = load_config('lang.lsp-lines'),
event = 'LspAttach',
},
{
'williamboman/mason.nvim',
config = load_config('lang.mason'),
cmd = 'Mason',
},
{
'nvimtools/none-ls.nvim',
dependencies = { 'neovim/nvim-lspconfig', 'jay-babu/mason-null-ls.nvim' },
config = load_config('lang.null-ls'),
event = { 'BufReadPre', 'BufNewFile' },
},
-- Completion
{
'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-nvim-lua',
'L3MON4D3/LuaSnip',
'rafamadriz/friendly-snippets',
'saadparwaiz1/cmp_luasnip',
},
config = load_config('lang.cmp'),
event = 'InsertEnter',
},
{
'Exafunction/codeium.vim',
event = 'BufEnter',
cmd = 'Codeium',
build = 'Codeium Auth:',
dependencies = {
'nvim-lua/plenary.nvim',
'hrsh7th/nvim-cmp',
},
},
-- Tools
{
'nvim-tree/nvim-tree.lua',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = load_config('tools.nvim-tree'),
cmd = 'NvimTreeToggle',
},
{
'windwp/nvim-spectre',
config = load_config('tools.spectre'),
cmd = 'Spectre',
},
{
'abecodes/tabout.nvim',
config = load_config('tools.tabout'),
event = 'InsertEnter',
},
{
'folke/flash.nvim',
config = load_config('tools.flash'),
keys = {
{
's',
mode = { 'n', 'x', 'o' },
function()
require('flash').jump()
end,
desc = 'Flash',
},
{
'S',
mode = { 'n', 'x', 'o' },
function()
require('flash').treesitter()
end,
desc = 'Flash Treesitter',
},
{
'r',
mode = 'o',
function()
require('flash').remote()
end,
desc = 'Remote Flash',
},
{
'R',
mode = { 'o', 'x' },
function()
require('flash').treesitter_search()
end,
desc = 'Treesitter Search',
},
{
'<c-s>',
mode = { 'c' },
function()
require('flash').toggle()
end,
desc = 'Toggle Flash Search',
},
},
},
{
'numToStr/Navigator.nvim',
config = load_config('tools.navigator'),
event = function()
if vim.fn.exists('$TMUX') == 1 then
return 'VeryLazy'
end
end,
},
{
'm4xshen/hardtime.nvim',
dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' },
config = function()
require('hardtime').setup({ enabled = true })
end,
cmd = 'Hardtime',
},
{
'chrisgrieser/nvim-spider',
config = load_config('tools.spider'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'folke/which-key.nvim',
config = load_config('tools.which-key'),
event = 'VeryLazy',
},
{
'iamcco/markdown-preview.nvim',
build = function()
vim.fn['mkdp#util#install']()
end,
ft = 'markdown',
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' },
},
{
'uga-rosa/ccc.nvim',
config = load_config('tools.ccc'),
cmd = { 'CccHighlighterToggle', 'CccConvert', 'CccPick' },
},
{
'2kabhishek/termim.nvim',
cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' },
},
{
'2kabhishek/tdo.nvim',
dependencies = 'nvim-telescope/telescope.nvim',
cmd = { 'Tdo', 'TdoEntry', 'TdoNote', 'TdoTodos', 'TdoToggle', 'TdoFind', 'TdoFiles' },
keys = { '[t', ']t' },
},
{
'kndndrj/nvim-dbee',
dependencies = {
'MunifTanjim/nui.nvim',
},
build = function()
-- "curl", "wget", "bitsadmin", "go"
require('dbee').install('curl')
end,
config = load_config('tools.dbee'),
cmd = 'DBToggle',
enabled = false,
},
{
'stevearc/oil.nvim',
opts = {},
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = load_config('tools.oil'),
},
{
'aurum77/live-server.nvim',
build = function()
require("live_server.util").install()
end,
cmd = { "LiveServer", "LiveServerStart", "LiveServerStop" },
keys = {
{ "<A-F1>", ft = "html", "<cmd>LiveServer<CR>", desc = "Live Server" },
{ "<A-F2>", ft = "html", "<cmd>LiveServerStop<CR>", desc = "Live Server Stop" },
},
},
{
'Zeioth/compiler.nvim',
cmd = { "CompilerOpen", "CompilerToggleResults", "CompilerRedo" },
dependencies = { "stevearc/overseer.nvim" },
opts = {},
keys = {
{ "<F3>", "<cmd>CompilerOpen<cr>", desc = "Open Compiler" },
{ "<S-F3>", function() vim.cmd("CompilerStop") vim.cmd("CompilerRedo") end, desc = "Redo Compiler" },
{ "<F4>", "<cmd>CompilerToggleResults<cr>", desc = "Toggle Compiler Results" },
},
},
{
'stevearc/overseer.nvim',
cmd = {
"OverseerOpen",
"OverseerClose",
"OverseerToggle",
"OverseerSaveBundle",
"OverseerLoadBundle",
"OverseerDeleteBundle",
"OverseerRunCmd",
"OverseerRun",
"OverseerInfo",
"OverseerBuild",
"OverseerQuickAction",
"OverseerTaskAction ",
"OverseerClearCache",
},
opts = {
task_list = {
direction = "bottom",
min_height = 15,
max_height = 15,
default_detail = 1,
},
},
},
-- Telescope
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
},
'nvim-telescope/telescope-file-browser.nvim',
'nvim-telescope/telescope-symbols.nvim',
'molecule-man/telescope-menufacture',
'debugloop/telescope-undo.nvim',
},
config = load_config('tools.telescope'),
cmd = 'Telescope',
},
{
'ThePrimeagen/harpoon',
branch = 'harpoon2',
config = load_config('tools.harpoon'),
event = { 'BufReadPre', 'BufNewFile' },
},
{
'2kabhishek/nerdy.nvim',
dependencies = { 'stevearc/dressing.nvim' },
cmd = 'Nerdy',
},
-- Git
{
'2kabhishek/co-author.nvim',
dependencies = { 'stevearc/dressing.nvim' },
cmd = 'CoAuthor',
},
{
'ruifm/gitlinker.nvim',
config = load_config('tools.gitlinker'),
keys = '<leader>gy',
},
{
'lewis6991/gitsigns.nvim',
config = load_config('tools.gitsigns'),
cmd = 'Gitsigns',
event = { 'BufReadPre', 'BufNewFile' },
},
{
'tpope/vim-fugitive',
cmd = 'Git',
},
}
local ts_parsers = {
'bash',
'css',
'dart',
'elixir',
'gitcommit',
'go',
'html',
'java',
'javascript',
'json',
'lua',
'markdown',
'markdown_inline', -- markdown code blocks
'python',
'ruby',
'rust',
'typescript',
'vim',
'vimdoc',
'yaml',
}
local null_ls_sources = {
'shellcheck', -- bash lint
}
local lsp_servers = {
'bashls',
'jsonls',
'lua_ls',
'typos_lsp', -- check typos
'vimls',
}
local util = require('lib.util')
if util.is_present('npm') then
table.insert(lsp_servers, 'eslint')
table.insert(lsp_servers, 'tsserver')
end
if util.is_present('gem') then
local ror_nvim = {
'weizheheng/ror.nvim',
branch = 'main',
ft = 'ruby',
config = load_config('lang.ror'),
keys = {
{
'<leader>rc',
mode = { 'n', 'x', 'o' },
function()
vim.cmd('RorCommands')
end,
desc = 'Rails Commands',
},
},
}
local vim_rails = {
'tpope/vim-rails',
ft = 'ruby',
}
table.insert(lsp_servers, 'solargraph')
table.insert(lsp_servers, 'ruby_lsp')
table.insert(lsp_servers, 'rubocop')
table.insert(plugins, ror_nvim)
table.insert(plugins, vim_rails)
end
if util.is_present('dart') then
table.insert(lsp_servers, 'dartls')
end
if util.is_present('java') then
table.insert(lsp_servers, 'jdtls')
end
if util.is_present('pip') then
table.insert(lsp_servers, 'ruff_lsp')
table.insert(lsp_servers, 'pylsp')
end
if util.is_present('mix') then
table.insert(lsp_servers, 'elixirls')
end
if util.is_present('cargo') then
table.insert(lsp_servers, 'rust_analyzer')
end
return {
plugins = plugins,
lsp_servers = lsp_servers,
null_ls_sources = null_ls_sources,
ts_parsers = ts_parsers,
}
+82
View File
@@ -0,0 +1,82 @@
{
"LuaSnip": { "branch": "master", "commit": "8f3d3465ba5c7ade0a8adb41eca5736f291a3fa8" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"ccc.nvim": { "branch": "main", "commit": "1283eef5494c092a047baa34ed3e667f3cb2715e" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"co-author.nvim": { "branch": "main", "commit": "62fbb6d6a58339c968bcea92d0f097f4ea1efaa5" },
"codeium.vim": { "branch": "main", "commit": "31dd2962c81759be007895db6ce089feec397c86" },
"compiler.nvim": { "branch": "main", "commit": "cb14acd32ba9ea09d01bbe3493aefdc59b68965c" },
"dashboard-nvim": { "branch": "master", "commit": "6d06924b562de6f0bb136edf1bf549afbf6b7d00" },
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
"dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" },
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"gitsigns.nvim": { "branch": "main", "commit": "035da036e68e509ed158414416c827d022d914bd" },
"hardtime.nvim": { "branch": "main", "commit": "eaf4bc31b86419c26ad7b3a142dd36ca545ca2e4" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
"live-server.nvim": { "branch": "main", "commit": "f6f00a3f541251f0320910bb0d03c4ae14ee6d10" },
"lsp_lines.nvim": { "branch": "main", "commit": "dbfd8e96ec2696e1ceedcd23fd70e842256e3dea" },
"lspsaga.nvim": { "branch": "main", "commit": "f20985499cd8ff0fbbfe8e7c770428ef764fc3be" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" },
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"mini.ai": { "branch": "main", "commit": "ee9446a17c160aba6a04ff22097389c41872c878" },
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
"mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" },
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
"neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" },
"neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" },
"neotest-rspec": { "branch": "main", "commit": "c1c3f36e1b1a23698534e6326e90876f87b773a4" },
"nerdy.nvim": { "branch": "main", "commit": "1ad36242f40a8fd95ae5711258540a07a5dabb51" },
"none-ls.nvim": { "branch": "main", "commit": "e22c380008f36dc8c63b15d5c0f6c2cae46348af" },
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" },
"nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
"nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
"nvim-lspconfig": { "branch": "master", "commit": "2a1999b817050a977c33a5f0ad0cecd9f0e75a6e" },
"nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" },
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
"nvim-spectre": { "branch": "master", "commit": "026394a8458d62c6b7b305c076ce675420dbaa4c" },
"nvim-spider": { "branch": "main", "commit": "828444de406bc7df3b30c8e000ce6f54f0754499" },
"nvim-tree.lua": { "branch": "master", "commit": "5a18b9827491aa1aea710bc9b85c6b63ed0dad14" },
"nvim-treesitter": { "branch": "master", "commit": "3ef8d25df2d8eca6f15a6889cb2bc9d4c6101096" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "156d5782b3a68845f824156e45fc5bb038211e7b" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "9f9a6b307fb122f13708f78483222abd43b7bb3a" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" },
"nvim-web-devicons": { "branch": "master", "commit": "beb6367ab8496c9e43f22e0252735fdadae1872d" },
"oil.nvim": { "branch": "master", "commit": "f3a31eba24587bc038592103d8f7e64648292115" },
"overseer.nvim": { "branch": "master", "commit": "89942ad366c8a9bb93f82411de17dc7c644b4e3b" },
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "7ef0766b5cd2f5cdf4fcb08886f0a2ebf65981fa" },
"refactoring.nvim": { "branch": "master", "commit": "d2786877c91aa409c824f27b4ce8a9f560dda60a" },
"sniprun": { "branch": "master", "commit": "97daa506e2faa3939e0491642103635f9d22cd04" },
"tabout.nvim": { "branch": "master", "commit": "c442ae7788c30dbd41d259c51df4046cb8269a96" },
"tdo.nvim": { "branch": "main", "commit": "678d6fdaf9df964cdc516c8a716d5c4c27d79cdc" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "4d5fd21bae12ee6e9a79232e1c377f43c419d0c5" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope-menufacture": { "branch": "main", "commit": "79376f887f589a4240267383e8abc0a31861325a" },
"telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
"telescope-undo.nvim": { "branch": "main", "commit": "d19e2edc8b18d03283bd91f67310ac300ad003ce" },
"telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"termim.nvim": { "branch": "main", "commit": "2dba526e99c32a65db9599cfa90e85db13724a44" },
"ts-node-action": { "branch": "master", "commit": "e37eb458378de5d994df459a53711b2546abef0f" },
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
"vim-fugitive": { "branch": "master", "commit": "dac8e5c2d85926df92672bf2afb4fc48656d96c7" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
"zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
}
+10
View File
@@ -0,0 +1,10 @@
vim.opt.termguicolors = true
local ccc = require('ccc')
ccc.setup({
highlighter = {
auto_enable = true,
lsp = true,
},
})
+19
View File
@@ -0,0 +1,19 @@
local dbee = require('dbee')
dbee.setup({
sources = {
require('dbee.sources').EnvSource:new('NVIM_DB'),
-- require("dbee.sources").MemorySource:new({
-- {
-- name = "dbname",
-- type = "postgres",
-- url = "postgres://pguser:pguser@localhost:5602/dbname?sslmode=disable"
-- },
-- }),
-- require("dbee.sources").FileSource:new(vim.fn.stdpath("cache") .. "/dbee/config.json"),
},
})
vim.api.nvim_create_user_command('DBToggle', function()
require('dbee').toggle()
end, {})
+15
View File
@@ -0,0 +1,15 @@
local flash = require('flash')
local icons = require('lib.icons')
flash.setup({
prompt = {
enabled = true,
prefix = { { icons.ui.Separator .. icons.ui.Rocket .. icons.ui.ChevronRight .. ' ', 'FlashPromptIcon' } },
win_config = { relative = 'editor', width = 1, height = 1, row = 1, col = 0, zindex = 1000 },
},
modes = {
char = {
jump_labels = false,
},
},
})
+24
View File
@@ -0,0 +1,24 @@
local gitlinker = require('gitlinker')
gitlinker.setup({
opts = {
remote = nil,
add_current_line_on_normal_mode = true,
action_callback = require('gitlinker.actions').copy_to_clipboard,
print_url = true,
},
callbacks = {
['github.com'] = require('gitlinker.hosts').get_github_type_url,
['gitlab.com'] = require('gitlinker.hosts').get_gitlab_type_url,
['try.gitea.io'] = require('gitlinker.hosts').get_gitea_type_url,
['codeberg.org'] = require('gitlinker.hosts').get_gitea_type_url,
['bitbucket.org'] = require('gitlinker.hosts').get_bitbucket_type_url,
['try.gogs.io'] = require('gitlinker.hosts').get_gogs_type_url,
['git.sr.ht'] = require('gitlinker.hosts').get_srht_type_url,
['git.launchpad.net'] = require('gitlinker.hosts').get_launchpad_type_url,
['repo.or.cz'] = require('gitlinker.hosts').get_repoorcz_type_url,
['git.kernel.org'] = require('gitlinker.hosts').get_cgit_type_url,
['git.savannah.gnu.org'] = require('gitlinker.hosts').get_cgit_type_url,
},
mappings = '<leader>gy',
})
+93
View File
@@ -0,0 +1,93 @@
local gitsigns = require('gitsigns')
gitsigns.setup({
signs = {
add = {
hl = 'GitSignsAdd',
text = '│',
numhl = 'GitSignsAddNr',
linehl = 'GitSignsAddLn',
},
change = {
hl = 'GitSignsChange',
text = '│',
numhl = 'GitSignsChangeNr',
linehl = 'GitSignsChangeLn',
},
delete = {
hl = 'GitSignsDelete',
text = '_',
numhl = 'GitSignsDeleteNr',
linehl = 'GitSignsDeleteLn',
},
topdelete = {
hl = 'GitSignsDelete',
text = '‾',
numhl = 'GitSignsDeleteNr',
linehl = 'GitSignsDeleteLn',
},
changedelete = {
hl = 'GitSignsChange',
text = '~',
numhl = 'GitSignsChangeNr',
linehl = 'GitSignsChangeLn',
},
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = { interval = 1000, follow_files = true },
attach_to_untracked = true,
current_line_blame = false,
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol',
delay = 0,
ignore_whitespace = false,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil,
max_file_length = 40000,
preview_config = { border = 'single', style = 'minimal', relative = 'cursor', row = 0, col = 1 },
yadm = { enable = false },
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
map('n', ']c', function()
if vim.wo.diff then
return ']c'
end
vim.schedule(function()
gs.next_hunk()
end)
return '<Ignore>'
end, { expr = true, desc = 'Next Change' })
map('n', '[c', function()
if vim.wo.diff then
return '[c'
end
vim.schedule(function()
gs.prev_hunk()
end)
return '<Ignore>'
end, { expr = true, desc = 'Previous Change' })
map({ 'v' }, '<leader>ga', ':Gitsigns stage_hunk<CR>', { desc = 'Stage Hunk' })
map({ 'v' }, '<leader>gr', ':Gitsigns reset_hunk<CR>', { desc = 'Reset Hunk' })
map('n', '<leader>gB', function()
gs.blame_line({ full = true })
end, { desc = 'Blame With Preview' })
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end,
})
+51
View File
@@ -0,0 +1,51 @@
local harpoon = require('harpoon')
harpoon:setup({})
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
})
:find()
end
vim.keymap.set('n', '<leader>ha', function()
harpoon:list():append()
end, { desc = 'Add Mark' })
vim.keymap.set('n', '<leader>hh', function()
toggle_telescope(harpoon:list())
end, { desc = 'Telescope Marks' })
vim.keymap.set('n', '<leader>hm', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = 'Open UI' })
vim.keymap.set('n', '[h', function()
harpoon:list():prev()
end, { desc = 'Prev Mark' })
vim.keymap.set('n', ']h', function()
harpoon:list():next()
end, { desc = 'Next Mark' })
vim.keymap.set('n', '<leader>hk', function()
harpoon:list():prev()
end, { desc = 'Prev Mark' })
vim.keymap.set('n', '<leader>hj', function()
harpoon:list():next()
end, { desc = 'Next Mark' })
for i = 1, 9 do
vim.keymap.set('n', '<leader>h' .. i, function()
harpoon:list():select(i)
end, { desc = 'Mark ' .. i })
end
+8
View File
@@ -0,0 +1,8 @@
local navigator = require('Navigator')
navigator.setup({
auto_save = 'current',
disable_on_zoom = false,
mux = 'auto',
})
+92
View File
@@ -0,0 +1,92 @@
local nvim_tree = require('nvim-tree')
local icons = require('lib.icons')
local function on_attach(bufnr)
local api = require('nvim-tree.api')
local function opts(desc)
return {
desc = 'nvim-tree: ' .. desc,
buffer = bufnr,
noremap = true,
silent = true,
nowait = true,
}
end
api.config.mappings.default_on_attach(bufnr)
vim.keymap.set('n', 'Y', api.fs.copy.filename, opts('Copy Name'))
vim.keymap.set('n', 'y', api.fs.copy.relative_path, opts('Copy Relative Path'))
vim.keymap.set('n', 'l', api.node.open.edit, opts('Open'))
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Close Directory'))
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
vim.keymap.set('n', 'o', api.node.open.horizontal, opts('Open: Horizontal Split'))
end
nvim_tree.setup({
on_attach = on_attach,
hijack_directories = { enable = true },
update_cwd = true,
filters = {},
renderer = {
add_trailing = false,
group_empty = false,
highlight_git = false,
highlight_opened_files = 'none',
root_folder_modifier = ':t',
indent_markers = {
enable = false,
icons = { corner = icons.ui.Corner, edge = icons.ui.Edge, none = icons.ui.Edge },
},
icons = {
webdev_colors = true,
git_placement = 'before',
padding = ' ',
symlink_arrow = icons.ui.Arrow,
show = { file = true, folder = true, folder_arrow = true, git = true },
glyphs = {
default = icons.documents.File,
symlink = icons.documents.SymLink,
folder = {
arrow_open = icons.ui.ArrowOpen,
arrow_closed = icons.ui.ArrowClosed,
default = icons.documents.Folder,
open = icons.documents.OpenFolder,
empty = icons.documents.FolderEmpty,
empty_open = icons.documents.OpenFolderEmpty,
symlink = icons.documents.SymlinkFolder,
symlink_open = icons.documents.SymlinkFolder,
},
git = {
unstaged = icons.git.Mod,
staged = icons.git.Add,
unmerged = icons.git.Diff,
renamed = icons.git.Rename,
untracked = icons.git.Untrack,
deleted = icons.git.Remove,
ignored = icons.git.Ignore,
},
},
},
},
diagnostics = {
enable = true,
icons = {
hint = icons.diagnostics.Hint,
info = icons.diagnostics.Information,
warning = icons.diagnostics.Warning,
error = icons.diagnostics.Error,
},
},
update_focused_file = { enable = true, update_cwd = true, ignore_list = {} },
git = { enable = true, ignore = true, timeout = 500 },
view = {
width = 40,
side = 'left',
adaptive_size = true,
number = false,
relativenumber = false,
},
})
+24
View File
@@ -0,0 +1,24 @@
require("oil").setup({
use_default_keymaps = false,
keymaps = {
["q"] = "actions.close",
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-\\>"] = "actions.select_split",
["<C-enter>"] = "actions.select_vsplit", -- this is used to navigate left
["<C-t>"] = "actions.select_tab",
["<C-p>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-r>"] = "actions.refresh",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["h"] = "actions.toggle_hidden",
},
view_options = {
show_hidden = false,
},
})
+125
View File
@@ -0,0 +1,125 @@
local spectre = require('spectre')
spectre.setup({
color_devicons = true,
highlight = {
ui = 'String',
search = 'DiffChange',
replace = 'DiffDelete',
},
mapping = {
['toggle_line'] = {
map = 't',
cmd = "<cmd>lua require('spectre').toggle_line()<CR>",
desc = 'toggle current item',
},
['enter_file'] = {
map = '<cr>',
cmd = "<cmd>lua require('spectre.actions').select_entry()<CR>",
desc = 'goto current file',
},
['send_to_qf'] = {
map = 'Q',
cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
desc = 'send all item to quickfix',
},
['replace_cmd'] = {
map = 'c',
cmd = "<cmd>lua require('spectre.actions').replace_cmd()<CR>",
desc = 'input replace vim command',
},
['show_option_menu'] = {
map = 'o',
cmd = "<cmd>lua require('spectre').show_options()<CR>",
desc = 'show option',
},
['run_replace'] = {
map = 'R',
cmd = "<cmd>lua require('spectre.actions').run_replace()<CR>",
desc = 'replace all',
},
['change_view_mode'] = {
map = 'm',
cmd = "<cmd>lua require('spectre').change_view()<CR>",
desc = 'change result view mode',
},
['toggle_ignore_case'] = {
map = 'I',
cmd = "<cmd>lua require('spectre').change_options('ignore-case')<CR>",
desc = 'toggle ignore case',
},
['toggle_ignore_hidden'] = {
map = 'H',
cmd = "<cmd>lua require('spectre').change_options('hidden')<CR>",
desc = 'toggle search hidden',
},
},
find_engine = {
['rg'] = {
cmd = 'rg',
args = {
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
},
options = {
['ignore-case'] = {
value = '--ignore-case',
icon = '[I]',
desc = 'ignore case',
},
['hidden'] = {
value = '--hidden',
desc = 'hidden file',
icon = '[H]',
},
},
},
['ag'] = {
cmd = 'ag',
args = {
'--vimgrep',
'-s',
},
options = {
['ignore-case'] = {
value = '-i',
icon = '[I]',
desc = 'ignore case',
},
['hidden'] = {
value = '--hidden',
desc = 'hidden file',
icon = '[H]',
},
},
},
},
replace_engine = {
['sed'] = {
cmd = 'sed',
args = nil,
},
options = {
['ignore-case'] = {
value = '--ignore-case',
icon = '[I]',
desc = 'ignore case',
},
},
},
default = {
find = {
cmd = 'rg',
options = { 'ignore-case' },
},
replace = {
cmd = 'sed',
},
},
replace_vim_cmd = 'cdo',
is_open_target_win = true,
is_insert_mode = true,
})
+10
View File
@@ -0,0 +1,10 @@
local spider = require('spider')
spider.setup({
skipInsignificantPunctuation = true,
})
vim.keymap.set({ 'n', 'o', 'x' }, 'w', "<cmd>lua require('spider').motion('w')<CR>", { desc = 'Spider-w' })
vim.keymap.set({ 'n', 'o', 'x' }, 'e', "<cmd>lua require('spider').motion('e')<CR>", { desc = 'Spider-e' })
vim.keymap.set({ 'n', 'o', 'x' }, 'b', "<cmd>lua require('spider').motion('b')<CR>", { desc = 'Spider-b' })
vim.keymap.set({ 'n', 'o', 'x' }, 'ge', "<cmd>lua require('spider').motion('ge')<CR>", { desc = 'Spider-ge' })
+22
View File
@@ -0,0 +1,22 @@
local tabout = require('tabout')
tabout.setup({
tabkey = '<tab>',
backwards_tabkey = '<s-tab>',
act_as_tab = true,
act_as_shift_tab = true,
default_tab = '<C-t>',
default_shift_tab = '<C-d>',
enable_backwards = false,
completion = true,
tabouts = {
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = '`', close = '`' },
{ open = '(', close = ')' },
{ open = '[', close = ']' },
{ open = '{', close = '}' },
},
ignore_beginning = true,
exclude = { 'markdown' },
})
+67
View File
@@ -0,0 +1,67 @@
local actions = require('telescope.actions')
local action_state = require('telescope.actions.state')
local transform_mod = require('telescope.actions.mt').transform_mod
local function multiopen(prompt_bufnr, method)
local cmd_map = {
vertical = 'vsplit',
horizontal = 'split',
tab = 'tabe',
default = 'edit',
}
local picker = action_state.get_current_picker(prompt_bufnr)
local multi_selection = picker:get_multi_selection()
if #multi_selection > 0 then
require('telescope.pickers').on_close_prompt(prompt_bufnr)
pcall(vim.api.nvim_set_current_win, picker.original_win_id)
for i, entry in ipairs(multi_selection) do
local cmd = i == 1 and 'edit' or cmd_map[method]
vim.cmd(string.format('%s %s', cmd, entry.value))
end
else
actions['select_' .. method](prompt_bufnr)
end
end
local custom_actions = transform_mod({
multi_selection_open_vertical = function(prompt_bufnr)
multiopen(prompt_bufnr, 'vertical')
end,
multi_selection_open_horizontal = function(prompt_bufnr)
multiopen(prompt_bufnr, 'horizontal')
end,
multi_selection_open_tab = function(prompt_bufnr)
multiopen(prompt_bufnr, 'tab')
end,
multi_selection_open = function(prompt_bufnr)
multiopen(prompt_bufnr, 'default')
end,
})
local function stopinsert(callback)
return function(prompt_bufnr)
vim.cmd.stopinsert()
vim.schedule(function()
callback(prompt_bufnr)
end)
end
end
local multi_open_mappings = {
i = {
['<C-v>'] = stopinsert(custom_actions.multi_selection_open_vertical),
['<C-x>'] = stopinsert(custom_actions.multi_selection_open_horizontal),
['<C-t>'] = stopinsert(custom_actions.multi_selection_open_tab),
['<CR>'] = stopinsert(custom_actions.multi_selection_open),
},
n = {
['<C-v>'] = custom_actions.multi_selection_open_vertical,
['<C-x>'] = custom_actions.multi_selection_open_horizontal,
['<C-t>'] = custom_actions.multi_selection_open_tab,
['<CR>'] = custom_actions.multi_selection_open,
},
}
return multi_open_mappings
+163
View File
@@ -0,0 +1,163 @@
local telescope = require('telescope')
local actions = require('telescope.actions')
local multi_open_mappings = require('plugins.tools.telescope-multiopen')
local icons = require('lib.icons')
local function flash(prompt_bufnr)
require('flash').jump({
pattern = '^',
label = { after = { 0, 0 } },
search = {
mode = 'search',
exclude = {
function(win)
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= 'TelescopeResults'
end,
},
},
action = function(match)
local picker = require('telescope.actions.state').get_current_picker(prompt_bufnr)
picker:set_selection(match.pos[1] - 1)
end,
})
end
telescope.setup({
defaults = {
layout_config = {
height = 0.8,
width = 0.9,
prompt_position = 'top',
bottom_pane = {
height = 0.5,
preview_width = 0.6,
preview_cutoff = 120,
},
center = {
height = 0.4,
preview_cutoff = 40,
},
cursor = {
preview_cutoff = 40,
preview_width = 0.6,
},
horizontal = {
preview_width = 0.6,
preview_cutoff = 120,
},
vertical = {
preview_cutoff = 40,
},
},
prompt_prefix = icons.ui.Telescope .. icons.ui.ChevronRight,
selection_caret = icons.ui.Play,
multi_icon = icons.ui.Check,
path_display = { 'smart' },
sorting_strategy = 'ascending',
mappings = {
i = {
['<esc>'] = actions.close,
['<C-n>'] = actions.cycle_history_next,
['<C-p>'] = actions.cycle_history_prev,
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-c>'] = actions.close,
['<Down>'] = actions.move_selection_next,
['<Up>'] = actions.move_selection_previous,
['<CR>'] = actions.select_default,
['<C-x>'] = actions.select_horizontal,
['<C-v>'] = actions.select_vertical,
['<C-t>'] = actions.select_tab,
['<C-s>'] = flash,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
['<PageUp>'] = actions.results_scrolling_up,
['<PageDown>'] = actions.results_scrolling_down,
['<Tab>'] = actions.toggle_selection + actions.move_selection_worse,
['<S-Tab>'] = actions.toggle_selection + actions.move_selection_better,
['<C-q>'] = actions.send_to_qflist + actions.open_qflist,
['<M-q>'] = actions.send_selected_to_qflist + actions.open_qflist,
['<C-l>'] = actions.complete_tag,
},
n = {
['q'] = actions.close,
['<esc>'] = actions.close,
['<CR>'] = actions.select_default,
['<C-x>'] = actions.select_horizontal,
['<C-v>'] = actions.select_vertical,
['<C-t>'] = actions.select_tab,
['s'] = flash,
['<Tab>'] = actions.toggle_selection + actions.move_selection_worse,
['<S-Tab>'] = actions.toggle_selection + actions.move_selection_better,
['<C-q>'] = actions.send_to_qflist + actions.open_qflist,
['<M-q>'] = actions.send_selected_to_qflist + actions.open_qflist,
['j'] = actions.move_selection_next,
['k'] = actions.move_selection_previous,
['H'] = actions.move_to_top,
['M'] = actions.move_to_middle,
['L'] = actions.move_to_bottom,
['<Down>'] = actions.move_selection_next,
['<Up>'] = actions.move_selection_previous,
['gg'] = actions.move_to_top,
['G'] = actions.move_to_bottom,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
['<PageUp>'] = actions.results_scrolling_up,
['<PageDown>'] = actions.results_scrolling_down,
['?'] = actions.which_key,
},
},
},
pickers = {
find_files = { mappings = multi_open_mappings },
git_files = { mappings = multi_open_mappings },
oldfiles = { mappings = multi_open_mappings },
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = 'smart_case',
},
undo = {
use_delta = true,
use_custom_command = nil,
side_by_side = true,
diff_context_lines = vim.o.scrolloff,
entry_format = 'state #$ID, $STAT, $TIME',
-- time_format = '%d %b %H:%M',
mappings = {
i = {
['<S-cr>'] = require('telescope-undo.actions').yank_additions,
['<C-cr>'] = require('telescope-undo.actions').yank_deletions,
['<cr>'] = require('telescope-undo.actions').restore,
},
},
},
menufacture = { mappings = { main_menu = { [{ 'i', 'n' }] = '<C-e>' } } },
},
})
require('telescope').load_extension('fzf')
require('telescope').load_extension('menufacture')
require('telescope').load_extension('undo')
require('telescope').load_extension('harpoon')
require('telescope').load_extension('notify')
require('telescope').load_extension('refactoring')
require('telescope').load_extension('file_browser')
+459
View File
@@ -0,0 +1,459 @@
local which_key = require('which-key')
local icons = require('lib.icons')
local setup = {
plugins = {
marks = true,
registers = true,
spelling = {
enabled = true,
suggestions = 30,
},
presets = {
operators = true,
motions = true,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
},
key_labels = {
['<leader>'] = icons.ui.Rocket,
['<space>'] = '<spc>',
['<Tab>'] = '<tab>',
},
icons = {
breadcrumb = icons.ui.ArrowOpen,
separator = icons.ui.Arrow,
group = '',
},
popup_mappings = {
scroll_down = '<c-d>',
scroll_up = '<c-u>',
},
window = {
border = 'shadow',
position = 'bottom',
margin = { 0, 0, 0, 0 },
padding = { 1, 2, 1, 2 },
winblend = 10,
},
layout = {
height = { min = 4, max = 24 },
width = { min = 20, max = 50 },
spacing = 3,
align = 'center',
},
ignore_missing = false,
hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', '^:', '^ ', '^call ', '^lua ' },
show_help = true,
show_keys = true,
triggers = 'auto',
triggers_nowait = {
-- marks
'`',
"'",
'g`',
"g'",
-- registers
'"',
'<c-r>',
-- spelling
'z=',
},
triggers_blacklist = {
i = { 'j', 'j' },
v = { 'j', 'j' },
},
}
local i = {
[' '] = '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',
}
local a = vim.deepcopy(i)
for k, v in pairs(a) do
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)
end
local opts = {
mode = 'n',
prefix = '<leader>',
buffer = nil,
silent = true,
noremap = true,
nowait = true,
}
local mappings = {
[','] = { '<cmd>b#<cr>', icons.ui.History .. 'Recent' },
q = { '<cmd>q<cr>', icons.ui.Close .. 'Quit' },
Q = { '<cmd>qa!<cr>', icons.ui.Power .. 'Force Quit!' },
w = { '<cmd>w<cr>', icons.ui.Save .. 'Save' },
x = { '<cmd>x<cr>', icons.ui.Pencil .. 'Write and Quit' },
c = {
name = icons.ui.NeoVim .. 'Config',
c = { '<cmd>CccConvert<cr>', 'Convert Color' },
d = { '<cmd>RootDir<cr>', 'Root Directory' },
e = { '<cmd>e $MYVIMRC<cr>', 'Edit Config' },
f = { '<cmd>lua vim.lsp.buf.format({async = true})<cr>', 'Format File' },
F = { '<cmd>retab<cr>', 'Fix Tabs' },
i = { vim.show_pos, 'Inspect Position' },
l = { '<cmd>:g/^\\s*$/d<cr>', 'Clean Empty Lines' },
n = { '<cmd>set relativenumber!<cr>', 'Relative Numbers' },
p = { '<cmd>CccPick<cr>', 'Pick Color' },
r = { '<cmd>Telescope reloader<cr>', 'Reload Module' },
R = { '<cmd>ReloadConfig<cr>', 'Reload Configs' },
},
b = {
name = icons.ui.Bug .. 'Debug',
b = { '<cmd>DapToggleBreakpoint<cr>', 'Breakpoint' },
c = { '<cmd>DapContinue<cr>', 'Continue' },
i = { '<cmd>DapStepInto<cr>', 'Into' },
l = { "<cmd>lua require'dap'.run_last()<cr>", 'Last' },
o = { '<cmd>DapStepOver<cr>', 'Over' },
O = { '<cmd>DapStepOut<cr>', 'Out' },
r = { '<cmd>DapToggleRepl<cr>', 'Repl' },
R = { '<cmd>DapRestartFrame<cr>', 'Restart Frame' },
t = { '<cmd>DapUIToggle<cr>', 'Debugger' },
x = { '<cmd>DapTerminate<cr>', 'Exit' },
},
d = {
name = icons.ui.Database .. 'Database',
b = { '<cmd>DBToggle<cr>', 'DB Explorer' },
j = { '<cmd>lua require("dbee").next()<cr>', 'DB Next' },
k = { '<cmd>lua require("dbee").prev()<cr>', 'DB Prev' },
s = { '<cmd>lua require("dbee").store("csv", "buffer", { extra_arg = 0 })<cr>', 'To CSV' },
S = { '<cmd>lua require("dbee").store("json", "buffer", { extra_arg = 0 })<cr>', 'To JSON' },
t = { '<cmd>lua require("dbee").store("table", "buffer", { extra_arg = 0 })<cr>', 'To Table' },
},
E = {
name = icons.documents.OpenFolder .. 'Explorer',
e = { '<cmd>NvimTreeToggle<cr>', 'File Explorer' },
f = { '<cmd>NvimTreeFindFileToggle<CR>', 'Toggle file explorer on current file' },
r = { '<cmd>NvimTreeRefresh<CR>', 'Refresh file explorer' },
},
f = {
name = icons.ui.Telescope .. 'Find',
b = { '<cmd>Telescope buffers<cr>', 'Buffers' },
B = { '<cmd>Telescope git_branches<cr>', 'Checkout branch' },
a = { '<cmd>lua require("telescope").extensions.menufacture.find_files()<cr>', 'All Files' },
c = { '<cmd>Telescope git_bcommits<cr>', 'File Commits' },
C = { '<cmd>Telescope git_commits<cr>', 'Git Commits' },
d = { '<cmd>Telescope file_browser<cr>', 'Browse Folders' },
e = { '<cmd>Oil<cr>', 'Dir Editor' },
f = { '<cmd>lua require("telescope").extensions.menufacture.git_files()<cr>', 'Find files' },
g = { '<cmd>lua require("telescope").extensions.menufacture.live_grep()<cr>', 'Find Text' },
G = { '<cmd>lua require("telescope").extensions.menufacture.grep_string()<cr>', 'Find Word' },
h = { '<cmd>Telescope help_tags<cr>', 'Help' },
H = { '<cmd>Telescope man_pages<cr>', 'Man Pages' },
k = { '<cmd>Telescope commands<cr>', 'Commands' },
K = { '<cmd>Telescope keymaps<cr>', 'Keymaps' },
l = { '<cmd>Telescope resume<cr>', 'Last Search' },
L = { '<cmd>Telescope loclist<cr>', 'Location List' },
n = { '<cmd>enew<cr>', 'New File' },
r = { '<cmd>Telescope oldfiles<cr>', 'Recent Files' },
p = { '<cmd>Telescope<cr>', 'Panel' },
q = { '<cmd>Telescope quickfix<cr>', 'Quickfix' },
s = { '<cmd>Telescope live_grep grep_open_files=true<cr>', 'Find in Open Files' },
u = { '<cmd>Telescope undo<cr>', 'Undo History' },
['"'] = { '<cmd>Telescope registers<cr>', 'Registers' },
['.'] = { '<cmd>Telescope symbols<cr>', 'Emojis' },
[','] = { '<cmd>Nerdy<cr>', 'Nerd Glyphs' },
},
g = {
name = icons.git.Octoface .. 'Git',
a = { '<cmd>Gitsigns stage_hunk<cr>', 'Stage Hunk' },
A = { '<cmd>Gitsigns stage_buffer<cr>', 'Stage Buffer' },
b = { '<cmd>Gitsigns blame_line<cr>', 'Blame' },
c = { '<cmd>Git<cr>', 'Commit' },
C = { '<cmd>CoAuthor<cr>', 'Add Co Author' },
d = { '<cmd>Gitsigns preview_hunk<cr>', 'Preview Hunk' },
D = { '<cmd>Gitsigns diffthis HEAD<cr>', 'Diff' },
g = { '<cmd>Fterm lazygit<cr>', 'Lazygit' },
j = { '<cmd>Gitsigns next_hunk<cr>', 'Next Hunk' },
k = { '<cmd>Gitsigns prev_hunk<cr>', 'Prev Hunk' },
r = { '<cmd>Gitsigns reset_hunk<cr>', 'Reset Hunk' },
R = { '<cmd>Gitsigns reset_buffer<cr>', 'Reset Buffer' },
s = { '<cmd>Telescope git_status<cr>', 'Changed files' },
S = { '<cmd>Telescope git_stash<cr>', 'Stashed Changes' },
t = {
name = 'Git Toggle',
b = { '<cmd>Gitsigns toggle_current_line_blame<cr>', 'Blame' },
d = { '<cmd>Gitsigns toggle_deleted<cr>', 'Deleted' },
l = { '<cmd>Gitsigns toggle_linehl<cr>', 'Line HL' },
n = { '<cmd>Gitsigns toggle_numhl<cr>', 'Number HL' },
s = { '<cmd>Gitsigns toggle_signs<cr>', 'Signs' },
w = { '<cmd>Gitsigns toggle_word_diff<cr>', 'Word Diff' },
},
u = { '<cmd>Gitsigns undo_stage_hunk<cr>', 'Undo Stage Hunk' },
v = { '<cmd>Gitsigns select_hunk<cr>', 'Select Hunk' },
},
h = { name = icons.ui.Bookmark .. 'Harpoon' },
l = {
name = icons.ui.Gear .. 'LSP',
a = { '<cmd>Lspsaga code_action<cr>', 'Code Action' },
d = { '<cmd>Lspsaga peek_definition<cr>', 'Peek Definition' },
D = { '<cmd>Lspsaga goto_definition<cr>', 'Goto Definition' },
f = { '<cmd>Lspsaga finder<cr>', 'Finder' },
F = { '<cmd>Telescope lsp_references<cr>', 'References' },
h = { '<cmd>Lspsaga hover_doc<cr>', 'Hover' },
i = { '<cmd>Telescope diagnostics<cr>', 'Diagnostics' },
I = { '<cmd>Lspsaga show_workspace_diagnostics<cr>', 'Workspace Diagnostics' },
j = { '<cmd>Lspsaga diagnostic_jump_next<cr>', 'Next Diagnostic' },
k = { '<cmd>Lspsaga diagnostic_jump_prev<cr>', 'Prev Diagnostic' },
l = { "<cmd>lua require('lsp_lines').toggle()<cr>", 'Toggle LSP Lines' },
L = { '<cmd>LspInfo<cr>', 'LSP Info' },
o = { '<cmd>Lspsaga outline<cr>', 'Outline' },
p = { '<cmd>Telescope lsp_incoming_calls<cr>', 'Incoming Calls' },
P = { '<cmd>Telescope lsp_outgoing_calls<cr>', 'Outgoing Calls' },
r = { '<cmd>Lspsaga rename<cr>', 'Rename' },
R = { '<cmd>Lspsaga project_replace<cr>', 'Replace' },
s = { '<cmd>Telescope lsp_document_symbols<cr>', 'Document Symbols' },
S = { '<cmd>Telescope lsp_dynamic_workspace_symbols<cr>', 'Workspace Symbols' },
t = { '<cmd>Lspsaga peek_type_definition<cr>', 'Peek Type Definition' },
T = { '<cmd>Lspsaga goto_type_definition<cr>', 'Goto Type Definition' },
},
m = {
name = icons.kind.Field .. 'Modes',
c = { '<cmd>CccHighlighterToggle<cr>', 'Highlight Colors' },
d = { '<cmd>Dashboard<cr>', 'Dashboard' },
h = { '<cmd>Hardtime toggle<cr>', 'Hardtime' },
m = { '<cmd>MarkdownPreviewToggle<cr>', 'Markdown Preview' },
n = { '<cmd>Telescope notify<cr>', 'Notifications' },
r = { '<cmd>%SnipRun<cr>', 'Run File' },
s = { '<cmd>set spell!<cr>', 'Spellcheck' },
z = { '<cmd>ZenMode<cr>', 'ZenMode' },
Z = { '<cmd>Twilight<cr>', 'Twilight' },
},
n = {
name = icons.ui.Note .. 'Notes',
d = { '<cmd>Tdo<cr>', "Today's Todo" },
e = { '<cmd>TdoEntry<cr>', "Today's Entry" },
f = { '<cmd>TdoFiles<cr>', 'All Notes' },
g = { '<cmd>TdoFind<cr>', 'Find Notes' },
h = { '<cmd>Tdo -1<cr>', "Yesterday's Todo" },
j = { "<cmd>put =strftime('%a %d %b %r')<cr>", 'Insert Human Date' },
J = { "<cmd>put =strftime('%F')<cr>", 'Insert Date' },
k = { "<cmd>put =strftime('%r')<cr>", 'Insert Human Time' },
K = { "<cmd>put =strftime('%F-%H-%M')<cr>", 'Insert Time' },
l = { '<cmd>Tdo 1<cr>', "Tomorrow's Todo" },
n = { '<cmd>TdoNote<cr>', 'New Note' },
s = {
'<cmd>lua require("tdo").run_with("commit " .. vim.fn.expand("%:p")) vim.notify("Committed!")<cr>',
'Commit Note',
},
t = { '<cmd>TdoTodos<cr>', 'Incomplete Todos' },
x = { '<cmd>TdoToggle<cr>', 'Toggle Todo' },
},
p = {
name = icons.ui.Package .. 'Packages',
c = { '<cmd>Lazy check<cr>', 'Check' },
d = { '<cmd>Lazy debug<cr>', 'Debug' },
p = { '<cmd>Lazy<cr>', 'Plugins' },
P = { '<cmd>Lazy profile<cr>', 'Profile' },
m = { '<cmd>Mason<cr>', 'Mason' },
i = { '<cmd>Lazy install<cr>', 'Install' },
l = { '<cmd>Lazy log<cr>', 'Log' },
r = { '<cmd>Lazy restore<cr>', 'Restore' },
s = { '<cmd>Lazy sync<cr>', 'Sync' },
u = { '<cmd>Lazy update<cr>', 'Update' },
x = { '<cmd>Lazy clean<cr>', 'Clean' },
},
r = {
name = icons.diagnostics.Hint .. 'Refactor',
b = { "<cmd>lua require('spectre').open_file_search()<cr>", 'Replace Buffer' },
e = { "<cmd>lua require('refactoring').refactor('Extract Block')<CR>", 'Extract Block' },
f = { "<cmd>lua require('refactoring').refactor('Extract Block To File')<CR>", 'Extract To File' },
i = { "<cmd>lua require('refactoring').refactor('Inline Variable')<CR>", 'Inline Variable' },
n = { '', 'Swap Next' },
p = { '', 'Swap Previous' },
r = { '', 'Smart Rename' },
d = { '', 'Go To Definition' },
h = { '', 'List Definition Head' },
l = { '', 'List Definition' },
j = { '', 'Next Usage' },
k = { '', 'Previous Usage' },
R = { "<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>", 'Refactor Commands' },
S = { "<cmd>lua require('spectre').open()<cr>", 'Replace' },
s = { [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], 'Replace Word' },
v = { "<cmd>lua require('refactoring').refactor('Extract Variable')<CR>", 'Extract Variable' },
w = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", 'Replace Word' },
},
t = {
name = icons.ui.Terminal .. 'Terminal',
['`'] = { '<cmd>Sterm<cr>', 'Horizontal Terminal' },
n = { '<cmd>Sterm node<cr>', 'Node' },
p = { '<cmd>Sterm bpython<cr>', 'Python' },
r = { '<cmd>Sterm irb<cr>', 'Ruby' },
s = { '<cmd>Sterm<cr>', 'Horizontal Terminal' },
t = { '<cmd>Fterm<cr>', 'Terminal' },
v = { '<cmd>Vterm<cr>', 'Vertical Terminal' },
},
T = {
name = icons.ui.Test .. 'Test',
f = { '<cmd>lua require("neotest").run.run(vim.fn.expand("%"))<cr>', 'Run Test' },
F = { '<cmd>lua require("neotest").run.run()<cr>', 'Run Current Test' },
o = { '<cmd>Neotest output-panel<cr>', 'Test Output' },
O = { '<cmd>Neotest summary<cr>', 'Test Summary' },
},
s = {
name = icons.ui.Windows .. 'Split',
[','] = { '<cmd>NavigatorPrevious<cr>', 'Previous Split' },
['-'] = { '<C-w>s', 'Split Below' },
['\\'] = { '<C-w>v', 'Split Right' },
c = { '<cmd>tabclose<cr>', 'Close Tab' },
d = { '<C-w>c', 'Close Window' },
f = { '<cmd>tabfirst<cr>', 'First Tab' },
h = { '<C-w>h', 'Move Left' },
j = { '<C-w>j', 'Move Down' },
k = { '<C-w>k', 'Move Up' },
l = { '<C-w>l', 'Move Right' },
L = { '<cmd>tablast<cr>', 'Last Tab' },
o = { '<cmd>tabnext<cr>', 'Next Tab' },
O = { '<cmd>tabprevious<cr>', 'Previous Tab' },
p = { '<C-w>p', 'Previous Window' },
q = { '<cmd>bw<cr>', 'Close Current Buf' },
s = { '<cmd>split<cr>', 'Horizontal Split File' },
t = { '<cmd>tabnew<cr>', 'New Tab' },
v = { '<cmd>vsplit<cr>', 'Vertical Split File' },
W = { "<cmd>lua require'utils'.sudo_write()<cr>", 'Force Write' },
w = { '<cmd>w<cr>', 'Write' },
x = { '<cmd>x<cr>', 'Write and Quit' },
},
y = {
name = icons.ui.Clipboard .. 'Yank',
f = { '<cmd>%y+<cr>', 'Copy Whole File' },
p = { '<cmd>CRpath<cr>', 'Copy Relative Path' },
P = { '<cmd>CApath<cr>', 'Copy Absolute Path' },
g = { '<cmd>lua require"gitlinker".get_buf_range_url()<cr>', 'Copy Git URL' },
},
}
local vopts = {
mode = 'v',
prefix = '<leader>',
buffer = nil,
silent = true,
noremap = true,
nowait = true,
}
local vmappings = {
l = {
name = icons.ui.Gear .. 'LSP',
a = '<cmd><C-U>Lspsaga range_code_action<CR>',
},
r = {
name = icons.diagnostics.Hint .. 'Refactor',
r = { "<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>", 'Refactor Commands' },
e = { "<esc><cmd>lua require('refactoring').refactor('Extract Function')<CR>", 'Extract Function' },
f = { "<esc><cmd>lua require('refactoring').refactor('Extract Function To File')<CR>", 'Extract To File' },
v = { "<esc><cmd>lua require('refactoring').refactor('Extract Variable')<CR>", 'Extract Variable' },
i = { "<esc><cmd>lua require('refactoring').refactor('Inline Variable')<CR>", 'Inline Variable' },
},
s = { "<esc><cmd>'<,'>SnipRun<cr>", icons.ui.Play .. 'Run Code' },
q = { '<cmd>q<cr>', icons.ui.Close .. 'Quit' },
Q = { '<cmd>qa!<cr>', icons.ui.Power .. 'Force Quit!' },
x = { '<cmd>x<cr>', icons.ui.Pencil .. 'Write and Quit' },
y = {
name = icons.ui.Clipboard .. 'Yank',
g = { '<cmd>lua require"gitlinker".get_buf_range_url()<cr>', 'Copy Git URL' },
},
}
local no_leader_opts = {
mode = 'n',
prefix = '',
buffer = nil,
silent = true,
noremap = true,
nowait = true,
}
local no_leader_mappings = {
['<S-h>'] = { '<cmd>bprevious<cr>', 'Previous Buffer' },
['<S-l>'] = { '<cmd>bnext<cr>', 'Next Buffer' },
['<C-h>'] = { '<C-w>h', 'Move Left' },
['<C-j>'] = { '<C-w>j', 'Move Down' },
['<C-k>'] = { '<C-w>k', 'Move Up' },
['<C-l>'] = { '<C-w>l', 'Move Right' },
['<C-Up>'] = { '<cmd>resize +10<cr>', 'Increase window height' },
['<C-Down>'] = { '<cmd>resize -10<cr>', 'Decrease window height' },
['<C-Left>'] = { '<cmd>vertical resize -10<cr>', 'Decrease window width' },
['<C-Right>'] = { '<cmd>vertical resize +10<cr>', 'Increase window width' },
['<C-f>'] = { '<cmd>Telescope find_files<cr>', 'Find Files' },
['<C-g>'] = { '<cmd>Fterm lazygit<cr>', 'Lazygit' },
['['] = {
name = icons.ui.ArrowLeft .. 'Previous',
b = { '<cmd>bprevious<cr>', 'Buffer' },
B = { '<cmd>bfirst<cr>', 'First Buffer' },
d = { '<cmd>Lspsaga diagnostic_jump_prev<cr>', 'Diagnostic' },
e = { 'g;', 'Edit' },
g = { '<cmd>Gitsigns prev_hunk<cr>', 'Git Hunk' },
j = { '<C-o>', 'Jump' },
},
[']'] = {
name = icons.ui.ArrowRight .. 'Next',
b = { '<cmd>bnext<cr>', 'Buffer' },
B = { '<cmd>blast<cr>', 'Buffer' },
d = { '<cmd>Lspsaga diagnostic_jump_next<cr>', 'Diagnostic' },
e = { 'g,', 'Edit' },
g = { '<cmd>Gitsigns next_hunk<cr>', 'Git Hunk' },
j = { '<C-i>', 'Jump' },
},
K = { '<cmd>Lspsaga hover_doc<cr>', 'LSP Hover' },
U = { '<cmd>redo<cr>', 'Redo' },
}
if vim.fn.exists('$TMUX') == 1 then
local tmux_mappings = {
['<C-h>'] = { '<cmd>NavigatorLeft<cr>', 'Move Left' },
['<C-j>'] = { '<cmd>NavigatorDown<cr>', 'Move Down' },
['<C-k>'] = { '<cmd>NavigatorUp<cr>', 'Move Up' },
['<C-l>'] = { '<cmd>NavigatorRight<cr>', 'Move Right' },
['<C-m>'] = { '<cmd>NavigatorPrevious<cr>', 'Goto Previous' },
}
no_leader_mappings = vim.tbl_extend('force', no_leader_mappings, tmux_mappings)
end
which_key.setup(setup)
which_key.register(mappings, opts)
which_key.register(vmappings, vopts)
which_key.register(no_leader_mappings, no_leader_opts)
which_key.register({ mode = { 'o', 'x' }, i = i, a = a })
+82
View File
@@ -0,0 +1,82 @@
local dashboard = require('dashboard')
local icons = require('lib.icons')
dashboard.setup({
theme = 'hyper',
disable_move = false,
shortcut_type = 'letter',
change_to_vcs_root = true,
hide = {
statusline = true,
tabline = false,
winbar = false,
},
config = {
header = { '',
' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ',
' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ',
' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ',
' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ',
' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ',
' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ',
'',},
week_header = {
enable = false,
append = { '', icons.ui.Circle .. ' Learn, Make, Explore! ' .. icons.ui.Circle },
},
packages = { enable = true },
project = { enable = true, limit = 8 },
mru = { limit = 8 },
shortcut = {
{
desc = icons.ui.Package .. 'Mason',
group = '@property',
action = 'Mason',
key = 'm',
},
{
desc = icons.ui.Sleep .. 'Lazy',
group = '@property',
action = 'Lazy',
key = 'l',
},
{
desc = icons.documents.OpenFolder .. 'Files',
group = 'Label',
action = 'lua require("telescope").extensions.menufacture.find_files()',
key = 'f',
},
{
desc = icons.ui.Search .. 'Search',
group = 'Label',
action = 'lua require("telescope").extensions.menufacture.live_grep()',
key = 'g',
},
{
desc = icons.ui.Note .. 'Todo',
group = 'Label',
action = 'Tdo',
key = 'd',
},
{
desc = icons.ui.Power,
group = 'Action',
action = 'quit',
key = 'q',
},
},
footer = { '', icons.ui.Heart .. ' Happiness is a state of mind. ' .. icons.ui.Heart },
},
})
-- Show dashboard when lazy closes
if vim.o.filetype == 'lazy' then
vim.cmd.close()
vim.api.nvim_create_autocmd('User', {
pattern = 'DashboardLoaded',
callback = function()
require('lazy').show()
end,
})
end
+69
View File
@@ -0,0 +1,69 @@
local dracula = require("dracula")
dracula.setup({
colors = {
bg = "#282A36",
fg = "#F8F8F2",
selection = "#44475A",
comment = "#6272A4",
red = "#FF5555",
orange = "#FFB86C",
yellow = "#F1FA8C",
green = "#50fa7b",
purple = "#BD93F9",
cyan = "#8BE9FD",
pink = "#FF79C6",
bright_red = "#FF6E6E",
bright_green = "#69FF94",
bright_yellow = "#FFFFA5",
bright_blue = "#D6ACFF",
bright_magenta = "#FF92DF",
bright_cyan = "#A4FFFF",
bright_white = "#FFFFFF",
menu = "#21222C",
visual = "#3E4452",
gutter_fg = "#4B5263",
nontext = "#3B4048",
},
-- show the '~' characters after the end of buffers
show_end_of_buffer = true, -- default false
-- use transparent background
transparent_bg = true, -- default false
-- set custom lualine background color
lualine_bg_color = "#44475a", -- default nil
-- set italic comment
italic_comment = true, -- default false
-- overrides the default highlights see `:h synIDattr`
overrides = {
PmenuSel = {link = "lualine_a_insert"},
TelescopeSelection = {link = "lualine_a_insert"},
BufferTabpages = {link = "lualine_a_visual"}
-- Nothing = {} -- clear highlight of Nothing
},
integrations = {
cmp = true,
fidget = true,
gitsigns = true,
harpoon = true,
indent_blankline = {
enabled = false,
colored_indent_levels = false,
},
mason = true,
native_lsp = { enabled = true },
noice = true,
notify = true,
symbols_outline = true,
telescope = true,
treesitter = true,
treesitter_context = true,
},
})
vim.cmd.colorscheme("dracula")
-- Hide all semantic highlights until upstream issues are resolved (https://github.com/catppuccin/nvim/issues/480)
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
vim.api.nvim_set_hl(0, group, {})
end
+27
View File
@@ -0,0 +1,27 @@
local dressing = require('dressing')
dressing.setup({
win_options = {
winblend = 10,
winhighlight = 'Normal:DressingInputNormalFloat,NormalFloat:DressingInputNormalFloat,FloatBorder:DressingInputFloatBorder',
},
input = {
enabled = true,
default_prompt = 'Input:',
prompt_align = 'left',
insert_only = true,
start_in_insert = true,
border = 'rounded',
relative = 'cursor',
prefer_width = 40,
width = nil,
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
get_config = nil,
},
select = {
enabled = true,
backend = { 'telescope', 'fzf_lua', 'fzf', 'nui', 'builtin' },
trim_prompt = true,
},
})
+27
View File
@@ -0,0 +1,27 @@
local highlight = {
'RainbowRed',
'RainbowYellow',
'RainbowBlue',
'RainbowOrange',
'RainbowGreen',
'RainbowViolet',
'RainbowCyan',
}
local hooks = require('ibl.hooks')
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({
scope = { highlight = highlight },
exclude = { filetypes = { 'dashboard', 'toggleterm' } },
})
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
+196
View File
@@ -0,0 +1,196 @@
local lualine = require('lualine')
local icons = require('lib.icons')
local colors = {
bg = '#202328',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
local mode_color = {
n = colors.green,
i = colors.blue,
v = colors.magenta,
[''] = colors.magenta,
V = colors.magenta,
c = colors.yellow,
t = colors.red,
R = colors.orange,
Rv = colors.orange,
no = colors.fg,
s = colors.violet,
S = colors.violet,
[''] = colors.violet,
ic = colors.yellow,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
buffer_is_file = function()
return vim.bo.buftype == ''
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
local searchcount = { 'searchcount', color = { fg = colors.fg, gui = 'bold' } }
local selectioncount = { 'selectioncount', color = { fg = colors.fg, gui = 'bold' } }
local progress = { 'progress', color = { fg = colors.fg, gui = 'bold' } }
local filetype = { 'filetype', color = { fg = colors.blue, gui = 'bold' } }
local filesize = { 'filesize', color = { fg = colors.fg, gui = 'bold' }, cond = conditions.buffer_not_empty }
local fileformat = { 'fileformat', icons_enabled = true, color = { fg = colors.white, gui = 'bold' } }
local filename = {
'filename',
cond = conditions.buffer_not_empty and conditions.buffer_is_file,
color = { fg = colors.magenta, gui = 'bold' },
}
local buffers = {
'buffers',
filetype_names = {
TelescopePrompt = icons.ui.Telescope .. 'Telescope',
dashboard = icons.ui.Dashboard .. 'Dashboard',
lazy = icons.ui.Sleep .. 'Lazy',
mason = icons.ui.Package .. 'Mason',
NvimTree = icons.documents.OpenFolder .. 'Files',
spectre_panel = icons.ui.Search .. 'Spectre',
},
use_mode_colors = true,
}
local branch = {
'branch',
icon = icons.git.Branch,
fmt = function(str)
return str:sub(1, 32)
end,
color = { fg = colors.green, gui = 'bold' },
}
local diff_icons = {
'diff',
symbols = { added = icons.git.AddAlt, modified = icons.git.DiffAlt, removed = icons.git.RemoveAlt },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
local diagnostics = {
'diagnostics',
sources = { 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic' },
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warning,
info = icons.diagnostics.Information,
hint = icons.diagnostics.Hint,
},
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.blue },
color_hint = { fg = colors.yellow },
},
}
local lsp = {
function()
local msg = 'No LSP'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = icons.ui.Gear,
color = { fg = colors.fg, gui = 'bold' },
}
local encoding = {
'o:encoding',
fmt = string.upper,
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
local separator = {
function()
return icons.ui.Separator
end,
color = function()
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { left = 0, right = 0 },
}
local function mode(icon)
icon = icon or icons.ui.NeoVim
return {
function()
return icon
end,
color = function()
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { left = 1, right = 0 },
}
end
lualine.setup({
options = {
component_separators = '',
-- section_separators = '',
theme = 'onedark',
disabled_filetypes = {
'dashboard',
},
},
-- extensions = { 'quickfix', 'man', 'mason', 'lazy', 'toggleterm', 'nvim-tree' },
tabline = {
lualine_a = {},
lualine_b = { mode(), buffers },
lualine_c = {},
lualine_x = { diff_icons, branch },
lualine_y = { searchcount, selectioncount },
lualine_z = {},
},
sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { separator, mode(icons.ui.Heart), 'location', progress, filename },
lualine_x = { diagnostics, lsp, filetype, filesize, fileformat, encoding, separator },
lualine_y = {},
lualine_z = {},
},
})
+56
View File
@@ -0,0 +1,56 @@
local notify = require('notify')
local icons = require('lib.icons')
notify.setup({
background_colour = '#000',
fps = 30,
icons = {
DEBUG = icons.ui.Bug,
ERROR = icons.diagnostics.Error,
INFO = icons.diagnostics.Information,
TRACE = icons.ui.Bookmark,
WARN = icons.diagnostics.Warning,
},
level = 2,
render = 'default',
stages = 'fade_in_slide_out',
timeout = 2000,
top_down = true,
max_height = function()
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
end,
on_open = function(win)
vim.api.nvim_win_set_config(win, { zindex = 100 })
end,
})
-- Controls noisy notifications
local buffered_messages = {
'Client %d+ quit',
'No node found at cursor',
}
local message_notifications = {}
vim.notify = function(msg, level, opts)
opts = opts or {}
for _, pattern in ipairs(buffered_messages) do
if string.find(msg, pattern) then
if message_notifications[pattern] then
opts.replace = message_notifications[pattern]
end
opts.on_close = function()
message_notifications[pattern] = nil
end
message_notifications[pattern] = notify.notify(msg, level, opts)
return
end
end
notify.notify(msg, level, opts)
end
+19
View File
@@ -0,0 +1,19 @@
local rainbow_delimiters = require('rainbow-delimiters')
vim.g.rainbow_delimiters = {
strategy = {
[''] = rainbow_delimiters.strategy['global'],
commonlisp = rainbow_delimiters.strategy['local'],
},
query = { [''] = 'rainbow-delimiters', lua = 'rainbow-blocks' },
highlight = {
'RainbowDelimiterRed',
'RainbowDelimiterYellow',
'RainbowDelimiterBlue',
'RainbowDelimiterOrange',
'RainbowDelimiterGreen',
'RainbowDelimiterViolet',
'RainbowDelimiterCyan',
},
blacklist = {},
}
+9
View File
@@ -0,0 +1,9 @@
local twilight = require('twilight')
twilight.setup({
dimming = { alpha = 0.45, color = { 'Normal', '#ffffff' }, inactive = false },
context = 9,
treesitter = true,
expand = { 'function', 'method', 'table', 'if_statement', 'element' },
exclude = {},
})
+66
View File
@@ -0,0 +1,66 @@
local wilder = require('wilder')
wilder.setup({ modes = { ':', '/', '?' } })
wilder.set_option('pipeline', {
wilder.branch(
wilder.cmdline_pipeline({
fuzzy = 1,
set_pcre2_pattern = 1,
}),
wilder.python_search_pipeline({
pattern = 'fuzzy',
})
),
})
local accent = wilder.make_hl('WilderAccent', 'Pmenu', { { a = 1 }, { a = 1 }, { foreground = '#F8F8F2' } })
local icons = require('lib.icons')
local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_palette_theme({
border = 'rounded',
max_height = '75%',
min_height = 0,
prompt_position = 'top',
reverse = 0,
empty_message = wilder.popupmenu_empty_message_with_spinner(),
highlighter = wilder.basic_highlighter(),
highlights = {
accent = accent,
},
left = {
' ',
wilder.popupmenu_devicons(),
wilder.popupmenu_buffer_flags({
flags = ' a + ',
icons = {
['+'] = icons.ui.Pencil,
a = icons.documents.File,
h = icons.documents.FileEmpty,
},
}),
},
right = {
' ',
wilder.popupmenu_scrollbar(),
},
}))
local wildmenu_renderer = wilder.wildmenu_renderer({
highlighter = wilder.basic_highlighter(),
highlights = { accent = accent },
separator = ' | ',
left = { ' ', wilder.wildmenu_spinner(), ' ' },
right = { ' ', wilder.wildmenu_index() },
})
wilder.set_option(
'renderer',
wilder.renderer_mux({
[':'] = popupmenu_renderer,
['/'] = popupmenu_renderer,
['?'] = popupmenu_renderer,
substitute = wildmenu_renderer,
})
)
+31
View File
@@ -0,0 +1,31 @@
local zen = require('zen-mode')
zen.setup({
window = {
backdrop = 0.95,
width = 180,
height = 1,
options = {
signcolumn = 'no',
number = false,
relativenumber = false,
cursorline = false,
cursorcolumn = false,
foldcolumn = '0',
list = false,
},
},
plugins = {
options = { enabled = true, ruler = true, showcmd = true },
twilight = { enabled = true },
gitsigns = { enabled = true },
tmux = { enabled = true },
kitty = { enabled = false, font = '+4' },
},
on_open = function(win)
vim.o.laststatus = 0
end,
on_close = function()
vim.o.laststatus = 2
end,
})