Compare commits
10 Commits
b5d76327ed
...
0cd39229d3
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cd39229d3 | |||
| 99e9bd20aa | |||
| 8eb01590c3 | |||
| c9e48695c5 | |||
| 4e43881829 | |||
| 10caaf81c1 | |||
| fa0f1fbab9 | |||
| 2cb5d914fb | |||
| b3a59604a3 | |||
| a6f1537b1d |
@@ -23,3 +23,5 @@ alias wgoff 'echo "$(set_color red)You changed this dimwit, use \'vpn\' instead"
|
|||||||
#alias gref 'git show -s --pretty=reference '
|
#alias gref 'git show -s --pretty=reference '
|
||||||
alias glog 'git lg'
|
alias glog 'git lg'
|
||||||
alias gref 'git ref'
|
alias gref 'git ref'
|
||||||
|
|
||||||
|
alias disable_webkit 'set -gx WEBKIT_DISABLE_DMABUF_RENDERER 1; set -gx WEBKIT_DISABLE_COMPOSITING_MODE 1'
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ if not test -d $_TEMP
|
|||||||
mkdir -p $_TEMP
|
mkdir -p $_TEMP
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set -x GPG_TTY $(tty)
|
||||||
|
|
||||||
source ~/.config/fish/alias.fish
|
source ~/.config/fish/alias.fish
|
||||||
source ~/.config/fish/prompt.fish
|
source ~/.config/fish/prompt.fish
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ function vpn
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if wg-quick up $_path
|
if sudo wg-quick up $_path
|
||||||
echo "true" > "$_TEMP/vpn-status"
|
echo "true" > "$_TEMP/vpn-status"
|
||||||
if not $_silent
|
if not $_silent
|
||||||
echo "Successfully enabled."
|
echo "Successfully enabled."
|
||||||
@@ -71,7 +71,7 @@ function vpn
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if wg-quick down $_path
|
if sudo wg-quick down $_path
|
||||||
echo "false" > "$_TEMP/vpn-status"
|
echo "false" > "$_TEMP/vpn-status"
|
||||||
if not $_silent
|
if not $_silent
|
||||||
echo "Successfully disabled."
|
echo "Successfully disabled."
|
||||||
|
|||||||
7
.config/nvim/.luarc.json
Normal file
7
.config/nvim/.luarc.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"runtime.version": "LuaJIT",
|
||||||
|
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
|
||||||
|
"diagnostics.globals": ["vim"],
|
||||||
|
"workspace.checkThirdParty": false,
|
||||||
|
"workspace.library": ["$VIMRUNTIME"]
|
||||||
|
}
|
||||||
1
.config/nvim/after/ftplugin/fish.lua
Normal file
1
.config/nvim/after/ftplugin/fish.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
vim.lsp.enable('fish_ls')
|
||||||
2
.config/nvim/after/ftplugin/markdown.lua
Normal file
2
.config/nvim/after/ftplugin/markdown.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
vim.wo.wrap = false
|
||||||
|
vim.opt.expandtab = true
|
||||||
@@ -1,32 +1,13 @@
|
|||||||
-- Lazy bootstrap
|
local lazy = require('BluePlum.lazy').bootstrap()
|
||||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
||||||
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' },
|
|
||||||
{ '\nPress any key to exit...' },
|
|
||||||
}, true, {})
|
|
||||||
vim.fn.getchar()
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
require('BluePlum.set')
|
require('BluePlum')
|
||||||
require('BluePlum.keymap')
|
|
||||||
require('BluePlum.neovide')
|
|
||||||
|
|
||||||
require('lazy').setup({
|
if lazy then
|
||||||
-- Plugins
|
lazy.setup({
|
||||||
spec = {
|
spec = {
|
||||||
{ import = 'plugins' },
|
{ import = 'plugins' },
|
||||||
},
|
},
|
||||||
checker = { enabled = false },
|
checker = { enabled = false },
|
||||||
change_detection = { notify = false },
|
change_detection = { notify = false },
|
||||||
})
|
})
|
||||||
|
end
|
||||||
require('lsp')
|
|
||||||
require('BluePlum.input')
|
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
|
||||||
"actions-preview.nvim": { "branch": "master", "commit": "9f52a01c374318e91337697ebed51c6fae57f8a4" },
|
"cord.nvim": { "branch": "master", "commit": "a4484bb25e343a375d95b250ffadbdcbfbfdf2ac" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"flash.nvim": { "branch": "develop", "commit": "045457978f3fb7df03efa2023dbc8a5f6e9179bd" },
|
||||||
"cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" },
|
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
|
||||||
"compile-mode.nvim": { "branch": "main", "commit": "8dff8d8472363e01499a4e8cc02f5f5595ce3922" },
|
|
||||||
"cord.nvim": { "branch": "client-server", "commit": "33d20ab3ea7ea5a38a5a569abc1409d4e5a43024" },
|
|
||||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
|
||||||
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
|
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
|
||||||
"gruber-darker.nvim": { "branch": "main", "commit": "a2dda61d9c1225e16951a51d6b89795b0ac35cd6" },
|
|
||||||
"inc-rename.nvim": { "branch": "main", "commit": "f9b9e5b9a75074810f40881b7e254b5bbeaf122e" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lsp-zero.nvim": { "branch": "v4.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" },
|
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||||
"lsp_signature.nvim": { "branch": "master", "commit": "5b64964ed02098c85613ee3d20f96bed1dfb64cc" },
|
"markview.nvim": { "branch": "main", "commit": "d5d37102d24c3d5d032b01263855081b6850509b" },
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||||
"markview.nvim": { "branch": "main", "commit": "6e9f1840ba33e5318285ad97c22676f55b753479" },
|
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
|
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
"nvim-treesitter": { "branch": "main", "commit": "dafb3cb3cb066774526c1103f3d1d6b34578800b" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
"oxocarbon.nvim": { "branch": "main", "commit": "acdfdd5d319c36170b5ad2a120283bec2f450081" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "51562d44fc6280f92bb9a3d87e7b3cb327377ca5" },
|
"smear-cursor.nvim": { "branch": "main", "commit": "4a0f7ac265b4ed1ce4d0af2afc13072763bfa691" },
|
||||||
"nvim-ufo": { "branch": "main", "commit": "4c64d89c2bf174d95d4ac91cc959a9e43e2f318c" },
|
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
|
|
||||||
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
|
||||||
"smear-cursor.nvim": { "branch": "main", "commit": "791bd7871e612b17520cbde19ddede306d83ef11" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2" },
|
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" }
|
||||||
"vim-grepper": { "branch": "master", "commit": "f1b441c23f0227b28c36be383b562ab47dbecec4" }
|
|
||||||
}
|
}
|
||||||
|
|||||||
4
.config/nvim/lsp/bashls.lua
Normal file
4
.config/nvim/lsp/bashls.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
cmd = { 'bash-language-server', 'start' },
|
||||||
|
filetypes = { 'sh', 'bash' },
|
||||||
|
}
|
||||||
4
.config/nvim/lsp/fish_ls.lua
Normal file
4
.config/nvim/lsp/fish_ls.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
cmd = { 'fish-lsp', 'start' },
|
||||||
|
filetypes = { 'fish' },
|
||||||
|
}
|
||||||
5
.config/nvim/lsp/lua_ls.lua
Normal file
5
.config/nvim/lsp/lua_ls.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
cmd = { 'lua-language-server' },
|
||||||
|
filetypes = { 'lua' },
|
||||||
|
root_markers = { '.luarc.json', '.luarc.jsonc' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/rust_analyzer.lua
Normal file
12
.config/nvim/lsp/rust_analyzer.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
cmd = { 'rust-analyzer' },
|
||||||
|
filetypes = { 'rust' },
|
||||||
|
root_markers = { 'Cargo.toml', '.git' },
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
check = {
|
||||||
|
command = 'clippy',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
5
.config/nvim/lsp/ts_ls.lua
Normal file
5
.config/nvim/lsp/ts_ls.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
cmd = { 'typescript-language-server', '--stdio' },
|
||||||
|
filetypes = { 'typescript', 'javascript' },
|
||||||
|
root_markers = { 'package.json', 'tsconfig.json' },
|
||||||
|
}
|
||||||
22
.config/nvim/lua/BluePlum/commands.lua
Normal file
22
.config/nvim/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
.config/nvim/lua/BluePlum/init.lua
Normal file
3
.config/nvim/lua/BluePlum/init.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
require('BluePlum.set')
|
||||||
|
require('BluePlum.keymap')
|
||||||
|
require('BluePlum.commands')
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
local M = {
|
|
||||||
interupt = false,
|
|
||||||
}
|
|
||||||
|
|
||||||
M.Keys = {
|
|
||||||
enter = '<CR>',
|
|
||||||
tab = '<Tab>',
|
|
||||||
backspace = '<BS>',
|
|
||||||
escape = '<Esc>',
|
|
||||||
|
|
||||||
-- if await_key().is_arrow
|
|
||||||
-- if key == Keys.left
|
|
||||||
left = { is_arrow = true, this = '<Left>' },
|
|
||||||
right = { is_arrow = true, this = '<Right>' },
|
|
||||||
up = { is_arrow = true, this = '<Up>' },
|
|
||||||
down = { is_arrow = true, this = '<Down>' },
|
|
||||||
}
|
|
||||||
|
|
||||||
function M.await_key()
|
|
||||||
-- local char = vim.fn.getchar()
|
|
||||||
local char = vim.fn.getchar()
|
|
||||||
local num = vim.fn.nr2char(char)
|
|
||||||
local key = vim.fn.keytrans(num)
|
|
||||||
-- vim.print(char, num, key, key == '<BS>')
|
|
||||||
|
|
||||||
-- Some special keys work weird..
|
|
||||||
local is_key = function(key)
|
|
||||||
return pcall(function(char)
|
|
||||||
if vim.fn.keytrans(char) ~= key then
|
|
||||||
error()
|
|
||||||
end
|
|
||||||
end, char)
|
|
||||||
end
|
|
||||||
|
|
||||||
if is_key('<BS>') then
|
|
||||||
return M.Keys.backspace
|
|
||||||
elseif is_key('<Left>') then
|
|
||||||
return M.Keys.left
|
|
||||||
elseif is_key('<Right>') then
|
|
||||||
return M.Keys.right
|
|
||||||
elseif is_key('<Up>') then
|
|
||||||
return M.Keys.up
|
|
||||||
elseif is_key('<Down>') then
|
|
||||||
return M.Keys.down
|
|
||||||
elseif key == '<Space>' then
|
|
||||||
return ' '
|
|
||||||
elseif key == '<Lt>' then
|
|
||||||
return '<'
|
|
||||||
elseif key == '<Gt>' then
|
|
||||||
return '>'
|
|
||||||
end
|
|
||||||
|
|
||||||
return key
|
|
||||||
end
|
|
||||||
|
|
||||||
-- vim.print(vim.fn.getcompletion('ech', 'command'))
|
|
||||||
-- vim.fn.getchar()
|
|
||||||
|
|
||||||
local function refresh_completions(pattern, kind)
|
|
||||||
local completions = vim.fn.getcompletion(pattern, kind)
|
|
||||||
|
|
||||||
if #completions > 25 then
|
|
||||||
local new = {}
|
|
||||||
for i = 1, 25 do
|
|
||||||
new[i] = completions[i]
|
|
||||||
end
|
|
||||||
new[#new + 1] = '...' -- Append truncation indicator
|
|
||||||
return new
|
|
||||||
end
|
|
||||||
|
|
||||||
return completions
|
|
||||||
end
|
|
||||||
|
|
||||||
local function format_completions(completions)
|
|
||||||
local formatted = { { '{', 'Normal' } }
|
|
||||||
for i = 1, #completions do
|
|
||||||
table.insert(formatted, { completions[i], i == 1 and 'CursorLineNr' or 'Normal' })
|
|
||||||
if i ~= #completions then
|
|
||||||
table.insert(formatted, { ', ', 'Normal' })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.insert(formatted, { '}', 'Normal' })
|
|
||||||
return formatted
|
|
||||||
end
|
|
||||||
|
|
||||||
local function input(prompt, default, completion)
|
|
||||||
vim.validate({
|
|
||||||
prompt = { prompt, 'table' },
|
|
||||||
default = { default, { 'string', 'nil' } },
|
|
||||||
completion = { completion, { 'string', 'nil' } },
|
|
||||||
})
|
|
||||||
local using_default = default ~= nil
|
|
||||||
local typed = default or ''
|
|
||||||
|
|
||||||
local completions = {}
|
|
||||||
|
|
||||||
local cursor = 0
|
|
||||||
|
|
||||||
while true do
|
|
||||||
if completion ~= nil then
|
|
||||||
completions = refresh_completions(typed, completion)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd('echo | redraw')
|
|
||||||
vim.api.nvim_echo({
|
|
||||||
unpack(prompt),
|
|
||||||
{ string.sub(typed, 0, cursor), using_default and 'Visual' or 'Normal' },
|
|
||||||
cursor == #typed and { '█', 'CursorLineNr' } or { string.sub(typed, cursor + 1, cursor + 1), 'Search' },
|
|
||||||
{ string.sub(typed, cursor + 2), 'Normal' },
|
|
||||||
unpack(#completions > 0 and format_completions(completions) or {}),
|
|
||||||
}, false, {})
|
|
||||||
local input = M.await_key()
|
|
||||||
|
|
||||||
if input == M.Keys.enter or input == M.Keys.escape then
|
|
||||||
vim.cmd('echo | redraw')
|
|
||||||
return input == M.Keys.enter, typed
|
|
||||||
elseif input == M.Keys.backspace then
|
|
||||||
if cursor <= 0 then
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
typed = string.sub(typed, 0, cursor - 1) .. string.sub(typed, cursor + 1)
|
|
||||||
cursor = cursor - 1
|
|
||||||
goto continue
|
|
||||||
elseif input.is_arrow then
|
|
||||||
if input == M.Keys.left then
|
|
||||||
if cursor > 0 then
|
|
||||||
cursor = cursor - 1
|
|
||||||
end
|
|
||||||
elseif input == M.Keys.right then
|
|
||||||
if cursor < #typed then
|
|
||||||
cursor = cursor + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- vim.api.nvim_win_set_cursor(0, { 1, 10 })
|
|
||||||
goto continue
|
|
||||||
elseif input == M.Keys.tab then
|
|
||||||
if #completions == 0 then
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
cursor = #typed
|
|
||||||
|
|
||||||
local insert = completions[1]
|
|
||||||
local offset = #typed
|
|
||||||
|
|
||||||
-- Find the largest overlapping slice
|
|
||||||
while offset > 0 and not vim.startswith(insert, string.sub(typed, -offset)) do
|
|
||||||
offset = offset - 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Replace `typed` with the completion
|
|
||||||
typed = string.sub(typed, 1, #typed - offset) .. insert .. ' '
|
|
||||||
cursor = #typed
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
|
|
||||||
typed = string.sub(typed, 0, cursor) .. input .. string.sub(typed, cursor + 1)
|
|
||||||
cursor = cursor + 1
|
|
||||||
|
|
||||||
::continue::
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Safe wrapper for hiding the cursor (also captures <C-c>)
|
|
||||||
function M.input(prompt, default, completion)
|
|
||||||
local hl = vim.api.nvim_get_hl(0, { name = 'Cursor' })
|
|
||||||
|
|
||||||
hl.blend = 100
|
|
||||||
vim.api.nvim_set_hl(0, 'Cursor', hl)
|
|
||||||
|
|
||||||
-- local result, success, typed = pcall(input, prompt, defaut, completion)
|
|
||||||
local success, typed = input(prompt, default, completion)
|
|
||||||
vim.cmd('echo | redraw')
|
|
||||||
|
|
||||||
hl.blend = 0
|
|
||||||
vim.api.nvim_set_hl(0, 'Cursor', hl)
|
|
||||||
|
|
||||||
return success, typed, not result
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param opts? table
|
|
||||||
---@param on_confirm function
|
|
||||||
vim.ui.input = function(opts, on_confirm)
|
|
||||||
vim.validate({
|
|
||||||
opts = { opts, 'table' },
|
|
||||||
on_confirm = { on_confirm, 'function' },
|
|
||||||
})
|
|
||||||
|
|
||||||
opts = opts or {}
|
|
||||||
on_confirm = on_confirm or function() end
|
|
||||||
|
|
||||||
vim.validate({
|
|
||||||
-- Also supports list of HlGroup tuples
|
|
||||||
prompt = { opts.prompt, { 'table', 'string', 'nil' } },
|
|
||||||
|
|
||||||
default = { opts.default, { 'string', 'nil' } },
|
|
||||||
completion = { opts.completion, { 'string', 'nil' } },
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
opts.highlight,
|
|
||||||
function(it)
|
|
||||||
return it == nil
|
|
||||||
end,
|
|
||||||
'nil (not supported)',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
local prompt = opts.prompt or { { 'Enter input > ', 'Question' } }
|
|
||||||
if type(prompt) == 'string' then
|
|
||||||
-- Strip invalid characters
|
|
||||||
prompt = vim.trim(prompt)
|
|
||||||
|
|
||||||
local is_alpha = function(char)
|
|
||||||
local num = vim.fn.char2nr(char)
|
|
||||||
return (num >= 65 and num <= 90) or (num >= 97 and num <= 122)
|
|
||||||
end
|
|
||||||
|
|
||||||
local last = string.sub(prompt, #prompt)
|
|
||||||
while not is_alpha(last) do
|
|
||||||
prompt = string.sub(prompt, 0, #prompt - 1)
|
|
||||||
prompt = vim.trim(prompt)
|
|
||||||
last = string.sub(prompt, #prompt)
|
|
||||||
end
|
|
||||||
|
|
||||||
prompt = { { prompt .. ' > ', 'Question' } }
|
|
||||||
end
|
|
||||||
|
|
||||||
local finished, typed, interrupted = M.input(prompt, opts.default, opts.completion)
|
|
||||||
if interrupted then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
on_confirm(finished and typed or nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- vim.ui.input({ completion = 'cmdline' }, function(a)
|
|
||||||
-- vim.print(a)
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- vim.keymap.set('n', ';', function()
|
|
||||||
-- vim.ui.input({ prompt = { { ':', 'Normal' } }, completion = 'cmdline' }, function(command)
|
|
||||||
-- vim.print(command)
|
|
||||||
-- if command then
|
|
||||||
-- vim.cmd(command)
|
|
||||||
-- end
|
|
||||||
-- end)
|
|
||||||
-- end)
|
|
||||||
-- add cmdheight to the input function
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,93 +1,87 @@
|
|||||||
local set = vim.keymap.set
|
--- Defaults to `{'n'}`
|
||||||
|
--- @alias Mode 'n'|'v'|'Q'|'t'|'i'|'c'
|
||||||
|
--- @alias Mapping string|fun(): nil
|
||||||
|
|
||||||
set('i', '<M-Up>', '<ESC>:move-2<CR>i')
|
--- @type table<string, { [string]: Mapping, modes: (Mode)[]? }>
|
||||||
set('i', '<M-Down>', '<ESC>:move+<CR>i')
|
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
|
||||||
|
|
||||||
set('n', '<C-Up>', '<C-u>zz')
|
local open_buf = vim.api.nvim_get_current_buf()
|
||||||
set('n', '<C-Down>', '<C-d>zz')
|
|
||||||
|
|
||||||
-- yank to clipboard with leader
|
if PreviousBuffer and open_buf == OpenTerminal then
|
||||||
set('n', '<leader>y', '"+y')
|
|
||||||
set('v', '<leader>y', '"+y')
|
|
||||||
|
|
||||||
set('n', 'Q', '<nop>')
|
|
||||||
|
|
||||||
-- terminal
|
|
||||||
-- set('n', '<leader>t', ':split<CR>:term<CR>')
|
|
||||||
OpenTerminal = nil
|
|
||||||
PreviousBuffer = -1
|
|
||||||
set('n', '<leader>t', function()
|
|
||||||
if vim.api.nvim_get_current_buf() == OpenTerminal and PreviousBuffer ~= -1 then
|
|
||||||
vim.api.nvim_set_current_buf(PreviousBuffer)
|
vim.api.nvim_set_current_buf(PreviousBuffer)
|
||||||
PreviousBuffer = -1
|
PreviousBuffer = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
PreviousBuffer = vim.api.nvim_get_current_buf()
|
PreviousBuffer = open_buf
|
||||||
if OpenTerminal ~= nil then
|
|
||||||
|
if OpenTerminal then
|
||||||
vim.api.nvim_set_current_buf(OpenTerminal)
|
vim.api.nvim_set_current_buf(OpenTerminal)
|
||||||
else
|
return
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd.term()
|
vim.cmd.term()
|
||||||
OpenTerminal = vim.api.nvim_get_current_buf()
|
OpenTerminal = vim.api.nvim_get_current_buf()
|
||||||
vim.api.nvim_create_autocmd({ 'BufDelete' }, {
|
vim.api.nvim_create_autocmd({ 'BufDelete' }, {
|
||||||
callback = function(args)
|
callback = function()
|
||||||
if args.buf == OpenTerminal then
|
|
||||||
OpenTerminal = nil
|
OpenTerminal = nil
|
||||||
end
|
|
||||||
end,
|
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)
|
|
||||||
set('t', '<ESC>', '<C-\\><C-n>')
|
|
||||||
|
|
||||||
-- nice additions
|
|
||||||
set('n', '<leader>er', function()
|
|
||||||
vim.diagnostic.open_float()
|
|
||||||
end)
|
|
||||||
set('n', '<leader>l', ':e#<CR>')
|
|
||||||
-- set('n', '<leader>ca', ':CodeActionMenu<CR>')
|
|
||||||
-- set('n', '<leader>cn', ':IncRename ')
|
|
||||||
|
|
||||||
set('n', '<leader>i', 'cc')
|
|
||||||
-- peek
|
|
||||||
set('n', '<leader>p', vim.lsp.buf.hover)
|
|
||||||
|
|
||||||
-- Scratch pad
|
|
||||||
set(
|
|
||||||
'n',
|
|
||||||
'<leader>s',
|
|
||||||
':bo vs<CR>:enew<CR>:setlocal noswapfile<CR>:setlocal bufhidden=hide<CR>:setlocal buftype=nofile<CR>:set filetype=markdown<CR>:set syntax=markdown<CR>'
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Help
|
|
||||||
-- vim.cmd.cnoreabbrev('h vert h')
|
|
||||||
-- set('n', '<leader>h', ':h <C-r><C-w><CR>')
|
|
||||||
|
|
||||||
-- Comp mode
|
|
||||||
set('n', '<leader>c<CR>', ':Compile<CR>')
|
|
||||||
set('n', '<leader>cs', ':CompileInterrupt<CR>')
|
|
||||||
|
|
||||||
set('n', '<leader>E', ':NextError<CR>')
|
|
||||||
|
|
||||||
-- Windows
|
|
||||||
set('n', '<M-q>', '<C-w>q')
|
|
||||||
set('n', '<M-left>', '<C-w><left>')
|
|
||||||
set('n', '<M-right>', '<C-w><right>')
|
|
||||||
set('n', '<M-up>', '<C-w><up>')
|
|
||||||
set('n', '<M-down>', '<C-w><down>')
|
|
||||||
|
|
||||||
set('n', '<M-S-right>', '<C-w>t<C-w>H')
|
|
||||||
|
|
||||||
Fullscreen = false
|
|
||||||
set('n', '<M-f>', function()
|
|
||||||
if Fullscreen then
|
|
||||||
print('full screen')
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-w>_<C-w>|', true, false, true), 'm', false)
|
|
||||||
else
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-w>=', true, false, true), 'm', false)
|
|
||||||
end
|
end
|
||||||
Fullscreen = not Fullscreen
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
-- Generic
|
|
||||||
set('n', '<leader>q', ':bd!<CR>')
|
|
||||||
|
|||||||
64
.config/nvim/lua/BluePlum/lazy.lua
Normal file
64
.config/nvim/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
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
if not vim.g.neovide then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.o.guifont = 'Jetbrains Mono:h17'
|
|
||||||
|
|
||||||
vim.g.neovide_underline_stroke_scale = 2.0
|
|
||||||
vim.g.neovide_theme = 'dark'
|
|
||||||
vim.g.neovide_refresh_rate_idle = 10
|
|
||||||
vim.g.neovide_transparency = 0.6
|
|
||||||
|
|
||||||
-- Scroll
|
|
||||||
vim.g.neovide_scroll_animation_length = 0.1
|
|
||||||
vim.g.neovide_scroll_animation_far_lines = 50
|
|
||||||
|
|
||||||
-- Cursor
|
|
||||||
vim.g.neovide_cursor_animation_length = 0.03
|
|
||||||
vim.g.neovide_cursor_trail_size = 0.5
|
|
||||||
vim.g.neovide_cursor_smooth_blink = true
|
|
||||||
vim.cmd.set('guicursor=i-v-c:blinkwait400-blinkoff350-blinkon250,i-ci-ve:ver25,r-cr:hor20,o:hor20')
|
|
||||||
|
|
||||||
-- Pasting
|
|
||||||
vim.keymap.set('i', '<SC-v>', '<C-r>+')
|
|
||||||
vim.keymap.set('n', '<SC-v>', '"+p')
|
|
||||||
@@ -1,64 +1,96 @@
|
|||||||
-- Tabs for indenting
|
local opts = {
|
||||||
vim.opt.autoindent = true
|
mapleader = ' ',
|
||||||
vim.g.noexpandtab = true
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
|
|
||||||
-- Line numbers
|
linenr = {
|
||||||
vim.opt.number = true
|
number = true,
|
||||||
vim.opt.relativenumber = true
|
relativenumber = true,
|
||||||
vim.opt.cursorline = true
|
|
||||||
vim.opt.cursorlineopt = 'number'
|
cursorline = true,
|
||||||
|
cursorlineopt = 'number',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Use tabs for indents
|
||||||
|
indent = {
|
||||||
|
autoindent = true,
|
||||||
|
noexpandtab = true,
|
||||||
|
tabstop = 4,
|
||||||
|
shiftwidth = 4,
|
||||||
|
},
|
||||||
|
|
||||||
|
terminal = {
|
||||||
|
termguicolors = true,
|
||||||
|
shell = '/bin/fish',
|
||||||
|
},
|
||||||
|
|
||||||
|
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
|
-- Folding
|
||||||
vim.opt.foldlevelstart = 99
|
-- vim.opt.foldlevelstart = 99
|
||||||
|
|
||||||
vim.g.mapleader = ' '
|
-- vim.g.mapleader = ' '
|
||||||
|
|
||||||
-- Terminal
|
-- Terminal
|
||||||
vim.g.termguicolors = true
|
-- vim.g.termguicolors = true
|
||||||
vim.opt.shell = '/bin/fish'
|
-- vim.opt.shell = '/bin/fish'
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
vim.lsp.inlay_hint.enable()
|
-- vim.lsp.inlay_hint.enable()
|
||||||
|
|
||||||
-- Splitting
|
-- Splitting
|
||||||
-- vim.cmd.set('splitbelow')
|
-- vim.opt.splitright = true
|
||||||
-- vim.cmd.set('splitright')
|
-- vim.opt.splitbelow = true
|
||||||
vim.opt.splitright = true
|
|
||||||
vim.opt.splitbelow = true
|
|
||||||
|
|
||||||
-- Make text readable
|
-- Make text readable
|
||||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
-- vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||||
pattern = { '*.md', '*.typ' },
|
-- pattern = { '*.md', '*.typ' },
|
||||||
command = 'setlocal linebreak',
|
-- command = 'setlocal linebreak',
|
||||||
})
|
-- })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
-- vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'help',
|
-- pattern = 'help',
|
||||||
command = 'setlocal linebreak',
|
-- command = 'setlocal linebreak',
|
||||||
})
|
-- })
|
||||||
|
|
||||||
vim.cmd.cnoreabbrev('grep', 'Grepper')
|
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
vim.opt.hlsearch = false
|
-- vim.opt.hlsearch = false
|
||||||
vim.opt.incsearch = true
|
-- vim.opt.incsearch = true
|
||||||
|
|
||||||
-- Make dotfile navigation bareble
|
|
||||||
vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {})
|
|
||||||
|
|
||||||
-- Git
|
|
||||||
vim.api.nvim_create_user_command('Glog', function()
|
|
||||||
local args = {
|
|
||||||
'log',
|
|
||||||
'--graph',
|
|
||||||
'--abbrev-commit',
|
|
||||||
'--decorate',
|
|
||||||
}
|
|
||||||
local str = ''
|
|
||||||
for _, arg in pairs(args) do
|
|
||||||
str = str .. ' ' .. arg
|
|
||||||
end
|
|
||||||
vim.cmd.Git(str)
|
|
||||||
end, {})
|
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
local required = { 'mason', 'mason-lspconfig', 'lspconfig', 'lsp-zero', 'cmp' }
|
|
||||||
local ready = true
|
|
||||||
|
|
||||||
vim.cmd.echohl('WarningMsg')
|
|
||||||
|
|
||||||
for _, module in ipairs(required) do
|
|
||||||
local ok, _ = pcall(require, module)
|
|
||||||
if not ok then
|
|
||||||
ready = false
|
|
||||||
vim.cmd.echo('"Module \'' .. module .. "' isn't present!\"")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not ready then
|
|
||||||
vim.cmd.echo('"LSP disabled!"')
|
|
||||||
vim.cmd.echohl('None')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd.echohl('None')
|
|
||||||
|
|
||||||
local zero = require('lsp-zero')
|
|
||||||
|
|
||||||
zero.preset('recommended')
|
|
||||||
require('mason').setup({})
|
|
||||||
|
|
||||||
local settings = {
|
|
||||||
['lua_ls'] = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
version = 'LuaJIT',
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = { vim.env.VIMRUNTIME },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('mason-lspconfig').setup({
|
|
||||||
ensure_installed = {
|
|
||||||
'lua_ls',
|
|
||||||
},
|
|
||||||
handlers = {
|
|
||||||
-- zero.default_setup,
|
|
||||||
function(name)
|
|
||||||
require('lspconfig')[name].setup({
|
|
||||||
settings = settings[name] or {},
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
zero.on_attach(function(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- #region CMP
|
|
||||||
|
|
||||||
local cmp_kind_icons = {
|
|
||||||
Text = '',
|
|
||||||
Method = '',
|
|
||||||
Function = '',
|
|
||||||
Constructor = '',
|
|
||||||
Field = '',
|
|
||||||
Variable = '',
|
|
||||||
Class = '',
|
|
||||||
Interface = '',
|
|
||||||
Module = '',
|
|
||||||
Property = '',
|
|
||||||
Unit = '',
|
|
||||||
Value = '',
|
|
||||||
Enum = '',
|
|
||||||
Keyword = '',
|
|
||||||
Snippet = '',
|
|
||||||
Color = '',
|
|
||||||
File = '',
|
|
||||||
Reference = '',
|
|
||||||
Folder = '',
|
|
||||||
EnumMember = '',
|
|
||||||
Constant = '',
|
|
||||||
Struct = '',
|
|
||||||
Event = '',
|
|
||||||
Operator = '',
|
|
||||||
TypeParameter = '',
|
|
||||||
}
|
|
||||||
|
|
||||||
local cmp = require('cmp')
|
|
||||||
cmp.setup({
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<Tab>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
}),
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
local luasnip = require('luasnip')
|
|
||||||
if not luasnip then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'calc' },
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = {
|
|
||||||
winhighlight = 'Normal:Pmeny,FloatBorder:Pmenu,Search:None',
|
|
||||||
col_offset = -3,
|
|
||||||
side_padding = 0,
|
|
||||||
},
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
fields = { 'kind', 'abbr', 'menu' },
|
|
||||||
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
|
|
||||||
local strings = vim.split(kind.kind, '%s', { trimempty = true })
|
|
||||||
kind.kind = ' ' .. (strings[1] or '') .. ' '
|
|
||||||
kind.menu = ' (' .. (strings[2] or '') .. ')'
|
|
||||||
|
|
||||||
return kind
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'buffer' },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' },
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' },
|
|
||||||
}),
|
|
||||||
matching = { disallow_symbol_nonprefix_matching = false },
|
|
||||||
})
|
|
||||||
|
|
||||||
-- #region Highlight groups
|
|
||||||
|
|
||||||
-- Customization for Pmenu
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'PmenuSel', { bg = '#282C34', fg = 'NONE' })
|
|
||||||
vim.api.nvim_set_hl(0, 'Pmenu', { fg = '#C5CDD9', bg = '#22252A' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { fg = '#7E8294', bg = 'NONE', strikethrough = true })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { fg = '#82AAFF', bg = 'NONE', bold = true })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { fg = '#82AAFF', bg = 'NONE', bold = true })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemMenu', { fg = '#C792EA', bg = 'NONE', italic = true })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindField', { fg = '#EED8DA', bg = '#B5585F' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { fg = '#EED8DA', bg = '#B5585F' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindEvent', { fg = '#EED8DA', bg = '#B5585F' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindText', { fg = '#C3E88D', bg = '#9FBD73' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { fg = '#C3E88D', bg = '#9FBD73' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { fg = '#C3E88D', bg = '#9FBD73' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { fg = '#FFE082', bg = '#D4BB6C' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { fg = '#FFE082', bg = '#D4BB6C' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindReference', { fg = '#FFE082', bg = '#D4BB6C' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindFunction', { fg = '#EADFF0', bg = '#A377BF' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindStruct', { fg = '#EADFF0', bg = '#A377BF' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindClass', { fg = '#EADFF0', bg = '#A377BF' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindModule', { fg = '#EADFF0', bg = '#A377BF' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindOperator', { fg = '#EADFF0', bg = '#A377BF' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { fg = '#C5CDD9', bg = '#7E8294' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindFile', { fg = '#C5CDD9', bg = '#7E8294' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindUnit', { fg = '#F5EBD9', bg = '#D4A959' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { fg = '#F5EBD9', bg = '#D4A959' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { fg = '#F5EBD9', bg = '#D4A959' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { fg = '#DDE5F5', bg = '#6C8ED4' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindValue', { fg = '#DDE5F5', bg = '#6C8ED4' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindEnumMember', { fg = '#DDE5F5', bg = '#6C8ED4' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindInterface', { fg = '#D8EEEB', bg = '#58B5A8' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindColor', { fg = '#D8EEEB', bg = '#58B5A8' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemKindTypeParameter', { fg = '#D8EEEB', bg = '#58B5A8' })
|
|
||||||
|
|
||||||
-- #endregion
|
|
||||||
|
|
||||||
-- #endregion
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
severity_sort = true,
|
|
||||||
})
|
|
||||||
@@ -1,42 +1,17 @@
|
|||||||
return {
|
return {
|
||||||
{
|
|
||||||
'smjonas/inc-rename.nvim',
|
|
||||||
keys = { {
|
|
||||||
'<leader>cn',
|
|
||||||
':IncRename ',
|
|
||||||
} },
|
|
||||||
config = function()
|
|
||||||
require('inc_rename').setup({})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'aznhe21/actions-preview.nvim',
|
|
||||||
keys = { {
|
|
||||||
'<leader>ca',
|
|
||||||
function()
|
|
||||||
require('actions-preview').code_actions()
|
|
||||||
end,
|
|
||||||
} },
|
|
||||||
opts = {},
|
|
||||||
-- config = function()
|
|
||||||
-- require('actions-preview').setup({})
|
|
||||||
-- vim.keymap.set('n', '<leader>ca', require('actions-preview').code_actions)
|
|
||||||
-- end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'vyfor/cord.nvim',
|
'vyfor/cord.nvim',
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
branch = 'client-server',
|
|
||||||
build = ':Cord update',
|
build = ':Cord update',
|
||||||
opts = {},
|
opts = {},
|
||||||
|
cond = vim.env.CORDLESS ~= 'true',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'tpope/vim-fugitive',
|
'tpope/vim-fugitive',
|
||||||
cmd = { 'Git' },
|
cmd = { 'Git' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'mhinz/vim-grepper',
|
dir = '~/dev/share.nvim/',
|
||||||
cmd = { 'GrepperRg' },
|
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,32 @@
|
|||||||
|
local common = require('BluePlum.lazy')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{ 'nvim-tree/nvim-web-devicons' },
|
{ common.icons, opts = {} },
|
||||||
{ 'stevearc/dressing.nvim', opts = {} },
|
|
||||||
{
|
{
|
||||||
'folke/todo-comments.nvim',
|
'folke/todo-comments.nvim',
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
config = function()
|
opts = {},
|
||||||
require('todo-comments').setup()
|
event = common.event.BufWinEnter,
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{ 'norcalli/nvim-colorizer.lua', opts = {} },
|
|
||||||
{
|
{
|
||||||
'OXY2DEV/markview.nvim',
|
'OXY2DEV/markview.nvim',
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' },
|
dependencies = { 'nvim-treesitter/nvim-treesitter', common.icons },
|
||||||
ft = 'markdown',
|
ft = 'markdown',
|
||||||
config = function()
|
opts = {
|
||||||
require('markview')
|
preview = {
|
||||||
vim.api.nvim_set_hl(0, 'MarkviewLayer', { fg = '#2a2a2a', bg = '#373737' })
|
icon_provider = 'mini',
|
||||||
end,
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'sphamba/smear-cursor.nvim',
|
'sphamba/smear-cursor.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
time_interval = 10,
|
time_interval = 17,
|
||||||
|
anticipation = 0,
|
||||||
|
damping = 0.8,
|
||||||
|
|
||||||
|
cursor_color = '#b7bcb9',
|
||||||
legacy_computing_symbols_support = true,
|
legacy_computing_symbols_support = true,
|
||||||
cursor_color = '#fcdc34',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
'ej-shafran/compile-mode.nvim',
|
|
||||||
enabled = false,
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'm00qek/baleia.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeInfo', { link = 'DiagnosticInfo' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeWarning', { link = 'DiagnosticWarning' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeError', { link = 'DiagnosticError' })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeCommandOutput', { link = 'Statement' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeMessage', { link = 'SpellCap' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeMessageRow', { link = 'CursorLineNr' })
|
|
||||||
vim.api.nvim_set_hl(0, 'CompileModeMessageCol', { link = 'CursorLineNr' })
|
|
||||||
|
|
||||||
vim.g.compile_mode = {
|
|
||||||
baleia_setup = true,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- {
|
|
||||||
-- dir = '~/dev/s-ido',
|
|
||||||
-- name = 's-ido',
|
|
||||||
-- lazy = false,
|
|
||||||
-- dev = true,
|
|
||||||
-- opts = {},
|
|
||||||
-- keys = {
|
|
||||||
-- {
|
|
||||||
-- '<Tab>',
|
|
||||||
-- function()
|
|
||||||
-- require('s-ido.commandline').complete()
|
|
||||||
-- end,
|
|
||||||
-- mode = 'c',
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- dir = '~/dev/s-nav',
|
|
||||||
-- name = 's-nav',
|
|
||||||
-- lazy = false,
|
|
||||||
-- dev = true,
|
|
||||||
-- opts = {},
|
|
||||||
-- },
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
'kevinhwang91/nvim-ufo',
|
|
||||||
dependencies = {
|
|
||||||
{
|
|
||||||
'kevinhwang91/promise-async',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
enabled = false,
|
|
||||||
config = function()
|
|
||||||
-- Implement custom marker provider.
|
|
||||||
local CustomMarkerProvider = {}
|
|
||||||
|
|
||||||
function CustomMarkerProvider.getFolds(bufnr)
|
|
||||||
local buf = require('ufo.bufmanager'):get(bufnr)
|
|
||||||
if not buf then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local openRegex = '#region'
|
|
||||||
local closeRegex = '#endregion'
|
|
||||||
|
|
||||||
local summaryRegx = openRegex .. '%s*(.*)'
|
|
||||||
|
|
||||||
local ranges = {}
|
|
||||||
local stack = {}
|
|
||||||
local lines = buf:lines(1, -1)
|
|
||||||
|
|
||||||
for lnum, line in ipairs(lines) do
|
|
||||||
-- Check for start marker
|
|
||||||
if line:match(openRegex) then
|
|
||||||
table.insert(stack, lnum)
|
|
||||||
-- Check for end marker
|
|
||||||
elseif line:match(closeRegex) then
|
|
||||||
local startLnum = table.remove(stack)
|
|
||||||
if startLnum then
|
|
||||||
local summary = lines[startLnum]:match(summaryRegx)
|
|
||||||
table.insert(ranges, require('ufo.model.foldingrange').new(startLnum - 1, lnum - 1, summary))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return ranges
|
|
||||||
end
|
|
||||||
|
|
||||||
local function customizeSelector(bufnr)
|
|
||||||
local ranges = CustomMarkerProvider.getFolds(bufnr)
|
|
||||||
local maybe_additional_ranges = require('ufo').getFolds(bufnr, 'treesitter')
|
|
||||||
if next(maybe_additional_ranges) ~= nil then
|
|
||||||
ranges = vim.list_extend(ranges, maybe_additional_ranges)
|
|
||||||
else
|
|
||||||
ranges = vim.list_extend(ranges, require('ufo').getFolds(bufnr, 'indent'))
|
|
||||||
end
|
|
||||||
return ranges
|
|
||||||
end
|
|
||||||
|
|
||||||
require('ufo').setup({
|
|
||||||
provider_selector = function(bufnr, filetype, buftype)
|
|
||||||
return customizeSelector
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user