did some nvim congs

intermediate
This commit is contained in:
Christoph J. Scherr 2023-09-06 01:26:46 +02:00
parent d98c062f38
commit e5a2a74f3a
70 changed files with 237 additions and 130 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lazy-lock.json

View File

@ -1,17 +1,18 @@
-- plex Neovim entry-point -- rafi Neovim entry-point
-- https://git.cscherr.de/PlexSheep/neovim-conf -- https://git.cscherr.de/PlexSheep/neovim-conf
local config = require('plex.config') local config = require('rafi.config')
config.ensure_lazy() config.ensure_lazy()
-- Start lazy.nvim plugin manager. -- Start lazy.nvim plugin manager.
require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), { require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
spec = { spec = {
{ import = 'plex.plugins' }, { import = 'rafi.plugins' },
-- { import = 'plex.plugins.extras.lang.go' }, { import = 'rafi.plugins.extras.lang.go' },
-- { import = 'plex.plugins.extras.lang.json' }, { import = 'rafi.plugins.extras.lang.json' },
-- { import = 'plex.plugins.extras.lang.python' }, { import = 'rafi.plugins.extras.lang.python' },
-- { import = 'plex.plugins.extras.lang.yaml' }, { import = 'rafi.plugins.extras.lang.yaml' },
{ import = 'plugins' },
-- This will load a custom user lua/plugins.lua or lua/plugins/* -- This will load a custom user lua/plugins.lua or lua/plugins/*
config.has_user_plugins() and { import = 'plugins' } or nil, config.has_user_plugins() and { import = 'plugins' } or nil,

78
lua/plugins/neo-tree.lua Normal file
View File

@ -0,0 +1,78 @@
local winwidth = 30
-- Toggle width.
local toggle_width = function()
local max = winwidth * 2
local cur_width = vim.fn.winwidth(0)
local half = math.floor((winwidth + (max - winwidth) / 2) + 0.4)
local new_width = winwidth
if cur_width == winwidth then
new_width = half
elseif cur_width == half then
new_width = max
else
new_width = winwidth
end
vim.cmd(new_width .. ' wincmd |')
end
return {
-- Change builtin plugins' options
{
'nvim-neo-tree/neo-tree.nvim',
keys = {
{
'<F5>',
'<cmd>Neotree filesystem left toggle dir=./<CR>',
desc = 'Explorer NeoTree Toggle',
},
},
-- FIXME: Delete the damn event handler, keep the file window open when I
-- tell it to!
event_handlers = {nil},
window = {
width = winwidth,
mappings = {
['q'] = 'close_window',
['?'] = 'noop',
['<Space>'] = 'noop',
['g?'] = 'show_help',
['<2-LeftMouse>'] = 'open',
['<CR>'] = 'open_with_window_picker',
['l'] = 'open_drop',
['h'] = 'close_node',
['C'] = 'close_node',
['<C-c>'] = 'set_root',
['z'] = 'close_all_nodes',
['<C-r>'] = 'refresh',
['s'] = 'noop',
['sv'] = 'open_split',
['sg'] = 'open_vsplit',
['st'] = 'open_tabnew',
['c'] = { 'copy', config = { show_path = 'relative' } },
['m'] = { 'move', config = { show_path = 'relative' } },
['a'] = { 'add', nowait = true, config = { show_path = 'relative' } },
['N'] = { 'add_directory', config = { show_path = 'relative' } },
['d'] = 'noop',
['dd'] = 'delete',
['r'] = 'rename',
['y'] = 'copy_to_clipboard',
['x'] = 'cut_to_clipboard',
['P'] = 'paste_from_clipboard',
['<S-Tab>'] = 'prev_source',
['<Tab>'] = 'next_source',
['p'] = {
'toggle_preview',
nowait = true,
config = { use_float = true },
},
['w'] = toggle_width,
},
},
},
}

22
lua/plugins/org/neorg.lua Normal file
View File

@ -0,0 +1,22 @@
return {
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
},
},
},
},
}
end,
},
}

View File

@ -1,11 +1,11 @@
-- Rafi's Neovim autocmds -- Rafi's Neovim autocmds
-- github.com/plex/vim-config -- github.com/rafi/vim-config
-- === -- ===
-- This file is automatically loaded by plex.config.init -- This file is automatically loaded by rafi.config.init
local function augroup(name) local function augroup(name)
return vim.api.nvim_create_augroup('plex_' .. name, {}) return vim.api.nvim_create_augroup('rafi_' .. name, {})
end end
-- Check if we need to reload the file when it changed -- Check if we need to reload the file when it changed

View File

@ -1,5 +1,5 @@
-- Rafi's Neovim config loader -- Rafi's Neovim config loader
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
-- This is part of LazyVim's code, with my modifications. -- This is part of LazyVim's code, with my modifications.
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/init.lua -- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/init.lua
@ -14,12 +14,12 @@ local defaults = {
-- Load the default settings -- Load the default settings
-- stylua: ignore -- stylua: ignore
defaults = { defaults = {
autocmds = true, -- plex.config.autocmds autocmds = true, -- rafi.config.autocmds
keymaps = true, -- plex.config.keymaps keymaps = true, -- rafi.config.keymaps
-- plex.config.options can't be configured here since it's loaded -- rafi.config.options can't be configured here since it's loaded
-- prematurely. You can disable loading options with the following line at -- prematurely. You can disable loading options with the following line at
-- the top of your lua/config/setup.lua or init.lua: -- the top of your lua/config/setup.lua or init.lua:
-- `package.loaded['plex.config.options'] = true` -- `package.loaded['rafi.config.options'] = true`
}, },
-- String like `habamax` or a function that will load the colorscheme. -- String like `habamax` or a function that will load the colorscheme.
@ -107,12 +107,12 @@ function M.init()
if not M.did_init then if not M.did_init then
M.did_init = true M.did_init = true
-- delay notifications till vim.notify was replaced or after 500ms -- delay notifications till vim.notify was replaced or after 500ms
require('plex.config').lazy_notify() require('rafi.config').lazy_notify()
-- load options here, before lazy init while sourcing plugin modules -- load options here, before lazy init while sourcing plugin modules
-- this is needed to make sure options will be correctly applied -- this is needed to make sure options will be correctly applied
-- after installing missing plugins -- after installing missing plugins
require('plex.config').load('options') require('rafi.config').load('options')
-- carry over plugin options that their name has been changed. -- carry over plugin options that their name has been changed.
local Plugin = require('lazy.core.plugin') local Plugin = require('lazy.core.plugin')
@ -130,7 +130,7 @@ end
---@type RafiConfig ---@type RafiConfig
local options local options
-- Load plex and user config files. -- Load rafi and user config files.
---@param user_opts table|nil ---@param user_opts table|nil
function M.setup(user_opts) function M.setup(user_opts)
if not M.did_init then if not M.did_init then
@ -153,7 +153,7 @@ function M.setup(user_opts)
options = vim.tbl_deep_extend('force', options, user_setup.override()) options = vim.tbl_deep_extend('force', options, user_setup.override())
end end
for feat_name, feat_val in pairs(options.features) do for feat_name, feat_val in pairs(options.features) do
vim.g['plex_' .. feat_name] = feat_val vim.g['rafi_' .. feat_name] = feat_val
end end
M.load('autocmds') M.load('autocmds')
@ -209,9 +209,9 @@ function M.load(name)
end, end,
}) })
end end
-- always load plex's file, then user file -- always load rafi's file, then user file
if M.defaults[name] or name == 'options' then if M.defaults[name] or name == 'options' then
_load('plex.config.' .. name) _load('rafi.config.' .. name)
end end
_load('config.' .. name) _load('config.' .. name)
if vim.bo.filetype == 'lazy' then if vim.bo.filetype == 'lazy' then

View File

@ -1,18 +1,18 @@
-- Rafi's Neovim keymaps -- Rafi's Neovim keymaps
-- github.com/plex/vim-config -- github.com/rafi/vim-config
-- === -- ===
-- This file is automatically loaded by plex.config.init -- This file is automatically loaded by rafi.config.init
local Util = require('plex.lib.utils') local Util = require('rafi.lib.utils')
local map = vim.keymap.set local map = vim.keymap.set
local function augroup(name) local function augroup(name)
return vim.api.nvim_create_augroup('plex_' .. name, {}) return vim.api.nvim_create_augroup('rafi_' .. name, {})
end end
-- Elite-mode: Arrow-keys resize window -- Elite-mode: Arrow-keys resize window
if vim.g.plex_elite_mode then if vim.g.rafi_elite_mode then
map('n', '<Up>', '<cmd>resize +1<cr>', { desc = 'Resize Window' }) map('n', '<Up>', '<cmd>resize +1<cr>', { desc = 'Resize Window' })
map('n', '<Down>', '<cmd>resize -1<cr>', { desc = 'Resize Window' }) map('n', '<Down>', '<cmd>resize -1<cr>', { desc = 'Resize Window' })
map('n', '<Left>', '<cmd>vertical resize +1<cr>', { desc = 'Resize Window' }) map('n', '<Left>', '<cmd>vertical resize +1<cr>', { desc = 'Resize Window' })
@ -57,10 +57,10 @@ map('n', '[a', '<cmd>lprev<CR>', { desc = 'Previous Loclist Item' })
-- Whitespace jump (see plugin/whitespace.vim) -- Whitespace jump (see plugin/whitespace.vim)
map('n', ']s', function() map('n', ']s', function()
require('plex.lib.edit').whitespace_jump(1) require('rafi.lib.edit').whitespace_jump(1)
end, { desc = 'Next Whitespace' }) end, { desc = 'Next Whitespace' })
map('n', '[s', function() map('n', '[s', function()
require('plex.lib.edit').whitespace_jump(-1) require('rafi.lib.edit').whitespace_jump(-1)
end, { desc = 'Previous Whitespace' }) end, { desc = 'Previous Whitespace' })
-- Navigation in command line -- Navigation in command line
@ -160,7 +160,7 @@ map('x', 'sg', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection
map( map(
'x', 'x',
'<C-r>', '<C-r>',
":<C-u>%s/\\V<C-R>=v:lua.require'plex.lib.edit'.get_visual_selection()<CR>" ":<C-u>%s/\\V<C-R>=v:lua.require'rafi.lib.edit'.get_visual_selection()<CR>"
.. '//gc<Left><Left><Left>', .. '//gc<Left><Left><Left>',
{ desc = 'Replace Selection' } { desc = 'Replace Selection' }
) )
@ -215,7 +215,7 @@ map({ 'n', 'i', 'v' }, '<C-s>', '<cmd>write<CR>', { desc = 'Save' })
-- === -- ===
-- Toggle editor's visual effects -- Toggle editor's visual effects
map('n', '<leader>uf', require('plex.plugins.lsp.format').toggle, { desc = 'Toggle format on Save' }) map('n', '<leader>uf', require('rafi.plugins.lsp.format').toggle, { desc = 'Toggle format on Save' })
map('n', '<Leader>us', '<cmd>setlocal spell!<CR>', { desc = 'Toggle Spellcheck' }) map('n', '<Leader>us', '<cmd>setlocal spell!<CR>', { desc = 'Toggle Spellcheck' })
map('n', '<Leader>ul', '<cmd>setlocal nonumber!<CR>', { desc = 'Toggle Line Numbers' }) map('n', '<Leader>ul', '<cmd>setlocal nonumber!<CR>', { desc = 'Toggle Line Numbers' })
map('n', '<Leader>uo', '<cmd>setlocal nolist!<CR>', { desc = 'Toggle Whitespace Symbols' }) map('n', '<Leader>uo', '<cmd>setlocal nolist!<CR>', { desc = 'Toggle Whitespace Symbols' })
@ -260,20 +260,20 @@ end
-- Append mode-line to current buffer -- Append mode-line to current buffer
map('n', '<Leader>ml', function() map('n', '<Leader>ml', function()
require('plex.lib.edit').append_modeline() require('rafi.lib.edit').append_modeline()
end, { desc = 'Append Modeline' }) end, { desc = 'Append Modeline' })
-- Jump entire buffers throughout jumplist -- Jump entire buffers throughout jumplist
map('n', 'g<C-i>', function() map('n', 'g<C-i>', function()
require('plex.lib.edit').jump_buffer(1) require('rafi.lib.edit').jump_buffer(1)
end, { desc = 'Jump to newer buffer' }) end, { desc = 'Jump to newer buffer' })
map('n', 'g<C-o>', function() map('n', 'g<C-o>', function()
require('plex.lib.edit').jump_buffer(-1) require('rafi.lib.edit').jump_buffer(-1)
end, { desc = 'Jump to older buffer' }) end, { desc = 'Jump to older buffer' })
-- Context aware menu. See lua/lib/contextmenu.lua -- Context aware menu. See lua/lib/contextmenu.lua
map('n', '<LocalLeader>c', function() map('n', '<LocalLeader>c', function()
require('plex.lib.contextmenu').show() require('rafi.lib.contextmenu').show()
end, { desc = 'Content-aware menu' }) end, { desc = 'Content-aware menu' })
-- Lazygit -- Lazygit
@ -307,7 +307,7 @@ end
-- === -- ===
-- Ultimatus Quitos -- Ultimatus Quitos
if vim.F.if_nil(vim.g.plex_window_q_mapping, true) then if vim.F.if_nil(vim.g.rafi_window_q_mapping, true) then
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, { vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, {
group = augroup('quit_mapping'), group = augroup('quit_mapping'),
callback = function(event) callback = function(event)
@ -321,7 +321,7 @@ end
-- Toggle quickfix window -- Toggle quickfix window
map('n', '<Leader>q', function() map('n', '<Leader>q', function()
require('plex.lib.edit').toggle_list('quickfix') require('rafi.lib.edit').toggle_list('quickfix')
end, { desc = 'Open Quickfix' }) end, { desc = 'Open Quickfix' })
-- Set locations with diagnostics and open the list. -- Set locations with diagnostics and open the list.
@ -329,7 +329,7 @@ map('n', '<Leader>a', function()
if vim.bo.filetype ~= 'qf' then if vim.bo.filetype ~= 'qf' then
vim.diagnostic.setloclist({ open = false }) vim.diagnostic.setloclist({ open = false })
end end
require('plex.lib.edit').toggle_list('loclist') require('rafi.lib.edit').toggle_list('loclist')
end, { desc = 'Open Location List' }) end, { desc = 'Open Location List' })
-- Switch with adjacent window -- Switch with adjacent window

View File

@ -1,5 +1,5 @@
-- Rafi's Neovim options -- Rafi's Neovim options
-- github.com/plex/vim-config -- github.com/rafi/vim-config
-- === -- ===
-- This file is automatically loaded by config.init or plugins.core -- This file is automatically loaded by config.init or plugins.core

View File

@ -2,7 +2,7 @@ local M = {}
---@param opts? RafiConfig ---@param opts? RafiConfig
function M.setup(opts) function M.setup(opts)
require('plex.config').setup(opts) require('rafi.config').setup(opts)
end end
return M return M

View File

@ -1,5 +1,5 @@
-- Badge utilities -- Badge utilities
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local plugin_icons = { local plugin_icons = {
DiffviewFiles = { '' }, DiffviewFiles = { '' },
@ -27,7 +27,7 @@ local cache_keys = {
'badge_cache_icon', 'badge_cache_icon',
} }
local augroup = vim.api.nvim_create_augroup('plex_badge', {}) local augroup = vim.api.nvim_create_augroup('rafi_badge', {})
-- Clear cached values that relate to buffer filename. -- Clear cached values that relate to buffer filename.
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
@ -60,7 +60,7 @@ local M = {}
-- Try to guess the project's name -- Try to guess the project's name
---@return string ---@return string
function M.project() function M.project()
return vim.fn.fnamemodify(require('plex.lib.utils').get_root(), ':t') or '' return vim.fn.fnamemodify(require('rafi.lib.utils').get_root(), ':t') or ''
end end
-- Provides relative path with limited characters in each directory name, and -- Provides relative path with limited characters in each directory name, and

View File

@ -1,5 +1,5 @@
-- Context-aware menu -- Context-aware menu
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local M = {} local M = {}

View File

@ -1,5 +1,5 @@
-- Edit utilities -- Edit utilities
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local M = {} local M = {}

View File

@ -1,5 +1,5 @@
-- plex preview functions -- rafi preview functions
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
-- requires telescope -- requires telescope
local M = {} local M = {}

View File

@ -1,11 +1,11 @@
-- General utilities -- General utilities
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local root_patterns = { '.git', '_darcs', '.hg', '.bzr', '.svn' } local root_patterns = { '.git', '_darcs', '.hg', '.bzr', '.svn' }
local M = {} local M = {}
local augroup_lsp_attach = vim.api.nvim_create_augroup('plex_lsp_attach', {}) local augroup_lsp_attach = vim.api.nvim_create_augroup('rafi_lsp_attach', {})
---@param on_attach fun(client:lsp.Client, buffer:integer) ---@param on_attach fun(client:lsp.Client, buffer:integer)
function M.on_attach(on_attach) function M.on_attach(on_attach)

View File

@ -1,5 +1,5 @@
-- Plugins: Coding -- Plugins: Coding
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
return { return {
@ -111,8 +111,8 @@ return {
}), }),
formatting = { formatting = {
format = function(entry, vim_item) format = function(entry, vim_item)
-- Prepend with a fancy icon from config lua/plex/config/init.lua -- Prepend with a fancy icon from config lua/rafi/config/init.lua
local icons = require('plex.config').icons local icons = require('rafi.config').icons
if entry.source.name == 'git' then if entry.source.name == 'git' then
vim_item.kind = icons.git vim_item.kind = icons.git
else else

View File

@ -1,17 +1,17 @@
-- Plugins: Colorschemes -- Plugins: Colorschemes
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
return { return {
{ {
'plex/theme-loader.nvim', 'rafi/theme-loader.nvim',
lazy = false, lazy = false,
priority = 99, priority = 99,
opts = { initial_colorscheme = 'neohybrid' }, opts = { initial_colorscheme = 'neohybrid' },
}, },
{ 'plex/neo-hybrid.vim', priority = 100, lazy = false }, { 'rafi/neo-hybrid.vim', priority = 100, lazy = false },
{ 'plex/awesome-vim-colorschemes', lazy = false }, { 'rafi/awesome-vim-colorschemes', lazy = false },
{ 'AlexvZyl/nordic.nvim' }, { 'AlexvZyl/nordic.nvim' },
{ 'folke/tokyonight.nvim', opts = { style = 'night' } }, { 'folke/tokyonight.nvim', opts = { style = 'night' } },
{ 'rebelot/kanagawa.nvim' }, { 'rebelot/kanagawa.nvim' },

View File

@ -1,4 +1,4 @@
require('plex.config').init() require('rafi.config').init()
return { return {
{ 'folke/lazy.nvim', version = '*' }, { 'folke/lazy.nvim', version = '*' },

View File

@ -1,5 +1,5 @@
-- Plugins: Editor -- Plugins: Editor
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local is_windows = vim.loop.os_uname().sysname == 'Windows_NT' local is_windows = vim.loop.os_uname().sysname == 'Windows_NT'
@ -49,14 +49,14 @@ return {
-- Detect if stdin has been provided. -- Detect if stdin has been provided.
vim.g.in_pager_mode = false vim.g.in_pager_mode = false
vim.api.nvim_create_autocmd('StdinReadPre', { vim.api.nvim_create_autocmd('StdinReadPre', {
group = vim.api.nvim_create_augroup('plex_persisted', {}), group = vim.api.nvim_create_augroup('rafi_persisted', {}),
callback = function() callback = function()
vim.g.in_pager_mode = true vim.g.in_pager_mode = true
end, end,
}) })
-- Close all floats before loading a session. (e.g. Lazy.nvim) -- Close all floats before loading a session. (e.g. Lazy.nvim)
vim.api.nvim_create_autocmd('User', { vim.api.nvim_create_autocmd('User', {
group = 'plex_persisted', group = 'rafi_persisted',
pattern = 'PersistedLoadPre', pattern = 'PersistedLoadPre',
callback = function() callback = function()
for _, win in pairs(vim.api.nvim_tabpage_list_wins(0)) do for _, win in pairs(vim.api.nvim_tabpage_list_wins(0)) do
@ -69,7 +69,7 @@ return {
-- Close all plugin owned buffers before saving a session. -- Close all plugin owned buffers before saving a session.
vim.api.nvim_create_autocmd('User', { vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedSavePre', pattern = 'PersistedSavePre',
group = 'plex_persisted', group = 'rafi_persisted',
callback = function() callback = function()
-- Detect if window is owned by plugin by checking buftype. -- Detect if window is owned by plugin by checking buftype.
local current_buffer = vim.api.nvim_get_current_buf() local current_buffer = vim.api.nvim_get_current_buf()
@ -90,7 +90,7 @@ return {
-- current session to avoid previous session to be overwritten. -- current session to avoid previous session to be overwritten.
vim.api.nvim_create_autocmd('User', { vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedTelescopeLoadPre', pattern = 'PersistedTelescopeLoadPre',
group = 'plex_persisted', group = 'rafi_persisted',
callback = function() callback = function()
require('persisted').save() require('persisted').save()
require('persisted').stop() require('persisted').stop()
@ -100,7 +100,7 @@ return {
-- will be auto-saved. -- will be auto-saved.
vim.api.nvim_create_autocmd('User', { vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedTelescopeLoadPost', pattern = 'PersistedTelescopeLoadPost',
group = 'plex_persisted', group = 'rafi_persisted',
callback = function(session) callback = function(session)
require('persisted').start() require('persisted').start()
print('Started session ' .. session.data.name) print('Started session ' .. session.data.name)
@ -148,7 +148,7 @@ return {
-- also set it after loading ftplugins, since a lot overwrite [[ and ]] -- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_illuminate', {}), group = vim.api.nvim_create_augroup('rafi_illuminate', {}),
callback = function() callback = function()
local buffer = vim.api.nvim_get_current_buf() local buffer = vim.api.nvim_get_current_buf()
map(']]', 'next', buffer) map(']]', 'next', buffer)
@ -365,7 +365,7 @@ return {
}, },
init = function() init = function()
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_outline', {}), group = vim.api.nvim_create_augroup('rafi_outline', {}),
pattern = 'Outline', pattern = 'Outline',
callback = function() callback = function()
vim.opt_local.winhighlight = 'CursorLine:WildMenu' vim.opt_local.winhighlight = 'CursorLine:WildMenu'

View File

@ -24,7 +24,7 @@ return {
optional = true, optional = true,
event = 'VeryLazy', event = 'VeryLazy',
opts = function(_, opts) opts = function(_, opts)
local get_color = require('plex.lib.color').get_color local get_color = require('rafi.lib.color').get_color
local fg = function(...) local fg = function(...)
return { fg = get_color('fg', ...) } return { fg = get_color('fg', ...) }
end end
@ -38,7 +38,7 @@ return {
-- Add copilot icon to lualine statusline -- Add copilot icon to lualine statusline
table.insert(opts.sections.lualine_x, { table.insert(opts.sections.lualine_x, {
function() function()
local icon = require('plex.config').icons.kinds.Copilot local icon = require('rafi.config').icons.kinds.Copilot
local status = require('copilot.api').status.data local status = require('copilot.api').status.data
return icon .. (status.message or '') return icon .. (status.message or '')
end, end,
@ -80,7 +80,7 @@ return {
-- attach cmp source whenever copilot attaches -- attach cmp source whenever copilot attaches
-- fixes lazy-loading issues with the copilot cmp source -- fixes lazy-loading issues with the copilot cmp source
---@param client lsp.Client ---@param client lsp.Client
require('plex.lib.utils').on_attach(function(client) require('rafi.lib.utils').on_attach(function(client)
if client.name == 'copilot' then if client.name == 'copilot' then
copilot_cmp._on_insert_enter({}) copilot_cmp._on_insert_enter({})
end end

View File

@ -10,7 +10,7 @@ return {
end, end,
config = function() config = function()
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_emmet', {}), group = vim.api.nvim_create_augroup('rafi_emmet', {}),
pattern = { pattern = {
'css', 'css',
'html', 'html',

View File

@ -11,7 +11,7 @@ return {
init = function() init = function()
vim.g.any_jump_disable_default_keybindings = 1 vim.g.any_jump_disable_default_keybindings = 1
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_any-jump', {}), group = vim.api.nvim_create_augroup('rafi_any-jump', {}),
pattern = 'any-jump', pattern = 'any-jump',
callback = function() callback = function()
vim.opt.cursorline = true vim.opt.cursorline = true

View File

@ -10,7 +10,7 @@ return {
}, },
config = function() config = function()
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_fugitive', {}), group = vim.api.nvim_create_augroup('rafi_fugitive', {}),
pattern = 'fugitiveblame', pattern = 'fugitiveblame',
callback = function() callback = function()
vim.schedule(function() vim.schedule(function()

View File

@ -1,4 +1,4 @@
-- plex.plugins.extras.lang.ansible -- rafi.plugins.extras.lang.ansible
-- --
return { return {
@ -26,7 +26,7 @@ return {
-- Setup filetype settings -- Setup filetype settings
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('plex_ftplugin_ansible', {}), group = vim.api.nvim_create_augroup('rafi_ftplugin_ansible', {}),
pattern = 'ansible', pattern = 'ansible',
callback = function() callback = function()
-- Add '.' to iskeyword for ansible modules, e.g. ansible.builtin.copy -- Add '.' to iskeyword for ansible modules, e.g. ansible.builtin.copy

View File

@ -95,7 +95,7 @@ return {
gopls = function(_, _) gopls = function(_, _)
-- workaround for gopls not supporting semanticTokensProvider -- workaround for gopls not supporting semanticTokensProvider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242 -- https://github.com/golang/go/issues/54531#issuecomment-1464982242
require('plex.lib.utils').on_attach(function(client, _) require('rafi.lib.utils').on_attach(function(client, _)
if client.name == 'gopls' then if client.name == 'gopls' then
if not client.server_capabilities.semanticTokensProvider then if not client.server_capabilities.semanticTokensProvider then
local semantic = local semantic =

View File

@ -1,4 +1,4 @@
-- plex.plugins.extras.lang.helm -- rafi.plugins.extras.lang.helm
-- --
return { return {

View File

@ -1,4 +1,4 @@
-- plex.plugins.extras.lang.python -- rafi.plugins.extras.lang.python
-- --
-- This is part of LazyVim's code, with my modifications. -- This is part of LazyVim's code, with my modifications.
@ -19,7 +19,7 @@ return {
{ {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = 'plex/neoconf-venom.nvim', dependencies = 'rafi/neoconf-venom.nvim',
opts = { opts = {
servers = { servers = {
pyright = {}, pyright = {},
@ -28,7 +28,7 @@ return {
}, },
{ {
'plex/neoconf-venom.nvim', 'rafi/neoconf-venom.nvim',
main = 'venom', main = 'venom',
opts = {}, opts = {},
-- stylua: ignore -- stylua: ignore

View File

@ -17,7 +17,7 @@ return {
opts.root_dir = util.root_pattern(unpack(root_files)) opts.root_dir = util.root_pattern(unpack(root_files))
or util.find_git_ancestor() or util.find_git_ancestor()
require('plex.lib.utils').on_attach(function(client, _) require('rafi.lib.utils').on_attach(function(client, _)
if client.name == 'ruff_lsp' then if client.name == 'ruff_lsp' then
client.server_capabilities.hoverProvider = false client.server_capabilities.hoverProvider = false
end end

View File

@ -10,7 +10,7 @@ return {
config = function(_, opts) config = function(_, opts)
require('nvim-lightbulb').setup(opts) require('nvim-lightbulb').setup(opts)
vim.api.nvim_create_autocmd('CursorHold', { vim.api.nvim_create_autocmd('CursorHold', {
group = vim.api.nvim_create_augroup('plex_lightbulb', {}), group = vim.api.nvim_create_augroup('rafi_lightbulb', {}),
callback = function() callback = function()
require('nvim-lightbulb').update_lightbulb() require('nvim-lightbulb').update_lightbulb()
end, end,

View File

@ -6,7 +6,7 @@ return {
setup = { setup = {
yamlls = function(_, _) yamlls = function(_, _)
local yamlls_opts = require('yaml-companion').setup( local yamlls_opts = require('yaml-companion').setup(
require('plex.lib.utils').opts('yaml-companion.nvim') require('rafi.lib.utils').opts('yaml-companion.nvim')
) )
require('lspconfig')['yamlls'].setup(yamlls_opts) require('lspconfig')['yamlls'].setup(yamlls_opts)
return true return true

View File

@ -15,7 +15,7 @@ return {
opts = function() opts = function()
local kind_icons = vim.tbl_map(function(icon) local kind_icons = vim.tbl_map(function(icon)
return vim.trim(icon) return vim.trim(icon)
end, require('plex.config').icons.kinds) end, require('rafi.config').icons.kinds)
return { return {
attach_navic = false, attach_navic = false,
show_dirname = false, show_dirname = false,

View File

@ -11,14 +11,14 @@ return {
diagnostics = false, diagnostics = false,
always_show_bufferline = true, always_show_bufferline = true,
diagnostics_indicator = function(_, _, diag) diagnostics_indicator = function(_, _, diag)
local icons = require('plex.config').icons.diagnostics local icons = require('rafi.config').icons.diagnostics
local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') local ret = (diag.error and icons.Error .. diag.error .. ' ' or '')
.. (diag.warning and icons.Warn .. diag.warning or '') .. (diag.warning and icons.Warn .. diag.warning or '')
return vim.trim(ret) return vim.trim(ret)
end, end,
custom_areas = { custom_areas = {
right = function() right = function()
local project_root = require('plex.lib.badge').project() local project_root = require('rafi.lib.badge').project()
local result = {} local result = {}
local part = {} local part = {}
part.text = '%#BufferLineTab# ' .. project_root part.text = '%#BufferLineTab# ' .. project_root

View File

@ -6,7 +6,7 @@ return {
vim.g.cursorword = 0 vim.g.cursorword = 0
end, end,
config = function() config = function()
local augroup = vim.api.nvim_create_augroup('plex_cursorword', {}) local augroup = vim.api.nvim_create_augroup('rafi_cursorword', {})
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = augroup, group = augroup,
pattern = { pattern = {

View File

@ -1,5 +1,5 @@
-- LSP: Auto-format on save -- LSP: Auto-format on save
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
-- This is part of LazyVim's code, with my modifications. -- This is part of LazyVim's code, with my modifications.
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/format.lua -- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/format.lua
@ -53,7 +53,7 @@ function M.format(opts)
filter = function(client) filter = function(client)
return vim.tbl_contains(client_ids, client.id) return vim.tbl_contains(client_ids, client.id)
end, end,
}, require('plex.lib.utils').opts('nvim-lspconfig').format or {})) }, require('rafi.lib.utils').opts('nvim-lspconfig').format or {}))
end end
---@param formatters LazyVimFormatters ---@param formatters LazyVimFormatters
@ -154,7 +154,7 @@ end
function M.setup(opts) function M.setup(opts)
M.opts = opts M.opts = opts
vim.api.nvim_create_autocmd('BufWritePre', { vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('plex_format', {}), group = vim.api.nvim_create_augroup('rafi_format', {}),
callback = function() callback = function()
if M.opts.autoformat then if M.opts.autoformat then
M.format() M.format()

View File

@ -1,5 +1,5 @@
-- LSP: Highlights -- LSP: Highlights
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
-- This is part of LunarVim's code, with my modifications. -- This is part of LunarVim's code, with my modifications.
-- Reference: https://github.com/LunarVim/LunarVim -- Reference: https://github.com/LunarVim/LunarVim
@ -9,7 +9,7 @@ local M = {}
---@param client lsp.Client ---@param client lsp.Client
---@param bufnr integer ---@param bufnr integer
function M.on_attach(client, bufnr) function M.on_attach(client, bufnr)
if require('plex.lib.utils').has('vim-illuminate') then if require('rafi.lib.utils').has('vim-illuminate') then
-- Skipped setup for document_highlight, illuminate is installed. -- Skipped setup for document_highlight, illuminate is installed.
return return
end end

View File

@ -1,5 +1,5 @@
-- LSP: Plugins -- LSP: Plugins
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
-- This is part of LazyVim's code, with my modifications. -- This is part of LazyVim's code, with my modifications.
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/init.lua -- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/init.lua
@ -18,7 +18,7 @@ return {
{ {
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
cond = function() cond = function()
return require('plex.lib.utils').has('nvim-cmp') return require('rafi.lib.utils').has('nvim-cmp')
end, end,
}, },
}, },
@ -90,19 +90,19 @@ return {
}, },
---@param opts PluginLspOpts ---@param opts PluginLspOpts
config = function(_, opts) config = function(_, opts)
if require('plex.lib.utils').has('neoconf.nvim') then if require('rafi.lib.utils').has('neoconf.nvim') then
local plugin = require('lazy.core.config').spec.plugins['neoconf.nvim'] local plugin = require('lazy.core.config').spec.plugins['neoconf.nvim']
require('neoconf').setup(require('lazy.core.plugin').values(plugin, 'opts', false)) require('neoconf').setup(require('lazy.core.plugin').values(plugin, 'opts', false))
end end
-- Setup autoformat -- Setup autoformat
require('plex.plugins.lsp.format').setup(opts) require('rafi.plugins.lsp.format').setup(opts)
-- Setup formatting, keymaps and highlights. -- Setup formatting, keymaps and highlights.
local lsp_on_attach = require('plex.lib.utils').on_attach local lsp_on_attach = require('rafi.lib.utils').on_attach
---@param client lsp.Client ---@param client lsp.Client
---@param buffer integer ---@param buffer integer
lsp_on_attach(function(client, buffer) lsp_on_attach(function(client, buffer)
require('plex.plugins.lsp.keymaps').on_attach(client, buffer) require('rafi.plugins.lsp.keymaps').on_attach(client, buffer)
require('plex.plugins.lsp.highlight').on_attach(client, buffer) require('rafi.plugins.lsp.highlight').on_attach(client, buffer)
if vim.diagnostic.is_disabled() or vim.bo[buffer].buftype ~= '' then if vim.diagnostic.is_disabled() or vim.bo[buffer].buftype ~= '' then
vim.diagnostic.disable(buffer) vim.diagnostic.disable(buffer)
@ -120,13 +120,13 @@ return {
local client = vim.lsp.get_client_by_id(client_id) local client = vim.lsp.get_client_by_id(client_id)
local buffer = vim.api.nvim_get_current_buf() local buffer = vim.api.nvim_get_current_buf()
if client ~= nil then if client ~= nil then
require('plex.plugins.lsp.keymaps').on_attach(client, buffer) require('rafi.plugins.lsp.keymaps').on_attach(client, buffer)
end end
return ret return ret
end end
-- Diagnostics signs and highlights -- Diagnostics signs and highlights
for type, icon in pairs(require('plex.config').icons.diagnostics) do for type, icon in pairs(require('rafi.config').icons.diagnostics) do
local hl = 'DiagnosticSign' .. type local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end end
@ -148,7 +148,7 @@ return {
opts.diagnostics.virtual_text.prefix = vim.fn.has('nvim-0.10') == 0 opts.diagnostics.virtual_text.prefix = vim.fn.has('nvim-0.10') == 0
and '' and ''
or function(diagnostic) or function(diagnostic)
local icons = require('plex.config').icons.diagnostics local icons = require('rafi.config').icons.diagnostics
for d, icon in pairs(icons) do for d, icon in pairs(icons) do
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
return icon return icon

View File

@ -1,5 +1,5 @@
-- LSP: Key-maps -- LSP: Key-maps
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
local M = {} local M = {}
@ -12,7 +12,7 @@ function M.get()
return M._keys return M._keys
end end
local format = function() local format = function()
require('plex.plugins.lsp.format').format({ force = true }) require('rafi.plugins.lsp.format').format({ force = true })
end end
---@class PluginLspKeys ---@class PluginLspKeys
@ -36,7 +36,7 @@ function M.get()
{ 'K', function() { 'K', function()
-- Show hover documentation or folded lines. -- Show hover documentation or folded lines.
local winid = require('plex.lib.utils').has('nvim-ufo') local winid = require('rafi.lib.utils').has('nvim-ufo')
and require('ufo').peekFoldedLinesUnderCursor() or nil and require('ufo').peekFoldedLinesUnderCursor() or nil
if not winid then if not winid then
vim.lsp.buf.hover() vim.lsp.buf.hover()
@ -99,7 +99,7 @@ function M.resolve(buffer)
add(keymap) add(keymap)
end end
local opts = require('plex.lib.utils').opts('nvim-lspconfig') local opts = require('rafi.lib.utils').opts('nvim-lspconfig')
local clients local clients
if vim.lsp.get_clients ~= nil then if vim.lsp.get_clients ~= nil then
clients = vim.lsp.get_clients({ bufnr = buffer }) clients = vim.lsp.get_clients({ bufnr = buffer })

View File

@ -1,5 +1,5 @@
-- Plugin: Lualine -- Plugin: Lualine
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
return { return {
@ -15,12 +15,12 @@ return {
vim.g.qf_disable_statusline = true vim.g.qf_disable_statusline = true
end, end,
opts = function() opts = function()
local icons = require('plex.config').icons local icons = require('rafi.config').icons
local get_color = require('plex.lib.color').get_color local get_color = require('rafi.lib.color').get_color
local fg = function(...) return { fg = get_color('fg', ...) } end local fg = function(...) return { fg = get_color('fg', ...) } end
local function filepath() local function filepath()
local fpath = require('plex.lib.badge').filepath(0, 3, 5) local fpath = require('rafi.lib.badge').filepath(0, 3, 5)
-- % char must be escaped in statusline. -- % char must be escaped in statusline.
return fpath:gsub('%%', '%%%%') return fpath:gsub('%%', '%%%%')
end end
@ -53,11 +53,11 @@ return {
x = active, x = active,
y = { y = {
fg = active.fg, fg = active.fg,
bg = require('plex.lib.color').brightness_modifier(active.bg, -20), bg = require('rafi.lib.color').brightness_modifier(active.bg, -20),
}, },
z = { z = {
fg = active.fg, fg = active.fg,
bg = require('plex.lib.color').brightness_modifier(active.bg, 63), bg = require('rafi.lib.color').brightness_modifier(active.bg, 63),
}, },
}, },
inactive = { inactive = {
@ -116,7 +116,7 @@ return {
}, },
lualine_b = { lualine_b = {
{ {
function() return require('plex.lib.badge').icon() end, function() return require('rafi.lib.badge').icon() end,
padding = { left = 1, right = 0 }, padding = { left = 1, right = 0 },
}, },
{ {
@ -160,7 +160,7 @@ return {
-- Whitespace trails -- Whitespace trails
{ {
function() return require('plex.lib.badge').trails('') end, function() return require('rafi.lib.badge').trails('') end,
cond = is_file_window, cond = is_file_window,
padding = { left = 1, right = 0 }, padding = { left = 1, right = 0 },
color = { fg = get_color('bg', {'Identifier'}, '#b294bb') }, color = { fg = get_color('bg', {'Identifier'}, '#b294bb') },
@ -229,7 +229,7 @@ return {
}, },
lualine_y = { lualine_y = {
{ {
function() return require('plex.lib.badge').filemedia('') end, function() return require('rafi.lib.badge').filemedia('') end,
cond = function() return is_min_width(70) end, cond = function() return is_min_width(70) end,
separator = { left = '' }, separator = { left = '' },
padding = 1, padding = 1,
@ -254,7 +254,7 @@ return {
inactive_sections = { inactive_sections = {
lualine_a = { lualine_a = {
{ {
function() return require('plex.lib.badge').icon() end, function() return require('rafi.lib.badge').icon() end,
padding = 1, padding = 1,
}, },
{ filepath, padding = { left = 1, right = 0 } }, { filepath, padding = { left = 1, right = 0 } },

View File

@ -47,6 +47,11 @@ return {
'<cmd>Neotree filesystem left toggle dir=./<CR>', '<cmd>Neotree filesystem left toggle dir=./<CR>',
desc = 'Explorer NeoTree Toggle', desc = 'Explorer NeoTree Toggle',
}, },
{
'<LocalLeader>a',
'<cmd>Neotree filesystem left reveal dir=./<CR>',
desc = 'Explorer NeoTree Reveal',
},
}, },
deactivate = function() deactivate = function()
vim.cmd([[Neotree close]]) vim.cmd([[Neotree close]])
@ -75,15 +80,15 @@ return {
}, },
}, },
-- event_handlers = { event_handlers = {
-- -- Close neo-tree when opening a file. -- Close neo-tree when opening a file.
-- { {
-- event = 'file_opened', event = 'file_opened',
-- handler = function() handler = function()
-- require('neo-tree').close_all() require('neo-tree').close_all()
-- end, end,
-- }, },
-- }, },
default_component_configs = { default_component_configs = {
indent = { indent = {
@ -124,15 +129,15 @@ return {
width = winwidth, width = winwidth,
mappings = { mappings = {
['q'] = 'close_window', ['q'] = 'close_window',
['?'] = 'show_help', ['?'] = 'noop',
['<Space>'] = 'noop', ['<Space>'] = 'noop',
['g?'] = 'show_help', ['g?'] = 'show_help',
['<2-LeftMouse>'] = 'open', ['<2-LeftMouse>'] = 'open',
['<CR>'] = 'open_with_window_picker', ['<CR>'] = 'open_with_window_picker',
['l'] = 'open_drop', ['l'] = 'open_drop',
['h'] = 'change_root_to_node', ['h'] = 'close_node',
['C'] = 'cd', ['C'] = 'close_node',
['z'] = 'close_all_nodes', ['z'] = 'close_all_nodes',
['<C-r>'] = 'refresh', ['<C-r>'] = 'refresh',

View File

@ -1,12 +1,12 @@
-- Plugins: UI -- Plugins: UI
-- https://github.com/plex/vim-config -- https://github.com/rafi/vim-config
return { return {
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
{ 'nvim-tree/nvim-web-devicons', lazy = false }, { 'nvim-tree/nvim-web-devicons', lazy = false },
{ 'MunifTanjim/nui.nvim', lazy = false }, { 'MunifTanjim/nui.nvim', lazy = false },
{ 'plex/tabstrip.nvim', lazy = false, priority = 98, opts = true }, { 'rafi/tabstrip.nvim', lazy = false, priority = 98, opts = true },
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
{ {
@ -149,7 +149,7 @@ return {
---@param client lsp.Client ---@param client lsp.Client
---@param buffer integer ---@param buffer integer
require('plex.lib.utils').on_attach(function(client, buffer) require('rafi.lib.utils').on_attach(function(client, buffer)
if client.server_capabilities.documentSymbolProvider then if client.server_capabilities.documentSymbolProvider then
require('nvim-navic').attach(client, buffer) require('nvim-navic').attach(client, buffer)
end end
@ -159,7 +159,7 @@ return {
return { return {
separator = '', separator = '',
highlight = true, highlight = true,
icons = require('plex.config').icons.kinds, icons = require('rafi.config').icons.kinds,
} }
end, end,
}, },
@ -188,7 +188,7 @@ return {
}, },
init = function() init = function()
-- When noice is not enabled, install notify on VeryLazy -- When noice is not enabled, install notify on VeryLazy
local Util = require('plex.lib.utils') local Util = require('rafi.lib.utils')
if not Util.has('noice.nvim') then if not Util.has('noice.nvim') then
Util.on_very_lazy(function() Util.on_very_lazy(function()
vim.notify = require('notify') vim.notify = require('notify')