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
local config = require('plex.config')
local config = require('rafi.config')
config.ensure_lazy()
-- Start lazy.nvim plugin manager.
require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
spec = {
{ 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' },
{ 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' },
-- This will load a custom user lua/plugins.lua or lua/plugins/*
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
-- 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)
return vim.api.nvim_create_augroup('plex_' .. name, {})
return vim.api.nvim_create_augroup('rafi_' .. name, {})
end
-- Check if we need to reload the file when it changed

View File

@ -1,5 +1,5 @@
-- 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.
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/init.lua
@ -14,12 +14,12 @@ local defaults = {
-- Load the default settings
-- stylua: ignore
defaults = {
autocmds = true, -- plex.config.autocmds
keymaps = true, -- plex.config.keymaps
-- plex.config.options can't be configured here since it's loaded
autocmds = true, -- rafi.config.autocmds
keymaps = true, -- rafi.config.keymaps
-- rafi.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['plex.config.options'] = true`
-- `package.loaded['rafi.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('plex.config').lazy_notify()
require('rafi.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('plex.config').load('options')
require('rafi.config').load('options')
-- carry over plugin options that their name has been changed.
local Plugin = require('lazy.core.plugin')
@ -130,7 +130,7 @@ end
---@type RafiConfig
local options
-- Load plex and user config files.
-- Load rafi 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['plex_' .. feat_name] = feat_val
vim.g['rafi_' .. feat_name] = feat_val
end
M.load('autocmds')
@ -209,9 +209,9 @@ function M.load(name)
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
_load('plex.config.' .. name)
_load('rafi.config.' .. name)
end
_load('config.' .. name)
if vim.bo.filetype == 'lazy' then

View File

@ -1,18 +1,18 @@
-- 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 function augroup(name)
return vim.api.nvim_create_augroup('plex_' .. name, {})
return vim.api.nvim_create_augroup('rafi_' .. name, {})
end
-- 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', '<Down>', '<cmd>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)
map('n', ']s', function()
require('plex.lib.edit').whitespace_jump(1)
require('rafi.lib.edit').whitespace_jump(1)
end, { desc = 'Next Whitespace' })
map('n', '[s', function()
require('plex.lib.edit').whitespace_jump(-1)
require('rafi.lib.edit').whitespace_jump(-1)
end, { desc = 'Previous Whitespace' })
-- Navigation in command line
@ -160,7 +160,7 @@ map('x', 'sg', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection
map(
'x',
'<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>',
{ desc = 'Replace Selection' }
)
@ -215,7 +215,7 @@ map({ 'n', 'i', 'v' }, '<C-s>', '<cmd>write<CR>', { desc = 'Save' })
-- ===
-- 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>ul', '<cmd>setlocal nonumber!<CR>', { desc = 'Toggle Line Numbers' })
map('n', '<Leader>uo', '<cmd>setlocal nolist!<CR>', { desc = 'Toggle Whitespace Symbols' })
@ -260,20 +260,20 @@ end
-- Append mode-line to current buffer
map('n', '<Leader>ml', function()
require('plex.lib.edit').append_modeline()
require('rafi.lib.edit').append_modeline()
end, { desc = 'Append Modeline' })
-- Jump entire buffers throughout jumplist
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' })
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' })
-- Context aware menu. See lua/lib/contextmenu.lua
map('n', '<LocalLeader>c', function()
require('plex.lib.contextmenu').show()
require('rafi.lib.contextmenu').show()
end, { desc = 'Content-aware menu' })
-- Lazygit
@ -307,7 +307,7 @@ end
-- ===
-- 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' }, {
group = augroup('quit_mapping'),
callback = function(event)
@ -321,7 +321,7 @@ end
-- Toggle quickfix window
map('n', '<Leader>q', function()
require('plex.lib.edit').toggle_list('quickfix')
require('rafi.lib.edit').toggle_list('quickfix')
end, { desc = 'Open Quickfix' })
-- Set locations with diagnostics and open the list.
@ -329,7 +329,7 @@ map('n', '<Leader>a', function()
if vim.bo.filetype ~= 'qf' then
vim.diagnostic.setloclist({ open = false })
end
require('plex.lib.edit').toggle_list('loclist')
require('rafi.lib.edit').toggle_list('loclist')
end, { desc = 'Open Location List' })
-- Switch with adjacent window

View File

@ -1,5 +1,5 @@
-- 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

View File

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

View File

@ -1,5 +1,5 @@
-- Badge utilities
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
local plugin_icons = {
DiffviewFiles = { '' },
@ -27,7 +27,7 @@ local cache_keys = {
'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.
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('plex.lib.utils').get_root(), ':t') or ''
return vim.fn.fnamemodify(require('rafi.lib.utils').get_root(), ':t') or ''
end
-- Provides relative path with limited characters in each directory name, and

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
-- General utilities
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
local root_patterns = { '.git', '_darcs', '.hg', '.bzr', '.svn' }
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)
function M.on_attach(on_attach)

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
-- Plugins: Editor
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
local is_windows = vim.loop.os_uname().sysname == 'Windows_NT'
@ -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('plex_persisted', {}),
group = vim.api.nvim_create_augroup('rafi_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 = 'plex_persisted',
group = 'rafi_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 = 'plex_persisted',
group = 'rafi_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 = 'plex_persisted',
group = 'rafi_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 = 'plex_persisted',
group = 'rafi_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('plex_illuminate', {}),
group = vim.api.nvim_create_augroup('rafi_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('plex_outline', {}),
group = vim.api.nvim_create_augroup('rafi_outline', {}),
pattern = 'Outline',
callback = function()
vim.opt_local.winhighlight = 'CursorLine:WildMenu'

View File

@ -24,7 +24,7 @@ return {
optional = true,
event = 'VeryLazy',
opts = function(_, opts)
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
@ -38,7 +38,7 @@ return {
-- Add copilot icon to lualine statusline
table.insert(opts.sections.lualine_x, {
function()
local icon = require('plex.config').icons.kinds.Copilot
local icon = require('rafi.config').icons.kinds.Copilot
local status = require('copilot.api').status.data
return icon .. (status.message or '')
end,
@ -80,7 +80,7 @@ return {
-- attach cmp source whenever copilot attaches
-- fixes lazy-loading issues with the copilot cmp source
---@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
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('plex_emmet', {}),
group = vim.api.nvim_create_augroup('rafi_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('plex_any-jump', {}),
group = vim.api.nvim_create_augroup('rafi_any-jump', {}),
pattern = 'any-jump',
callback = function()
vim.opt.cursorline = true

View File

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

View File

@ -1,4 +1,4 @@
-- plex.plugins.extras.lang.ansible
-- rafi.plugins.extras.lang.ansible
--
return {
@ -26,7 +26,7 @@ return {
-- Setup filetype settings
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',
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('plex.lib.utils').on_attach(function(client, _)
require('rafi.lib.utils').on_attach(function(client, _)
if client.name == 'gopls' then
if not client.server_capabilities.semanticTokensProvider then
local semantic =

View File

@ -1,4 +1,4 @@
-- plex.plugins.extras.lang.helm
-- rafi.plugins.extras.lang.helm
--
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.
@ -19,7 +19,7 @@ return {
{
'neovim/nvim-lspconfig',
dependencies = 'plex/neoconf-venom.nvim',
dependencies = 'rafi/neoconf-venom.nvim',
opts = {
servers = {
pyright = {},
@ -28,7 +28,7 @@ return {
},
{
'plex/neoconf-venom.nvim',
'rafi/neoconf-venom.nvim',
main = 'venom',
opts = {},
-- stylua: ignore

View File

@ -17,7 +17,7 @@ return {
opts.root_dir = util.root_pattern(unpack(root_files))
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
client.server_capabilities.hoverProvider = false
end

View File

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

View File

@ -6,7 +6,7 @@ return {
setup = {
yamlls = function(_, _)
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)
return true

View File

@ -15,7 +15,7 @@ return {
opts = function()
local kind_icons = vim.tbl_map(function(icon)
return vim.trim(icon)
end, require('plex.config').icons.kinds)
end, require('rafi.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('plex.config').icons.diagnostics
local icons = require('rafi.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('plex.lib.badge').project()
local project_root = require('rafi.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('plex_cursorword', {})
local augroup = vim.api.nvim_create_augroup('rafi_cursorword', {})
vim.api.nvim_create_autocmd('FileType', {
group = augroup,
pattern = {

View File

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

View File

@ -1,5 +1,5 @@
-- LSP: Highlights
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
-- This is part of LunarVim's code, with my modifications.
-- Reference: https://github.com/LunarVim/LunarVim
@ -9,7 +9,7 @@ local M = {}
---@param client lsp.Client
---@param bufnr integer
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.
return
end

View File

@ -1,5 +1,5 @@
-- LSP: Plugins
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
-- This is part of LazyVim's code, with my modifications.
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/init.lua
@ -18,7 +18,7 @@ return {
{
'hrsh7th/cmp-nvim-lsp',
cond = function()
return require('plex.lib.utils').has('nvim-cmp')
return require('rafi.lib.utils').has('nvim-cmp')
end,
},
},
@ -90,19 +90,19 @@ return {
},
---@param opts PluginLspOpts
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']
require('neoconf').setup(require('lazy.core.plugin').values(plugin, 'opts', false))
end
-- Setup autoformat
require('plex.plugins.lsp.format').setup(opts)
require('rafi.plugins.lsp.format').setup(opts)
-- 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 buffer integer
lsp_on_attach(function(client, buffer)
require('plex.plugins.lsp.keymaps').on_attach(client, buffer)
require('plex.plugins.lsp.highlight').on_attach(client, buffer)
require('rafi.plugins.lsp.keymaps').on_attach(client, buffer)
require('rafi.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('plex.plugins.lsp.keymaps').on_attach(client, buffer)
require('rafi.plugins.lsp.keymaps').on_attach(client, buffer)
end
return ret
end
-- 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
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('plex.config').icons.diagnostics
local icons = require('rafi.config').icons.diagnostics
for d, icon in pairs(icons) do
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
return icon

View File

@ -1,5 +1,5 @@
-- LSP: Key-maps
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
local M = {}
@ -12,7 +12,7 @@ function M.get()
return M._keys
end
local format = function()
require('plex.plugins.lsp.format').format({ force = true })
require('rafi.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('plex.lib.utils').has('nvim-ufo')
local winid = require('rafi.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('plex.lib.utils').opts('nvim-lspconfig')
local opts = require('rafi.lib.utils').opts('nvim-lspconfig')
local clients
if vim.lsp.get_clients ~= nil then
clients = vim.lsp.get_clients({ bufnr = buffer })

View File

@ -1,5 +1,5 @@
-- Plugin: Lualine
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
return {
@ -15,12 +15,12 @@ return {
vim.g.qf_disable_statusline = true
end,
opts = function()
local icons = require('plex.config').icons
local get_color = require('plex.lib.color').get_color
local icons = require('rafi.config').icons
local get_color = require('rafi.lib.color').get_color
local fg = function(...) return { fg = get_color('fg', ...) } end
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.
return fpath:gsub('%%', '%%%%')
end
@ -53,11 +53,11 @@ return {
x = active,
y = {
fg = active.fg,
bg = require('plex.lib.color').brightness_modifier(active.bg, -20),
bg = require('rafi.lib.color').brightness_modifier(active.bg, -20),
},
z = {
fg = active.fg,
bg = require('plex.lib.color').brightness_modifier(active.bg, 63),
bg = require('rafi.lib.color').brightness_modifier(active.bg, 63),
},
},
inactive = {
@ -116,7 +116,7 @@ return {
},
lualine_b = {
{
function() return require('plex.lib.badge').icon() end,
function() return require('rafi.lib.badge').icon() end,
padding = { left = 1, right = 0 },
},
{
@ -160,7 +160,7 @@ return {
-- Whitespace trails
{
function() return require('plex.lib.badge').trails('') end,
function() return require('rafi.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('plex.lib.badge').filemedia('') end,
function() return require('rafi.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('plex.lib.badge').icon() end,
function() return require('rafi.lib.badge').icon() end,
padding = 1,
},
{ filepath, padding = { left = 1, right = 0 } },

View File

@ -47,6 +47,11 @@ return {
'<cmd>Neotree filesystem left toggle dir=./<CR>',
desc = 'Explorer NeoTree Toggle',
},
{
'<LocalLeader>a',
'<cmd>Neotree filesystem left reveal dir=./<CR>',
desc = 'Explorer NeoTree Reveal',
},
},
deactivate = function()
vim.cmd([[Neotree close]])
@ -75,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 = {
@ -124,15 +129,15 @@ return {
width = winwidth,
mappings = {
['q'] = 'close_window',
['?'] = 'show_help',
['?'] = 'noop',
['<Space>'] = 'noop',
['g?'] = 'show_help',
['<2-LeftMouse>'] = 'open',
['<CR>'] = 'open_with_window_picker',
['l'] = 'open_drop',
['h'] = 'change_root_to_node',
['C'] = 'cd',
['h'] = 'close_node',
['C'] = 'close_node',
['z'] = 'close_all_nodes',
['<C-r>'] = 'refresh',

View File

@ -1,12 +1,12 @@
-- Plugins: UI
-- https://github.com/plex/vim-config
-- https://github.com/rafi/vim-config
return {
-----------------------------------------------------------------------------
{ 'nvim-tree/nvim-web-devicons', 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 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
require('nvim-navic').attach(client, buffer)
end
@ -159,7 +159,7 @@ return {
return {
separator = '',
highlight = true,
icons = require('plex.config').icons.kinds,
icons = require('rafi.config').icons.kinds,
}
end,
},
@ -188,7 +188,7 @@ return {
},
init = function()
-- 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
Util.on_very_lazy(function()
vim.notify = require('notify')