feat: initial commit; NixOS Era
This commit is contained in:
22
pkgs/neovim/lua/BluePlum/commands.lua
Normal file
22
pkgs/neovim/lua/BluePlum/commands.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {})
|
||||
|
||||
vim.cmd.cnoreabbrev('Git', 'GIt')
|
||||
vim.api.nvim_create_user_command('GIt', function(ctx)
|
||||
local subcommand = ctx.fargs[1]
|
||||
if subcommand == 'log' then
|
||||
local argv = table.concat({
|
||||
'log',
|
||||
'--graph',
|
||||
'--abbrev-commit',
|
||||
'--decorate',
|
||||
}, ' ')
|
||||
|
||||
local sliced = vim.list_slice(ctx.fargs, 2)
|
||||
vim.cmd.Git(argv .. ' ' .. table.concat(sliced, ' '))
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd.Git(table.concat(ctx.fargs, ' '))
|
||||
end, {
|
||||
nargs = '+',
|
||||
})
|
||||
3
pkgs/neovim/lua/BluePlum/init.lua
Normal file
3
pkgs/neovim/lua/BluePlum/init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
require('BluePlum.set')
|
||||
require('BluePlum.keymap')
|
||||
require('BluePlum.commands')
|
||||
87
pkgs/neovim/lua/BluePlum/keymap.lua
Normal file
87
pkgs/neovim/lua/BluePlum/keymap.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
--- Defaults to `{'n'}`
|
||||
--- @alias Mode 'n'|'v'|'Q'|'t'|'i'|'c'
|
||||
--- @alias Mapping string|fun(): nil
|
||||
|
||||
--- @type table<string, { [string]: Mapping, modes: (Mode)[]? }>
|
||||
local keymap = {
|
||||
move_lines = {
|
||||
['<M-Up>'] = '<ESC>:move-2<CR>i',
|
||||
['<M-Down>'] = '<ESC>:move+<CR>i',
|
||||
modes = { 'i' },
|
||||
},
|
||||
half_screen_scroll = {
|
||||
['<C-Up>'] = '<C-u>zz',
|
||||
['<C-Down>'] = '<C-d>zz',
|
||||
},
|
||||
clipboard_yank = {
|
||||
['<leader>y'] = '"+y',
|
||||
modes = { 'n', 'v' },
|
||||
},
|
||||
terminal_escape = {
|
||||
['<ESC>'] = '<C-\\><C-n>',
|
||||
modes = { 't' },
|
||||
},
|
||||
terminal = {
|
||||
['<leader>t'] = function()
|
||||
OpenTerminal = OpenTerminal or nil
|
||||
|
||||
local open_buf = vim.api.nvim_get_current_buf()
|
||||
|
||||
if PreviousBuffer and open_buf == OpenTerminal then
|
||||
vim.api.nvim_set_current_buf(PreviousBuffer)
|
||||
PreviousBuffer = nil
|
||||
return
|
||||
end
|
||||
|
||||
PreviousBuffer = open_buf
|
||||
|
||||
if OpenTerminal then
|
||||
vim.api.nvim_set_current_buf(OpenTerminal)
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd.term()
|
||||
OpenTerminal = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_create_autocmd({ 'BufDelete' }, {
|
||||
callback = function()
|
||||
OpenTerminal = nil
|
||||
end,
|
||||
buffer = OpenTerminal,
|
||||
})
|
||||
end,
|
||||
},
|
||||
goto_last_buffer = {
|
||||
['<leader>l'] = ':e#<CR>',
|
||||
},
|
||||
scratch_pad = {
|
||||
['<leader>s'] = table.concat({
|
||||
':bo vs',
|
||||
':enew',
|
||||
':setlocal noswapfile',
|
||||
':setlocal bufhidden=hide',
|
||||
':set filetype=markdown',
|
||||
':set syntax=markdown',
|
||||
'',
|
||||
}, '<CR>'),
|
||||
},
|
||||
window_navigation = {
|
||||
['<M-q>'] = '<C-w>q',
|
||||
['<M-left>'] = '<C-w><left>',
|
||||
['<M-right>'] = '<C-w><right>',
|
||||
['<M-up>'] = '<C-w><up>',
|
||||
['<M-down>'] = '<C-w><down>',
|
||||
},
|
||||
}
|
||||
|
||||
for _, tbl in pairs(keymap) do
|
||||
for key, value in pairs(tbl) do
|
||||
if key ~= 'modes' then
|
||||
local modes = tbl.modes --[[ @as Mode[] ]]
|
||||
or { 'n' }
|
||||
for _, mode in ipairs(modes) do
|
||||
--- @cast value Mapping
|
||||
vim.keymap.set(mode, key, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
64
pkgs/neovim/lua/BluePlum/lazy.lua
Normal file
64
pkgs/neovim/lua/BluePlum/lazy.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
--- @class Lazy
|
||||
--- @field setup fun(opts: table)
|
||||
|
||||
local M = {}
|
||||
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
|
||||
--- @nodiscard
|
||||
--- @return Lazy?
|
||||
function M.bootstrap()
|
||||
--- @type { fs_stat: fun(path: string): boolean }
|
||||
local fs = vim.uv or vim.loop
|
||||
if fs.fs_stat(lazypath) then
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
return require('lazy')
|
||||
end
|
||||
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
|
||||
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
}, true, {})
|
||||
return nil
|
||||
end
|
||||
|
||||
return require('lazy')
|
||||
end
|
||||
|
||||
M.icons = 'echasnovski/mini.icons'
|
||||
M.icons_require = function()
|
||||
return require('mini.icons')
|
||||
end
|
||||
|
||||
--- @enum PlenaryModule
|
||||
local _ = {
|
||||
async = 'async',
|
||||
async_lib = 'async_lib',
|
||||
job = 'job',
|
||||
path = 'path',
|
||||
scandir = 'scandir',
|
||||
context_manager = 'context_manager',
|
||||
test_harness = 'test_harness',
|
||||
filetype = 'filetype',
|
||||
strings = 'strings',
|
||||
}
|
||||
|
||||
--- @param module PlenaryModule
|
||||
M.plenary_require = function(module)
|
||||
return require('plenary.' .. module)
|
||||
end
|
||||
M.plenary = 'nvim-lua/plenary.nvim'
|
||||
|
||||
--- @enum
|
||||
M.event = {
|
||||
BufEnter = 'BufEnter',
|
||||
BufWinEnter = 'BufWinEnter',
|
||||
BufWritePost = 'BufWritePost',
|
||||
VeryLazy = 'VeryLazy',
|
||||
}
|
||||
|
||||
return M
|
||||
96
pkgs/neovim/lua/BluePlum/set.lua
Normal file
96
pkgs/neovim/lua/BluePlum/set.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
local opts = {
|
||||
mapleader = ' ',
|
||||
|
||||
linenr = {
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
|
||||
cursorline = true,
|
||||
cursorlineopt = 'number',
|
||||
},
|
||||
|
||||
-- Use tabs for indents
|
||||
indent = {
|
||||
autoindent = true,
|
||||
noexpandtab = true,
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
},
|
||||
|
||||
terminal = {
|
||||
termguicolors = true,
|
||||
shell = vim.env.SHELL or '/bin/sh',
|
||||
},
|
||||
|
||||
split = {
|
||||
splitright = true,
|
||||
splitbelow = true,
|
||||
},
|
||||
|
||||
search = {
|
||||
hlsearch = false,
|
||||
incsearch = true,
|
||||
},
|
||||
|
||||
foldlevelstart = 99,
|
||||
}
|
||||
|
||||
--- @param tbl table
|
||||
local function apply(tbl)
|
||||
for key, value in pairs(tbl) do
|
||||
if type(value) == 'table' then
|
||||
apply(value)
|
||||
else
|
||||
if vim.fn.exists('&' .. key) == 1 then
|
||||
vim.opt[key] = value
|
||||
else
|
||||
vim.g[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
apply(opts)
|
||||
|
||||
-- Tabs for indenting
|
||||
-- vim.opt.autoindent = true
|
||||
-- vim.g.noexpandtab = true
|
||||
-- vim.opt.tabstop = 4
|
||||
-- vim.opt.shiftwidth = 4
|
||||
--
|
||||
-- -- Line numbers
|
||||
-- vim.opt.number = true
|
||||
-- vim.opt.relativenumber = true
|
||||
-- vim.opt.cursorline = true
|
||||
-- vim.opt.cursorlineopt = 'number'
|
||||
|
||||
-- Folding
|
||||
-- vim.opt.foldlevelstart = 99
|
||||
|
||||
-- vim.g.mapleader = ' '
|
||||
|
||||
-- Terminal
|
||||
-- vim.g.termguicolors = true
|
||||
-- vim.opt.shell = '/bin/fish'
|
||||
|
||||
-- LSP
|
||||
-- vim.lsp.inlay_hint.enable()
|
||||
|
||||
-- Splitting
|
||||
-- vim.opt.splitright = true
|
||||
-- vim.opt.splitbelow = true
|
||||
|
||||
-- Make text readable
|
||||
-- vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
-- pattern = { '*.md', '*.typ' },
|
||||
-- command = 'setlocal linebreak',
|
||||
-- })
|
||||
|
||||
-- vim.api.nvim_create_autocmd('FileType', {
|
||||
-- pattern = 'help',
|
||||
-- command = 'setlocal linebreak',
|
||||
-- })
|
||||
|
||||
-- Search
|
||||
-- vim.opt.hlsearch = false
|
||||
-- vim.opt.incsearch = true
|
||||
18
pkgs/neovim/lua/plugins/additions.lua
Normal file
18
pkgs/neovim/lua/plugins/additions.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
{
|
||||
'vyfor/cord.nvim',
|
||||
event = 'VeryLazy',
|
||||
build = ':Cord update',
|
||||
opts = {},
|
||||
cond = vim.env.CORDLESS ~= 'true',
|
||||
},
|
||||
{
|
||||
'tpope/vim-fugitive',
|
||||
cmd = { 'Git' },
|
||||
},
|
||||
{
|
||||
dir = '~/dev/share.nvim/',
|
||||
opts = {},
|
||||
enabled = false,
|
||||
},
|
||||
}
|
||||
32
pkgs/neovim/lua/plugins/deco.lua
Normal file
32
pkgs/neovim/lua/plugins/deco.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local common = require('BluePlum.lazy')
|
||||
|
||||
return {
|
||||
{ common.icons, opts = {} },
|
||||
{
|
||||
'folke/todo-comments.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {},
|
||||
event = common.event.BufWinEnter,
|
||||
},
|
||||
{
|
||||
'OXY2DEV/markview.nvim',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter', common.icons },
|
||||
ft = 'markdown',
|
||||
opts = {
|
||||
preview = {
|
||||
icon_provider = 'mini',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'sphamba/smear-cursor.nvim',
|
||||
opts = {
|
||||
time_interval = 17,
|
||||
anticipation = 0,
|
||||
damping = 0.8,
|
||||
|
||||
cursor_color = '#b7bcb9',
|
||||
legacy_computing_symbols_support = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
81
pkgs/neovim/lua/plugins/format.lua
Normal file
81
pkgs/neovim/lua/plugins/format.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
local common = require('BluePlum.lazy')
|
||||
|
||||
---@param exe string
|
||||
---@param args { [number]: string, path: boolean? }
|
||||
local function formatter(exe, args)
|
||||
return {
|
||||
function()
|
||||
local argv = {}
|
||||
|
||||
for _, val in ipairs(args) do
|
||||
table.insert(argv, val)
|
||||
end
|
||||
|
||||
if args.path ~= false then
|
||||
table.insert(argv, vim.fn.shellescape(vim.api.nvim_buf_get_name(0)))
|
||||
end
|
||||
|
||||
return {
|
||||
exe = exe,
|
||||
args = argv,
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
local prettier = formatter('prettier', {
|
||||
'--config-precedence prefer-file',
|
||||
'--single-quote',
|
||||
'--use-tabs',
|
||||
'--trailing-comma es5',
|
||||
'--bracket-same-line',
|
||||
'--stdin-filepath',
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
'mhartington/formatter.nvim',
|
||||
event = common.event.BufWritePost,
|
||||
opts = {
|
||||
filetype = {
|
||||
javascript = prettier,
|
||||
typescript = prettier,
|
||||
markdown = prettier,
|
||||
css = prettier,
|
||||
json = prettier,
|
||||
html = prettier,
|
||||
scss = prettier,
|
||||
rust = formatter('rustfmt', { path = false }),
|
||||
lua = formatter('stylua', {
|
||||
'--indent-type Tabs',
|
||||
'--line-endings Unix',
|
||||
'--quote-style AutoPreferSingle',
|
||||
'--column-width' .. ' ' .. vim.o.columns,
|
||||
'-',
|
||||
}),
|
||||
nix = formatter('nixfmt', {
|
||||
'--indent=4',
|
||||
'--strict',
|
||||
}),
|
||||
|
||||
['*'] = {
|
||||
function()
|
||||
if vim.lsp.buf.formatting then
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(lazy)
|
||||
require('formatter').setup(lazy.opts)
|
||||
|
||||
vim.api.nvim_create_augroup('__formatter__', { clear = true })
|
||||
vim.api.nvim_create_autocmd(common.event.BufWritePost, {
|
||||
group = '__formatter__',
|
||||
command = ':FormatWriteLock',
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
87
pkgs/neovim/lua/plugins/lsp.lua
Normal file
87
pkgs/neovim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
local common = require('BluePlum.lazy')
|
||||
|
||||
return {
|
||||
-- Mason
|
||||
{ 'mason-org/mason.nvim', opts = {} },
|
||||
{
|
||||
'mason-org/mason-lspconfig.nvim',
|
||||
version = '1.*',
|
||||
config = function(lazy)
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
|
||||
mason_lspconfig.setup(lazy.opts)
|
||||
mason_lspconfig.setup_handlers({
|
||||
vim.lsp.enable
|
||||
})
|
||||
|
||||
vim.lsp.enable('nixd')
|
||||
vim.lsp.enable('rust_analyzer')
|
||||
end,
|
||||
dependencies = {
|
||||
'mason-org/mason.nvim',
|
||||
},
|
||||
},
|
||||
{
|
||||
'Saghen/blink.cmp',
|
||||
dependencies = { common.icons },
|
||||
version = '1.*',
|
||||
build = 'cargo build --release',
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = 'default',
|
||||
|
||||
['<Up>'] = { 'select_prev', 'fallback' },
|
||||
['<Down>'] = { 'select_next', 'fallback' },
|
||||
|
||||
['<Tab>'] = { 'accept', 'fallback' },
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = 'normal',
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'buffer', 'path', 'omni' },
|
||||
},
|
||||
completion = {
|
||||
list = { selection = { auto_insert = false } },
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 700,
|
||||
},
|
||||
ghost_text = { enabled = true },
|
||||
menu = {
|
||||
auto_show = true,
|
||||
draw = {
|
||||
columns = { { 'kind_icon' }, { 'label', 'label_description', gap = 1 }, { 'kind' } },
|
||||
components = {
|
||||
kind_icon = {
|
||||
text = function(ctx)
|
||||
local icon, _, _ = common.icons_require().get('lsp', ctx.kind)
|
||||
return icon
|
||||
end,
|
||||
},
|
||||
kind = {
|
||||
text = function(ctx)
|
||||
return '(' .. ctx.kind .. ')'
|
||||
end,
|
||||
highlight = 'SpecialKey',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
enabled = true,
|
||||
keymap = { preset = 'inherit' },
|
||||
sources = { 'buffer', 'cmdline' },
|
||||
completion = {
|
||||
list = { selection = { preselect = true, auto_insert = false } },
|
||||
ghost_text = { enabled = true },
|
||||
menu = {
|
||||
auto_show = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
signature = { enabled = true, window = { show_documentation = true } },
|
||||
},
|
||||
},
|
||||
}
|
||||
50
pkgs/neovim/lua/plugins/nav.lua
Normal file
50
pkgs/neovim/lua/plugins/nav.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
local common = require('BluePlum.lazy')
|
||||
local telescope = {
|
||||
find_files = function()
|
||||
require('telescope.builtin').find_files({ show_hidden = true })
|
||||
end,
|
||||
live_grep = function()
|
||||
require('telescope.builtin').live_grep()
|
||||
end,
|
||||
buffers = function()
|
||||
require('telescope.builtin').buffers()
|
||||
end,
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { common.plenary },
|
||||
keys = {
|
||||
{ '<leader>ff', telescope.find_files },
|
||||
{ '<leader>fs', telescope.live_grep },
|
||||
{ '<leader>bb', telescope.buffers },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
opts = {
|
||||
default_file_explorer = true,
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '<leader>ex', vim.cmd.Oil },
|
||||
},
|
||||
},
|
||||
{
|
||||
'Kaiser-Yang/flash.nvim',
|
||||
branch = 'develop',
|
||||
event = common.event.VeryLazy,
|
||||
opts = {
|
||||
modes = {
|
||||
char = {
|
||||
multi_line = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
43
pkgs/neovim/lua/plugins/theme.lua
Normal file
43
pkgs/neovim/lua/plugins/theme.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
{
|
||||
'nyoom-engineering/oxocarbon.nvim',
|
||||
priority = 999,
|
||||
config = function()
|
||||
vim.cmd.colorscheme('oxocarbon')
|
||||
|
||||
local groups = {
|
||||
Text = 'Identifier',
|
||||
Method = '@function.builtin',
|
||||
Function = 'Function',
|
||||
Constructor = '@character',
|
||||
Field = '@property',
|
||||
Variable = '@label',
|
||||
Class = 'Todo',
|
||||
Interface = 'Type',
|
||||
Module = 'Macro',
|
||||
Property = '@property',
|
||||
Unit = 'Type',
|
||||
Value = 'Number',
|
||||
Enum = 'String',
|
||||
Keyword = 'Identifier',
|
||||
Snippet = 'Identifier',
|
||||
Color = 'Identifier',
|
||||
File = 'Identifier',
|
||||
Folder = 'identifier',
|
||||
Reference = 'Identifier',
|
||||
EnumMember = 'String',
|
||||
Constant = '@constant.builtin',
|
||||
Struct = 'Type',
|
||||
Event = '@constant',
|
||||
Operator = 'Structure',
|
||||
TypeParameter = 'Type',
|
||||
}
|
||||
|
||||
for key, value in pairs(groups) do
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpKind' .. key, { link = value })
|
||||
end
|
||||
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { link = 'IncSearch' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
19
pkgs/neovim/lua/plugins/treesitter.lua
Normal file
19
pkgs/neovim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local common = require('BluePlum.lazy')
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
event = common.event.VeryLazy,
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
ensure_installed = { 'lua', 'markdown', 'typescript', 'javascript', 'rust', 'json', 'toml' },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
auto_install = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user