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
|
||||
Reference in New Issue
Block a user