moving naming to plex

This commit is contained in:
Christoph J. Scherr 2023-09-06 10:19:56 +02:00
parent e5a2a74f3a
commit af22846ff4
68 changed files with 159 additions and 289 deletions

View File

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

View File

@ -5,7 +5,7 @@
-- This file is automatically loaded by rafi.config.init
local function augroup(name)
return vim.api.nvim_create_augroup('rafi_' .. name, {})
return vim.api.nvim_create_augroup('plex_' .. name, {})
end
-- Check if we need to reload the file when it changed

View File

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

View File

@ -2,21 +2,24 @@
-- github.com/rafi/vim-config
-- ===
-- This file is automatically loaded by rafi.config.init
-- This file is automatically loaded by plex.config.init
local Util = require('rafi.lib.utils')
local Util = require('plex.lib.utils')
local map = vim.keymap.set
local function augroup(name)
return vim.api.nvim_create_augroup('rafi_' .. name, {})
return vim.api.nvim_create_augroup('plex_' .. name, {})
end
-- Elite-mode: Arrow-keys resize window
if vim.g.rafi_elite_mode then
map('n', '<Up>', '<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', '<Right>', '<cmd>vertical resize -1<cr>', { desc = 'Resize Window' })
-- enable elite mode, for people that are more used to vim than non-vim
vim.g.plex_elite_mode = true
-- Elite-mode: ctrl + Arrow-keys resize window
if vim.g.plex_elite_mode then
map('n', '<C-Up>', '<cmd>resize +1<cr>', { desc = 'Resize Window' })
map('n', '<C-Down>', '<cmd>resize -1<cr>', { desc = 'Resize Window' })
map('n', '<C-Left>', '<cmd>vertical resize +1<cr>', { desc = 'Resize Window' })
map('n', '<C-Right>', '<cmd>vertical resize -1<cr>', { desc = 'Resize Window' })
end
-- Package-manager
@ -27,16 +30,13 @@ map('n', '<leader>l', '<cmd>Lazy<cr>', { desc = 'Open Lazy UI' })
-- Navigation
-- ===
-- Moves through display-lines, unless count is provided
map({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
map({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
-- Move faster between lines
map({ 'n', 'x' }, 'J', "v:count == 30 ? 'gj' : 'J'", { expr = true, silent = true })
map({ 'n', 'x' }, 'K', "v:count == 30 ? 'gk' : 'K'", { expr = true, silent = true })
-- Easier line-wise movement
map('n', 'gh', 'g^')
map('n', 'gl', 'g$')
map('n', '<Leader><Leader>', 'V', { desc = 'Visual Mode' })
map('x', '<Leader><Leader>', '<Esc>', { desc = 'Exit Visual Mode' })
map('n', 'H', 'g^')
map('n', 'L', 'g$')
-- Toggle fold or select option from popup menu
---@return string
@ -52,22 +52,20 @@ if not Util.has('mini.bracketed') and not Util.has('trouble.nvim') then
map('n', ']q', '<cmd>cnext<CR>', { desc = 'Next Quickfix Item' })
map('n', '[q', '<cmd>cprev<CR>', { desc = 'Previous Quickfix Item' })
end
map('n', ']a', '<cmd>lnext<CR>', { desc = 'Next Loclist Item' })
map('n', '[a', '<cmd>lprev<CR>', { desc = 'Previous Loclist Item' })
map('n', '<A-k>', '<cmd>lnext<CR>', { desc = 'Next Loclist Item' })
map('n', '<A-j>', '<cmd>lprev<CR>', { desc = 'Previous Loclist Item' })
-- Whitespace jump (see plugin/whitespace.vim)
map('n', ']s', function()
require('rafi.lib.edit').whitespace_jump(1)
require('plex.lib.edit').whitespace_jump(1)
end, { desc = 'Next Whitespace' })
map('n', '[s', function()
require('rafi.lib.edit').whitespace_jump(-1)
require('plex.lib.edit').whitespace_jump(-1)
end, { desc = 'Previous Whitespace' })
-- Navigation in command line
map('c', '<C-h>', '<Home>')
map('c', '<C-l>', '<End>')
map('c', '<C-f>', '<Right>')
map('c', '<C-b>', '<Left>')
-- Scroll step sideways
map('n', 'zl', 'z4l')
@ -107,22 +105,23 @@ map('i', '<S-Return>', '<C-o>o', { desc = 'Start Newline' })
map('x', '<', '<gv', { desc = 'Indent Right and Re-select' })
map('x', '>', '>gv|', { desc = 'Indent Left and Re-select' })
-- Arrows to move identation in normal mode
map('n', '<LEFT>', '<<', { desc = 'Indent Right and Re-select' })
map('n', '<RIGHT>', '>>', { desc = 'Indent Left and Re-select' })
-- Use tab for indenting in visual/select mode
map('x', '<Tab>', '>gv|', { desc = 'Indent Left' })
map('x', '<S-Tab>', '<gv', { desc = 'Indent Right' })
-- Drag current line/s vertically and auto-indent
map('n', '<Leader>k', '<cmd>move-2<CR>==', { desc = 'Move line up' })
map('n', '<Leader>j', '<cmd>move+<CR>==', { desc = 'Move line down' })
map('x', '<Leader>k', ":move'<-2<CR>gv=gv", { desc = 'Move selection up' })
map('x', '<Leader>j', ":move'>+<CR>gv=gv", { desc = 'Move selection down' })
-- Drag current line/s vertically and auto-indent with Arrow up/down
map('n', '<UP>', '<cmd>move-2<CR>==', { desc = 'Move line up' })
map('n', '<DOWN>', '<cmd>move+<CR>==', { desc = 'Move line down' })
map('x', '<UP>', ":move'<-2<CR>gv=gv", { desc = 'Move selection up' })
map('x', '<DOWN>', ":move'>+<CR>gv=gv", { desc = 'Move selection down' })
-- Duplicate lines without affecting PRIMARY and CLIPBOARD selections.
map('n', '<Leader>d', 'm`""Y""P``', { desc = 'Duplicate line' })
map('x', '<Leader>d', '""Y""Pgv', { desc = 'Duplicate selection' })
-- Duplicate paragraph
map('n', '<Leader>cp', 'yap<S-}>p', { desc = 'Duplicate Paragraph' })
map('n', 'yyp', 'm`""Y""P``', { desc = 'Duplicate line' })
map('x', 'yyp', '""Y""Pgv', { desc = 'Duplicate selection' })
-- Remove spaces at the end of lines
map('n', '<Leader>cw', '<cmd>lua MiniTrailspace.trim()<CR>', { desc = 'Erase Whitespace' })
@ -130,11 +129,9 @@ map('n', '<Leader>cw', '<cmd>lua MiniTrailspace.trim()<CR>', { desc = 'Erase Whi
-- Search & Replace
-- ===
-- Switch */g* and #/g#
map('n', '*', 'g*')
map('n', 'g*', '*')
map('n', '#', 'g#')
map('n', 'g#', '#')
-- Make marks with m[some key]
-- go to mark with #[some key]
map('n', '#', '\'')
-- Clear search with <Esc>
map('n', '<Esc>', '<cmd>noh<CR>', { desc = 'Clear Search Highlight' })
@ -154,16 +151,7 @@ map({ 'n', 'x' }, '<BS>', '%', { remap = true, desc = 'Jump to Paren' })
map('n', 'gpp', "'`['.strpart(getregtype(), 0, 1).'`]'", { expr = true, desc = 'Select Paste' })
-- Quick substitute within selected area
map('x', 'sg', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection' })
-- C-r: Easier search and replace visual/select mode
map(
'x',
'<C-r>',
":<C-u>%s/\\V<C-R>=v:lua.require'rafi.lib.edit'.get_visual_selection()<CR>"
.. '//gc<Left><Left><Left>',
{ desc = 'Replace Selection' }
)
map('x', '<leader>sub', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection' })
-- Command & History
-- ===
@ -172,28 +160,15 @@ map(
map('n', '!', ':!', { desc = 'Execute Shell Command' })
-- Put vim command output into buffer
map('n', 'g!', ":put=execute('')<Left><Left>", { desc = 'Paste Command' })
-- Switch history search pairs, matching my bash shell
---@return string
map('c', '<C-p>', function()
return vim.fn.pumvisible() == 1 and '<C-p>' or '<Up>'
end, { expr = true })
map('c', '<C-n>', function()
return vim.fn.pumvisible() == 1 and '<C-n>' or '<Down>'
end, { expr = true })
map('c', '<Up>', '<C-p>')
map('c', '<Down>', '<C-n>')
--map('n', 'g!', ":put=execute('')<Left><Left>", { desc = 'Paste Command' })
-- Allow misspellings
vim.cmd.cnoreabbrev('qw', 'wq')
vim.cmd.cnoreabbrev('Wq', 'wq')
vim.cmd.cnoreabbrev('WQ', 'wq')
vim.cmd.cnoreabbrev('Qa', 'qa')
vim.cmd.cnoreabbrev('Bd', 'bd')
vim.cmd.cnoreabbrev('bD', 'bd')
--vim.cmd.cnoreabbrev('qw', 'wq')
--vim.cmd.cnoreabbrev('Wq', 'wq')
--vim.cmd.cnoreabbrev('WQ', 'wq')
--vim.cmd.cnoreabbrev('Qa', 'qa')
--vim.cmd.cnoreabbrev('Bd', 'bd')
--vim.cmd.cnoreabbrev('bD', 'bd')
-- File operations
-- ===
@ -208,18 +183,18 @@ map('n', '<Leader>cd', function()
end, { desc = 'Change Local Directory' })
-- Fast saving from all modes
map('n', '<Leader>w', '<cmd>write<CR>', { desc = 'Save' })
map({ 'n', 'i', 'v' }, '<C-s>', '<cmd>write<CR>', { desc = 'Save' })
--map('n', '<Leader>w', '<cmd>write<CR>', { desc = 'Save' })
--map({ 'n', 'i', 'v' }, '<C-s>', '<cmd>write<CR>', { desc = 'Save' })
-- Editor UI
-- ===
-- Toggle editor's visual effects
map('n', '<leader>uf', require('rafi.plugins.lsp.format').toggle, { desc = 'Toggle format on Save' })
map('n', '<leader>uf', require('plex.plugins.lsp.format').toggle, { desc = 'Toggle format on Save' })
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>ulr', '<cmd>setlocal nornu!<CR>', { desc = 'Toggle Relative Line Numbers' })
map('n', '<Leader>uo', '<cmd>setlocal nolist!<CR>', { desc = 'Toggle Whitespace Symbols' })
map('n', '<Leader>uu', '<cmd>nohlsearch<CR>', { desc = 'Hide Search Highlight' })
if vim.lsp.inlay_hint then
map('n', '<leader>uh', function() vim.lsp.inlay_hint(0, nil) end, { desc = 'Toggle Inlay Hints' })
@ -240,14 +215,10 @@ end, { desc = 'Toggle Wrap' })
-- Tabs: Many ways to navigate them
map('n', '<A-j>', '<cmd>tabnext<CR>', { desc = 'Next Tab' })
map('n', '<A-k>', '<cmd>tabprevious<CR>', { desc = 'Previous Tab' })
map('n', '<A-[>', '<cmd>tabprevious<CR>', { desc = 'Previous Tab' })
map('n', '<A-]>', '<cmd>tabnext<CR>', { desc = 'Next Tab' })
map('n', '<C-Tab>', '<cmd>tabnext<CR>', { desc = 'Next Tab' })
map('n', '<C-S-Tab>', '<cmd>tabprevious<CR>', { desc = 'Previous Tab' })
-- Moving tabs
map('n', '<A-{>', '<cmd>-tabmove<CR>', { desc = 'Tab Move Backwards' })
map('n', '<A-}>', '<cmd>+tabmove<CR>', { desc = 'Tab Move Forwards' })
map('n', '<A-S-j>', '<cmd>-tabmove<CR>', { desc = 'Tab Move Backwards' })
map('n', '<A-S-k>', '<cmd>+tabmove<CR>', { desc = 'Tab Move Forwards' })
-- Show treesitter nodes under cursor
-- highlights under cursor
@ -260,25 +231,25 @@ end
-- Append mode-line to current buffer
map('n', '<Leader>ml', function()
require('rafi.lib.edit').append_modeline()
require('plex.lib.edit').append_modeline()
end, { desc = 'Append Modeline' })
-- Jump entire buffers throughout jumplist
map('n', 'g<C-i>', function()
require('rafi.lib.edit').jump_buffer(1)
end, { desc = 'Jump to newer buffer' })
map('n', 'g<C-o>', function()
require('rafi.lib.edit').jump_buffer(-1)
end, { desc = 'Jump to older buffer' })
--map('n', 'g<C-i>', function()
-- require('plex.lib.edit').jump_buffer(1)
--end, { desc = 'Jump to newer buffer' })
--map('n', 'g<C-o>', function()
-- require('plex.lib.edit').jump_buffer(-1)
--end, { desc = 'Jump to older buffer' })
-- Context aware menu. See lua/lib/contextmenu.lua
map('n', '<LocalLeader>c', function()
require('rafi.lib.contextmenu').show()
require('plex.lib.contextmenu').show()
end, { desc = 'Content-aware menu' })
-- Lazygit
map('n', '<leader>gg', function() Util.float_term({ 'lazygit' }, { cwd = Util.get_root(), esc_esc = false }) end, { desc = 'Lazygit (root dir)' })
map('n', '<leader>tg', function() Util.float_term({ 'lazygit' }, { cwd = Util.get_root(), esc_esc = false }) end, { desc = 'Lazygit (root dir)' })
map('n', '<leader>tG', function() Util.float_term({ 'lazygit' }, { esc_esc = false }) end, { desc = 'Lazygit (cwd)' })
-- Floating terminal
map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Enter Normal Mode' })
@ -307,7 +278,7 @@ end
-- ===
-- Ultimatus Quitos
if vim.F.if_nil(vim.g.rafi_window_q_mapping, true) then
if vim.F.if_nil(vim.g.plex_window_q_mapping, true) then
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, {
group = augroup('quit_mapping'),
callback = function(event)
@ -321,7 +292,7 @@ end
-- Toggle quickfix window
map('n', '<Leader>q', function()
require('rafi.lib.edit').toggle_list('quickfix')
require('plex.lib.edit').toggle_list('quickfix')
end, { desc = 'Open Quickfix' })
-- Set locations with diagnostics and open the list.
@ -329,7 +300,7 @@ map('n', '<Leader>a', function()
if vim.bo.filetype ~= 'qf' then
vim.diagnostic.setloclist({ open = false })
end
require('rafi.lib.edit').toggle_list('loclist')
require('plex.lib.edit').toggle_list('loclist')
end, { desc = 'Open Location List' })
-- Switch with adjacent window
@ -357,3 +328,4 @@ map('n', 'sh', function()
vim.o.background = 'dark'
end
end, { desc = 'Toggle background dark/light' })
-- vim: set ts=2 sw=2 tw=80 noet :

View File

@ -19,10 +19,6 @@ opt.errorbells = true -- Trigger bell on error
opt.virtualedit = 'block' -- Position cursor anywhere in visual blockd
opt.confirm = true -- Confirm to save changes before exiting modified bufferd
-- number
opt.number = true -- show line number
opt.relativenumber = false --
-- History and persistence
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
@ -135,12 +131,12 @@ opt.wildmode = 'longest:full,full' -- Command-line completion mode
opt.termguicolors = true
opt.shortmess:append({ W = true, I = true, c = true })
opt.showmode = false -- Don't show mode in cmd window
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least 2 lines above/below
opt.sidescrolloff = 5 -- Keep at least 5 lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = false -- Don't show line numbers
opt.ruler = false -- Disable default status ruler
opt.number = true -- Show line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 2 -- Always show the tabs line

View File

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

View File

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

View File

@ -5,7 +5,7 @@ local root_patterns = { '.git', '_darcs', '.hg', '.bzr', '.svn' }
local M = {}
local augroup_lsp_attach = vim.api.nvim_create_augroup('rafi_lsp_attach', {})
local augroup_lsp_attach = vim.api.nvim_create_augroup('plex_lsp_attach', {})
---@param on_attach fun(client:lsp.Client, buffer:integer)
function M.on_attach(on_attach)

View File

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

View File

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

View File

@ -49,14 +49,14 @@ return {
-- Detect if stdin has been provided.
vim.g.in_pager_mode = false
vim.api.nvim_create_autocmd('StdinReadPre', {
group = vim.api.nvim_create_augroup('rafi_persisted', {}),
group = vim.api.nvim_create_augroup('plex_persisted', {}),
callback = function()
vim.g.in_pager_mode = true
end,
})
-- Close all floats before loading a session. (e.g. Lazy.nvim)
vim.api.nvim_create_autocmd('User', {
group = 'rafi_persisted',
group = 'plex_persisted',
pattern = 'PersistedLoadPre',
callback = function()
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.
vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedSavePre',
group = 'rafi_persisted',
group = 'plex_persisted',
callback = function()
-- Detect if window is owned by plugin by checking buftype.
local current_buffer = vim.api.nvim_get_current_buf()
@ -90,7 +90,7 @@ return {
-- current session to avoid previous session to be overwritten.
vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedTelescopeLoadPre',
group = 'rafi_persisted',
group = 'plex_persisted',
callback = function()
require('persisted').save()
require('persisted').stop()
@ -100,7 +100,7 @@ return {
-- will be auto-saved.
vim.api.nvim_create_autocmd('User', {
pattern = 'PersistedTelescopeLoadPost',
group = 'rafi_persisted',
group = 'plex_persisted',
callback = function(session)
require('persisted').start()
print('Started session ' .. session.data.name)
@ -148,7 +148,7 @@ return {
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('rafi_illuminate', {}),
group = vim.api.nvim_create_augroup('plex_illuminate', {}),
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map(']]', 'next', buffer)
@ -365,7 +365,7 @@ return {
},
init = function()
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('rafi_outline', {}),
group = vim.api.nvim_create_augroup('plex_outline', {}),
pattern = 'Outline',
callback = function()
vim.opt_local.winhighlight = 'CursorLine:WildMenu'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
return {
{
'vimwiki/vimwiki',
enabled = false,
cmd = { 'VimwikiIndex', 'VimwikiUISelect' },
keys = {
{ '<Leader>W', '<cmd>VimwikiIndex<CR>', { noremap = true } },

View File

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

View File

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

View File

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

View File

@ -87,7 +87,7 @@ return {
opts = function()
local actions = require('diffview.actions')
vim.api.nvim_create_autocmd({ 'WinEnter', 'BufEnter' }, {
group = vim.api.nvim_create_augroup('rafi_diffview', {}),
group = vim.api.nvim_create_augroup('plex_diffview', {}),
pattern = 'diffview:///panels/*',
callback = function()
vim.opt_local.cursorline = true

View File

@ -53,7 +53,7 @@ function M.format(opts)
filter = function(client)
return vim.tbl_contains(client_ids, client.id)
end,
}, require('rafi.lib.utils').opts('nvim-lspconfig').format or {}))
}, require('plex.lib.utils').opts('nvim-lspconfig').format or {}))
end
---@param formatters LazyVimFormatters
@ -154,7 +154,7 @@ end
function M.setup(opts)
M.opts = opts
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('rafi_format', {}),
group = vim.api.nvim_create_augroup('plex_format', {}),
callback = function()
if M.opts.autoformat then
M.format()

View File

@ -9,7 +9,7 @@ local M = {}
---@param client lsp.Client
---@param bufnr integer
function M.on_attach(client, bufnr)
if require('rafi.lib.utils').has('vim-illuminate') then
if require('plex.lib.utils').has('vim-illuminate') then
-- Skipped setup for document_highlight, illuminate is installed.
return
end

View File

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

View File

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

View File

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

View File

@ -48,9 +48,9 @@ return {
desc = 'Explorer NeoTree Toggle',
},
{
'<LocalLeader>a',
'<cmd>Neotree filesystem left reveal dir=./<CR>',
desc = 'Explorer NeoTree Reveal',
'<F5>',
'<cmd>Neotree filesystem left toggle dir=./<CR>',
desc = 'Explorer NeoTree Toggle',
},
},
deactivate = function()
@ -80,15 +80,15 @@ return {
},
},
event_handlers = {
-- Close neo-tree when opening a file.
{
event = 'file_opened',
handler = function()
require('neo-tree').close_all()
end,
},
},
-- event_handlers = {
-- -- Close neo-tree when opening a file.
-- {
-- event = 'file_opened',
-- handler = function()
-- require('neo-tree').close_all()
-- end,
-- },
-- },
default_component_configs = {
indent = {
@ -138,6 +138,7 @@ return {
['l'] = 'open_drop',
['h'] = 'close_node',
['C'] = 'close_node',
['<C-c>'] = 'set_root',
['z'] = 'close_all_nodes',
['<C-r>'] = 'refresh',

View File

@ -122,7 +122,7 @@ end
-- Enable indent-guides in telescope preview
vim.api.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
group = vim.api.nvim_create_augroup('rafi_telescope', {}),
group = vim.api.nvim_create_augroup('plex_telescope', {}),
callback = function(args)
if args.buf ~= vim.api.nvim_win_get_buf(0) then
return
@ -286,7 +286,7 @@ return {
'<leader>gg',
function()
require('telescope.builtin').live_grep({
default_text = require('rafi.lib.edit').get_visual_selection(),
default_text = require('plex.lib.edit').get_visual_selection(),
})
end,
mode = 'x',
@ -406,7 +406,7 @@ return {
['p'] = function()
local entry = require('telescope.actions.state').get_selected_entry()
require('rafi.lib.preview').open(entry.path)
require('plex.lib.preview').open(entry.path)
end,
},

View File

@ -149,7 +149,7 @@ return {
---@param client lsp.Client
---@param buffer integer
require('rafi.lib.utils').on_attach(function(client, buffer)
require('plex.lib.utils').on_attach(function(client, buffer)
if client.server_capabilities.documentSymbolProvider then
require('nvim-navic').attach(client, buffer)
end
@ -159,7 +159,7 @@ return {
return {
separator = '',
highlight = true,
icons = require('rafi.config').icons.kinds,
icons = require('plex.config').icons.kinds,
}
end,
},
@ -188,7 +188,7 @@ return {
},
init = function()
-- When noice is not enabled, install notify on VeryLazy
local Util = require('rafi.lib.utils')
local Util = require('plex.lib.utils')
if not Util.has('noice.nvim') then
Util.on_very_lazy(function()
vim.notify = require('notify')

View File

@ -1,78 +0,0 @@
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,
},
},
},
}

View File

@ -1,22 +0,0 @@
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,
},
}