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 -- rafi Neovim entry-point
-- https://git.cscherr.de/PlexSheep/neovim-conf -- https://git.cscherr.de/PlexSheep/neovim-conf
local config = require('rafi.config') local config = require('plex.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 = 'rafi.plugins' }, { import = 'plex.plugins' },
{ import = 'rafi.plugins.extras.lang.go' }, { import = 'plex.plugins.extras.lang.go' },
{ import = 'rafi.plugins.extras.lang.json' }, { import = 'plex.plugins.extras.lang.json' },
{ import = 'rafi.plugins.extras.lang.python' }, { import = 'plex.plugins.extras.lang.python' },
{ import = 'rafi.plugins.extras.lang.yaml' }, { import = 'plex.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,

View File

@ -5,7 +5,7 @@
-- This file is automatically loaded by rafi.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('rafi_' .. name, {}) return vim.api.nvim_create_augroup('plex_' .. 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

@ -4,22 +4,22 @@
-- 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
---@type RafiConfig ---@type plexConfig
local M = {} local M = {}
M.lazy_version = '>=9.1.0' M.lazy_version = '>=9.1.0'
---@class RafiConfig ---@class plexConfig
local defaults = { local defaults = {
-- Load the default settings -- Load the default settings
-- stylua: ignore -- stylua: ignore
defaults = { defaults = {
autocmds = true, -- rafi.config.autocmds autocmds = true, -- plex.config.autocmds
keymaps = true, -- rafi.config.keymaps keymaps = true, -- plex.config.keymaps
-- rafi.config.options can't be configured here since it's loaded -- plex.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['rafi.config.options'] = true` -- `package.loaded['plex.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('rafi.config').lazy_notify() require('plex.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('rafi.config').load('options') require('plex.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')
@ -127,10 +127,10 @@ function M.init()
end end
end end
---@type RafiConfig ---@type plexConfig
local options local options
-- Load rafi and user config files. -- Load plex 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['rafi_' .. feat_name] = feat_val vim.g['plex_' .. 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 rafi's file, then user file -- always load plex's file, then user file
if M.defaults[name] or name == 'options' then if M.defaults[name] or name == 'options' then
_load('rafi.config.' .. name) _load('plex.config.' .. name)
end end
_load('config.' .. name) _load('config.' .. name)
if vim.bo.filetype == 'lazy' then if vim.bo.filetype == 'lazy' then
@ -310,7 +310,7 @@ setmetatable(M, {
if options == nil then if options == nil then
return vim.deepcopy(defaults)[key] return vim.deepcopy(defaults)[key]
end end
---@cast options RafiConfig ---@cast options plexConfig
return options[key] return options[key]
end, end,
}) })

View File

@ -2,21 +2,24 @@
-- github.com/rafi/vim-config -- 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 map = vim.keymap.set
local function augroup(name) local function augroup(name)
return vim.api.nvim_create_augroup('rafi_' .. name, {}) return vim.api.nvim_create_augroup('plex_' .. name, {})
end end
-- Elite-mode: Arrow-keys resize window -- enable elite mode, for people that are more used to vim than non-vim
if vim.g.rafi_elite_mode then vim.g.plex_elite_mode = true
map('n', '<Up>', '<cmd>resize +1<cr>', { desc = 'Resize Window' })
map('n', '<Down>', '<cmd>resize -1<cr>', { desc = 'Resize Window' }) -- Elite-mode: ctrl + Arrow-keys resize window
map('n', '<Left>', '<cmd>vertical resize +1<cr>', { desc = 'Resize Window' }) if vim.g.plex_elite_mode then
map('n', '<Right>', '<cmd>vertical resize -1<cr>', { desc = 'Resize Window' }) 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 end
-- Package-manager -- Package-manager
@ -27,16 +30,13 @@ map('n', '<leader>l', '<cmd>Lazy<cr>', { desc = 'Open Lazy UI' })
-- Navigation -- Navigation
-- === -- ===
-- Moves through display-lines, unless count is provided -- Move faster between lines
map({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) map({ 'n', 'x' }, 'J', "v:count == 30 ? 'gj' : 'J'", { expr = true, silent = true })
map({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) map({ 'n', 'x' }, 'K', "v:count == 30 ? 'gk' : 'K'", { expr = true, silent = true })
-- Easier line-wise movement -- Easier line-wise movement
map('n', 'gh', 'g^') map('n', 'H', 'g^')
map('n', 'gl', 'g$') map('n', 'L', 'g$')
map('n', '<Leader><Leader>', 'V', { desc = 'Visual Mode' })
map('x', '<Leader><Leader>', '<Esc>', { desc = 'Exit Visual Mode' })
-- Toggle fold or select option from popup menu -- Toggle fold or select option from popup menu
---@return string ---@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>cnext<CR>', { desc = 'Next Quickfix Item' })
map('n', '[q', '<cmd>cprev<CR>', { desc = 'Previous Quickfix Item' }) map('n', '[q', '<cmd>cprev<CR>', { desc = 'Previous Quickfix Item' })
end end
map('n', ']a', '<cmd>lnext<CR>', { desc = 'Next Loclist Item' }) map('n', '<A-k>', '<cmd>lnext<CR>', { desc = 'Next Loclist Item' })
map('n', '[a', '<cmd>lprev<CR>', { desc = 'Previous Loclist Item' }) map('n', '<A-j>', '<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('rafi.lib.edit').whitespace_jump(1) require('plex.lib.edit').whitespace_jump(1)
end, { desc = 'Next Whitespace' }) end, { desc = 'Next Whitespace' })
map('n', '[s', function() map('n', '[s', function()
require('rafi.lib.edit').whitespace_jump(-1) require('plex.lib.edit').whitespace_jump(-1)
end, { desc = 'Previous Whitespace' }) end, { desc = 'Previous Whitespace' })
-- Navigation in command line -- Navigation in command line
map('c', '<C-h>', '<Home>') map('c', '<C-h>', '<Home>')
map('c', '<C-l>', '<End>') map('c', '<C-l>', '<End>')
map('c', '<C-f>', '<Right>')
map('c', '<C-b>', '<Left>')
-- Scroll step sideways -- Scroll step sideways
map('n', 'zl', 'z4l') 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 Right and Re-select' })
map('x', '>', '>gv|', { desc = 'Indent Left 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 -- Use tab for indenting in visual/select mode
map('x', '<Tab>', '>gv|', { desc = 'Indent Left' }) map('x', '<Tab>', '>gv|', { desc = 'Indent Left' })
map('x', '<S-Tab>', '<gv', { desc = 'Indent Right' }) map('x', '<S-Tab>', '<gv', { desc = 'Indent Right' })
-- Drag current line/s vertically and auto-indent -- Drag current line/s vertically and auto-indent with Arrow up/down
map('n', '<Leader>k', '<cmd>move-2<CR>==', { desc = 'Move line up' }) map('n', '<UP>', '<cmd>move-2<CR>==', { desc = 'Move line up' })
map('n', '<Leader>j', '<cmd>move+<CR>==', { desc = 'Move line down' }) map('n', '<DOWN>', '<cmd>move+<CR>==', { desc = 'Move line down' })
map('x', '<Leader>k', ":move'<-2<CR>gv=gv", { desc = 'Move selection up' }) map('x', '<UP>', ":move'<-2<CR>gv=gv", { desc = 'Move selection up' })
map('x', '<Leader>j', ":move'>+<CR>gv=gv", { desc = 'Move selection down' }) map('x', '<DOWN>', ":move'>+<CR>gv=gv", { desc = 'Move selection down' })
-- Duplicate lines without affecting PRIMARY and CLIPBOARD selections. -- Duplicate lines without affecting PRIMARY and CLIPBOARD selections.
map('n', '<Leader>d', 'm`""Y""P``', { desc = 'Duplicate line' }) map('n', 'yyp', 'm`""Y""P``', { desc = 'Duplicate line' })
map('x', '<Leader>d', '""Y""Pgv', { desc = 'Duplicate selection' }) map('x', 'yyp', '""Y""Pgv', { desc = 'Duplicate selection' })
-- Duplicate paragraph
map('n', '<Leader>cp', 'yap<S-}>p', { desc = 'Duplicate Paragraph' })
-- Remove spaces at the end of lines -- Remove spaces at the end of lines
map('n', '<Leader>cw', '<cmd>lua MiniTrailspace.trim()<CR>', { desc = 'Erase Whitespace' }) 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 -- Search & Replace
-- === -- ===
-- Switch */g* and #/g# -- Make marks with m[some key]
map('n', '*', 'g*') -- go to mark with #[some key]
map('n', 'g*', '*') map('n', '#', '\'')
map('n', '#', 'g#')
map('n', 'g#', '#')
-- Clear search with <Esc> -- Clear search with <Esc>
map('n', '<Esc>', '<cmd>noh<CR>', { desc = 'Clear Search Highlight' }) 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' }) map('n', 'gpp', "'`['.strpart(getregtype(), 0, 1).'`]'", { expr = true, desc = 'Select Paste' })
-- Quick substitute within selected area -- Quick substitute within selected area
map('x', 'sg', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection' }) map('x', '<leader>sub', ':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' }
)
-- Command & History -- Command & History
-- === -- ===
@ -172,28 +160,15 @@ map(
map('n', '!', ':!', { desc = 'Execute Shell Command' }) map('n', '!', ':!', { desc = 'Execute Shell Command' })
-- Put vim command output into buffer -- Put vim command output into buffer
map('n', 'g!', ":put=execute('')<Left><Left>", { desc = 'Paste Command' }) --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>')
-- Allow misspellings -- Allow misspellings
vim.cmd.cnoreabbrev('qw', 'wq') --vim.cmd.cnoreabbrev('qw', 'wq')
vim.cmd.cnoreabbrev('Wq', 'wq') --vim.cmd.cnoreabbrev('Wq', 'wq')
vim.cmd.cnoreabbrev('WQ', 'wq') --vim.cmd.cnoreabbrev('WQ', 'wq')
vim.cmd.cnoreabbrev('Qa', 'qa') --vim.cmd.cnoreabbrev('Qa', 'qa')
vim.cmd.cnoreabbrev('Bd', 'bd') --vim.cmd.cnoreabbrev('Bd', 'bd')
vim.cmd.cnoreabbrev('bD', 'bd') --vim.cmd.cnoreabbrev('bD', 'bd')
-- File operations -- File operations
-- === -- ===
@ -208,18 +183,18 @@ map('n', '<Leader>cd', function()
end, { desc = 'Change Local Directory' }) end, { desc = 'Change Local Directory' })
-- Fast saving from all modes -- Fast saving from all modes
map('n', '<Leader>w', '<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' }) --map({ 'n', 'i', 'v' }, '<C-s>', '<cmd>write<CR>', { desc = 'Save' })
-- Editor UI -- Editor UI
-- === -- ===
-- Toggle editor's visual effects -- 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>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>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>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 if vim.lsp.inlay_hint then
map('n', '<leader>uh', function() vim.lsp.inlay_hint(0, nil) end, { desc = 'Toggle Inlay Hints' }) 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 -- Tabs: Many ways to navigate them
map('n', '<A-j>', '<cmd>tabnext<CR>', { desc = 'Next Tab' }) map('n', '<A-j>', '<cmd>tabnext<CR>', { desc = 'Next Tab' })
map('n', '<A-k>', '<cmd>tabprevious<CR>', { desc = 'Previous 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 -- Moving tabs
map('n', '<A-{>', '<cmd>-tabmove<CR>', { desc = 'Tab Move Backwards' }) map('n', '<A-S-j>', '<cmd>-tabmove<CR>', { desc = 'Tab Move Backwards' })
map('n', '<A-}>', '<cmd>+tabmove<CR>', { desc = 'Tab Move Forwards' }) map('n', '<A-S-k>', '<cmd>+tabmove<CR>', { desc = 'Tab Move Forwards' })
-- Show treesitter nodes under cursor -- Show treesitter nodes under cursor
-- highlights under cursor -- highlights under cursor
@ -260,25 +231,25 @@ end
-- Append mode-line to current buffer -- Append mode-line to current buffer
map('n', '<Leader>ml', function() map('n', '<Leader>ml', function()
require('rafi.lib.edit').append_modeline() require('plex.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('rafi.lib.edit').jump_buffer(1) -- require('plex.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('rafi.lib.edit').jump_buffer(-1) -- require('plex.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('rafi.lib.contextmenu').show() require('plex.lib.contextmenu').show()
end, { desc = 'Content-aware menu' }) end, { desc = 'Content-aware menu' })
-- Lazygit -- 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' }, { 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 -- Floating terminal
map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Enter Normal Mode' }) map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Enter Normal Mode' })
@ -307,7 +278,7 @@ end
-- === -- ===
-- Ultimatus Quitos -- 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' }, { vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, {
group = augroup('quit_mapping'), group = augroup('quit_mapping'),
callback = function(event) callback = function(event)
@ -321,7 +292,7 @@ end
-- Toggle quickfix window -- Toggle quickfix window
map('n', '<Leader>q', function() map('n', '<Leader>q', function()
require('rafi.lib.edit').toggle_list('quickfix') require('plex.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 +300,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('rafi.lib.edit').toggle_list('loclist') require('plex.lib.edit').toggle_list('loclist')
end, { desc = 'Open Location List' }) end, { desc = 'Open Location List' })
-- Switch with adjacent window -- Switch with adjacent window
@ -357,3 +328,4 @@ map('n', 'sh', function()
vim.o.background = 'dark' vim.o.background = 'dark'
end end
end, { desc = 'Toggle background dark/light' }) 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.virtualedit = 'block' -- Position cursor anywhere in visual blockd
opt.confirm = true -- Confirm to save changes before exiting modified bufferd opt.confirm = true -- Confirm to save changes before exiting modified bufferd
-- number
opt.number = true -- show line number
opt.relativenumber = false --
-- History and persistence -- History and persistence
opt.history = 5000 opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" } opt.shada = { "'1000", "<50", "s10", "h" }
@ -135,12 +131,12 @@ opt.wildmode = 'longest:full,full' -- Command-line completion mode
opt.termguicolors = true opt.termguicolors = true
opt.shortmess:append({ W = true, I = true, c = 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.scrolloff = 2 -- Keep at least 2 lines above/below
opt.sidescrolloff = 5 -- Keep at least 5 lines left/right opt.sidescrolloff = 5 -- Keep at least 5 lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = false -- Don't show line numbers opt.number = true -- Show line numbers
opt.ruler = false -- Disable default status ruler opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters opt.list = true -- Show hidden characters
opt.showtabline = 2 -- Always show the tabs line opt.showtabline = 2 -- Always show the tabs line

View File

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

View File

@ -27,7 +27,7 @@ local cache_keys = {
'badge_cache_icon', '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. -- 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('rafi.lib.utils').get_root(), ':t') or '' return vim.fn.fnamemodify(require('plex.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

@ -5,7 +5,7 @@ local root_patterns = { '.git', '_darcs', '.hg', '.bzr', '.svn' }
local M = {} 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) ---@param on_attach fun(client:lsp.Client, buffer:integer)
function M.on_attach(on_attach) function M.on_attach(on_attach)

View File

@ -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/rafi/config/init.lua -- Prepend with a fancy icon from config lua/plex/config/init.lua
local icons = require('rafi.config').icons local icons = require('plex.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,4 +1,4 @@
require('rafi.config').init() require('plex.config').init()
return { return {
{ 'folke/lazy.nvim', version = '*' }, { 'folke/lazy.nvim', version = '*' },

View File

@ -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('rafi_persisted', {}), group = vim.api.nvim_create_augroup('plex_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 = 'rafi_persisted', group = 'plex_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 = 'rafi_persisted', group = 'plex_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 = 'rafi_persisted', group = 'plex_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 = 'rafi_persisted', group = 'plex_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('rafi_illuminate', {}), group = vim.api.nvim_create_augroup('plex_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('rafi_outline', {}), group = vim.api.nvim_create_augroup('plex_outline', {}),
pattern = 'Outline', pattern = 'Outline',
callback = function() callback = function()
vim.opt_local.winhighlight = 'CursorLine:WildMenu' vim.opt_local.winhighlight = 'CursorLine:WildMenu'

View File

@ -6,6 +6,7 @@ return {
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
{ {
'zbirenbaum/copilot.lua', 'zbirenbaum/copilot.lua',
enabled = false,
cmd = 'Copilot', cmd = 'Copilot',
build = ':Copilot auth', build = ':Copilot auth',
opts = { opts = {
@ -24,7 +25,7 @@ return {
optional = true, optional = true,
event = 'VeryLazy', event = 'VeryLazy',
opts = function(_, opts) opts = function(_, opts)
local get_color = require('rafi.lib.color').get_color local get_color = require('plex.lib.color').get_color
local fg = function(...) local fg = function(...)
return { fg = get_color('fg', ...) } return { fg = get_color('fg', ...) }
end end
@ -38,7 +39,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('rafi.config').icons.kinds.Copilot local icon = require('plex.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 +81,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('rafi.lib.utils').on_attach(function(client) require('plex.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('rafi_emmet', {}), group = vim.api.nvim_create_augroup('plex_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('rafi_any-jump', {}), group = vim.api.nvim_create_augroup('plex_any-jump', {}),
pattern = 'any-jump', pattern = 'any-jump',
callback = function() callback = function()
vim.opt.cursorline = true vim.opt.cursorline = true

View File

@ -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('rafi_ftplugin_ansible', {}), group = vim.api.nvim_create_augroup('plex_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('rafi.lib.utils').on_attach(function(client, _) require('plex.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

@ -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('rafi.lib.utils').on_attach(function(client, _) require('plex.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

@ -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('rafi.lib.utils').opts('yaml-companion.nvim') require('plex.lib.utils').opts('yaml-companion.nvim')
) )
require('lspconfig')['yamlls'].setup(yamlls_opts) require('lspconfig')['yamlls'].setup(yamlls_opts)
return true return true

View File

@ -1,6 +1,7 @@
return { return {
{ {
'vimwiki/vimwiki', 'vimwiki/vimwiki',
enabled = false,
cmd = { 'VimwikiIndex', 'VimwikiUISelect' }, cmd = { 'VimwikiIndex', 'VimwikiUISelect' },
keys = { keys = {
{ '<Leader>W', '<cmd>VimwikiIndex<CR>', { noremap = true } }, { '<Leader>W', '<cmd>VimwikiIndex<CR>', { noremap = 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('rafi.config').icons.kinds) end, require('plex.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('rafi.config').icons.diagnostics local icons = require('plex.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('rafi.lib.badge').project() local project_root = require('plex.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('rafi_cursorword', {}) local augroup = vim.api.nvim_create_augroup('plex_cursorword', {})
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
group = augroup, group = augroup,
pattern = { pattern = {

View File

@ -87,7 +87,7 @@ return {
opts = function() opts = function()
local actions = require('diffview.actions') local actions = require('diffview.actions')
vim.api.nvim_create_autocmd({ 'WinEnter', 'BufEnter' }, { 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/*', pattern = 'diffview:///panels/*',
callback = function() callback = function()
vim.opt_local.cursorline = true vim.opt_local.cursorline = true

View File

@ -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('rafi.lib.utils').opts('nvim-lspconfig').format or {})) }, require('plex.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('rafi_format', {}), group = vim.api.nvim_create_augroup('plex_format', {}),
callback = function() callback = function()
if M.opts.autoformat then if M.opts.autoformat then
M.format() M.format()

View File

@ -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('rafi.lib.utils').has('vim-illuminate') then if require('plex.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

@ -18,7 +18,7 @@ return {
{ {
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
cond = function() cond = function()
return require('rafi.lib.utils').has('nvim-cmp') return require('plex.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('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'] 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('rafi.plugins.lsp.format').setup(opts) require('plex.plugins.lsp.format').setup(opts)
-- Setup formatting, keymaps and highlights. -- 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 client lsp.Client
---@param buffer integer ---@param buffer integer
lsp_on_attach(function(client, buffer) lsp_on_attach(function(client, buffer)
require('rafi.plugins.lsp.keymaps').on_attach(client, buffer) require('plex.plugins.lsp.keymaps').on_attach(client, buffer)
require('rafi.plugins.lsp.highlight').on_attach(client, buffer) require('plex.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('rafi.plugins.lsp.keymaps').on_attach(client, buffer) require('plex.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('rafi.config').icons.diagnostics) do for type, icon in pairs(require('plex.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('rafi.config').icons.diagnostics local icons = require('plex.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

@ -12,7 +12,7 @@ function M.get()
return M._keys return M._keys
end end
local format = function() local format = function()
require('rafi.plugins.lsp.format').format({ force = true }) require('plex.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('rafi.lib.utils').has('nvim-ufo') local winid = require('plex.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('rafi.lib.utils').opts('nvim-lspconfig') local opts = require('plex.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

@ -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('rafi.config').icons local icons = require('plex.config').icons
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 local fg = function(...) return { fg = get_color('fg', ...) } end
local function filepath() 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. -- % 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('rafi.lib.color').brightness_modifier(active.bg, -20), bg = require('plex.lib.color').brightness_modifier(active.bg, -20),
}, },
z = { z = {
fg = active.fg, fg = active.fg,
bg = require('rafi.lib.color').brightness_modifier(active.bg, 63), bg = require('plex.lib.color').brightness_modifier(active.bg, 63),
}, },
}, },
inactive = { inactive = {
@ -116,7 +116,7 @@ return {
}, },
lualine_b = { lualine_b = {
{ {
function() return require('rafi.lib.badge').icon() end, function() return require('plex.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('rafi.lib.badge').trails('') end, function() return require('plex.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('rafi.lib.badge').filemedia('') end, function() return require('plex.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('rafi.lib.badge').icon() end, function() return require('plex.lib.badge').icon() end,
padding = 1, padding = 1,
}, },
{ filepath, padding = { left = 1, right = 0 } }, { filepath, padding = { left = 1, right = 0 } },

View File

@ -48,9 +48,9 @@ return {
desc = 'Explorer NeoTree Toggle', desc = 'Explorer NeoTree Toggle',
}, },
{ {
'<LocalLeader>a', '<F5>',
'<cmd>Neotree filesystem left reveal dir=./<CR>', '<cmd>Neotree filesystem left toggle dir=./<CR>',
desc = 'Explorer NeoTree Reveal', desc = 'Explorer NeoTree Toggle',
}, },
}, },
deactivate = function() deactivate = function()
@ -80,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 = {
@ -138,6 +138,7 @@ return {
['l'] = 'open_drop', ['l'] = 'open_drop',
['h'] = 'close_node', ['h'] = 'close_node',
['C'] = 'close_node', ['C'] = 'close_node',
['<C-c>'] = 'set_root',
['z'] = 'close_all_nodes', ['z'] = 'close_all_nodes',
['<C-r>'] = 'refresh', ['<C-r>'] = 'refresh',

View File

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

View File

@ -149,7 +149,7 @@ return {
---@param client lsp.Client ---@param client lsp.Client
---@param buffer integer ---@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 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('rafi.config').icons.kinds, icons = require('plex.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('rafi.lib.utils') local Util = require('plex.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')

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,
},
}