mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 00:45:17 -06:00
random cleanups
This commit is contained in:
parent
095e78128b
commit
27ce531531
9 changed files with 14 additions and 53 deletions
|
|
@ -40,11 +40,8 @@ let
|
||||||
# LSPs
|
# LSPs
|
||||||
gopls
|
gopls
|
||||||
lua-language-server
|
lua-language-server
|
||||||
nil
|
nixd
|
||||||
basedpyright
|
basedpyright
|
||||||
|
|
||||||
#other
|
|
||||||
jujutsu
|
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ if not LAZY_OPTS then
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.cmd('packadd cfilter')
|
|
||||||
vim.cmd('colorscheme iofq')
|
vim.cmd('colorscheme iofq')
|
||||||
require('lazy').setup(LAZY_OPTS)
|
require('lazy').setup(LAZY_OPTS)
|
||||||
require('config')
|
require('config')
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,6 @@ return {
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
codeLens = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
hint = {
|
hint = {
|
||||||
enable = true,
|
enable = true,
|
||||||
arrayIndex = 'Enable',
|
arrayIndex = 'Enable',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
vim.opt.autowrite = true
|
vim.opt.autowrite = true
|
||||||
vim.opt.backspace = 'indent,eol,start'
|
vim.opt.backspace = 'indent,eol,start'
|
||||||
vim.opt.confirm = true
|
vim.opt.confirm = true
|
||||||
|
vim.opt.completeopt = "menuone,popup,noselect,fuzzy"
|
||||||
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
||||||
vim.opt.expandtab = true -- insert tabs as spaces
|
vim.opt.expandtab = true -- insert tabs as spaces
|
||||||
vim.opt.inccommand = 'split' -- incremental live completion
|
vim.opt.inccommand = 'split' -- incremental live completion
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ M.setup = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>fs', function()
|
vim.keymap.set('n', '<leader>fs', function()
|
||||||
require('plugins.lib.session_jj').load()
|
M.load()
|
||||||
end, { noremap = true, desc = 'mini session select' })
|
end, { noremap = true, desc = 'mini session select' })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -50,7 +50,6 @@ M.load = function()
|
||||||
if id == '' then
|
if id == '' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
|
||||||
if M.check_exists(id) then
|
if M.check_exists(id) then
|
||||||
vim.ui.select({
|
vim.ui.select({
|
||||||
'Yes',
|
'Yes',
|
||||||
|
|
@ -58,6 +57,7 @@ M.load = function()
|
||||||
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
||||||
if c == 'Yes' then
|
if c == 'Yes' then
|
||||||
-- load session (buffers, etc) as well as shada (marks)
|
-- load session (buffers, etc) as well as shada (marks)
|
||||||
|
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
||||||
MiniSessions.read(id)
|
MiniSessions.read(id)
|
||||||
vim.notify('loaded jj session: ' .. id)
|
vim.notify('loaded jj session: ' .. id)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,9 @@ function M.status()
|
||||||
local files = {}
|
local files = {}
|
||||||
|
|
||||||
for status in status_raw:gmatch('[^\r\n]+') do
|
for status in status_raw:gmatch('[^\r\n]+') do
|
||||||
local state, text = string.match(status, '^(%a)%s(.+)$')
|
local state, file = string.match(status, '^(%a)%s(.+)$')
|
||||||
|
|
||||||
if state and text then
|
|
||||||
local file = text
|
|
||||||
|
|
||||||
|
if state and file then
|
||||||
local hl = ''
|
local hl = ''
|
||||||
if state == 'A' then
|
if state == 'A' then
|
||||||
hl = 'SnacksPickerGitStatusAdded'
|
hl = 'SnacksPickerGitStatusAdded'
|
||||||
|
|
@ -20,15 +18,13 @@ function M.status()
|
||||||
hl = 'SnacksPickerGitStatusDeleted'
|
hl = 'SnacksPickerGitStatusDeleted'
|
||||||
elseif state == 'R' then
|
elseif state == 'R' then
|
||||||
hl = 'SnacksPickerGitStatusRenamed'
|
hl = 'SnacksPickerGitStatusRenamed'
|
||||||
file = string.match(text, '{.-=>%s*(.-)}')
|
file = string.match(file, '{.-=>%s*(.-)}')
|
||||||
end
|
end
|
||||||
|
|
||||||
local diff = vim.fn.system('jj diff ' .. file .. ' --ignore-working-copy --no-pager --stat --git')
|
local diff = vim.fn.system('jj diff ' .. file .. ' --no-pager --stat --git')
|
||||||
table.insert(files, {
|
table.insert(files, {
|
||||||
text = text,
|
|
||||||
file = file,
|
file = file,
|
||||||
filename_hl = hl,
|
filename_hl = hl,
|
||||||
state = state,
|
|
||||||
diff = diff,
|
diff = diff,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
@ -37,11 +33,9 @@ function M.status()
|
||||||
return files
|
return files
|
||||||
end
|
end
|
||||||
|
|
||||||
local files = get_files()
|
|
||||||
|
|
||||||
Snacks.picker.pick {
|
Snacks.picker.pick {
|
||||||
source = 'jj_status',
|
source = 'jj_status',
|
||||||
items = files,
|
items = get_files(),
|
||||||
format = 'file',
|
format = 'file',
|
||||||
title = 'jj status',
|
title = 'jj status',
|
||||||
preview = function(ctx)
|
preview = function(ctx)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ return {
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
config = function()
|
config = function()
|
||||||
vim.lsp.enable {
|
vim.lsp.enable {
|
||||||
'nil_ls',
|
'nixd',
|
||||||
'phpactor',
|
'phpactor',
|
||||||
'gopls',
|
'gopls',
|
||||||
'lua_ls',
|
'lua_ls',
|
||||||
|
|
@ -34,27 +34,18 @@ return {
|
||||||
vim.diagnostic.setqflist()
|
vim.diagnostic.setqflist()
|
||||||
end, { buffer = ev.buf, desc = 'LSP diagnostics' })
|
end, { buffer = ev.buf, desc = 'LSP diagnostics' })
|
||||||
|
|
||||||
vim.keymap.set('n', 'grc', function()
|
|
||||||
vim.lsp.buf.incoming_calls()
|
|
||||||
end, { buffer = ev.buf, desc = 'LSP incoming_calls' })
|
|
||||||
vim.keymap.set('n', 'gro', function()
|
|
||||||
vim.lsp.buf.outgoing_calls()
|
|
||||||
end, { buffer = ev.buf, desc = 'LSP outgoing_calls' })
|
|
||||||
|
|
||||||
-- Auto-refresh code lenses
|
-- Auto-refresh code lenses
|
||||||
if client:supports_method('textDocument/codeLens') or client.server_capabilities.codeLensProvider then
|
if client:supports_method('textDocument/codeLens') or client.server_capabilities.codeLensProvider then
|
||||||
|
vim.lsp.codelens.refresh { bufnr = ev.buf }
|
||||||
vim.api.nvim_create_autocmd({ 'InsertLeave', 'TextChanged' }, {
|
vim.api.nvim_create_autocmd({ 'InsertLeave', 'TextChanged' }, {
|
||||||
group = vim.api.nvim_create_augroup(string.format('lsp-%s-%s', ev.buf, client.id), {}),
|
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.codelens.refresh { bufnr = ev.buf }
|
vim.lsp.codelens.refresh { bufnr = ev.buf }
|
||||||
end,
|
end,
|
||||||
buffer = ev.buf,
|
buffer = ev.buf,
|
||||||
})
|
})
|
||||||
vim.lsp.codelens.refresh()
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.api.nvim_exec_autocmds('FileType', {})
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +56,7 @@ return {
|
||||||
'\\f',
|
'\\f',
|
||||||
function()
|
function()
|
||||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||||
Snacks.notify(string.format('Buffer formatting disabled: %s', vim.b.disable_autoformat))
|
vim.notify(string.format('Buffer formatting disabled: %s', vim.b.disable_autoformat))
|
||||||
end,
|
end,
|
||||||
mode = { 'n', 'x' },
|
mode = { 'n', 'x' },
|
||||||
desc = 'toggle buffer formatting',
|
desc = 'toggle buffer formatting',
|
||||||
|
|
@ -74,7 +65,7 @@ return {
|
||||||
'\\F',
|
'\\F',
|
||||||
function()
|
function()
|
||||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||||
Snacks.notify(string.format('Global formatting disabled: %s', vim.g.disable_autoformat))
|
vim.notify(string.format('Global formatting disabled: %s', vim.g.disable_autoformat))
|
||||||
end,
|
end,
|
||||||
mode = { 'n', 'x' },
|
mode = { 'n', 'x' },
|
||||||
desc = 'toggle global formatting',
|
desc = 'toggle global formatting',
|
||||||
|
|
@ -97,10 +88,6 @@ return {
|
||||||
end
|
end
|
||||||
return { timeout_ms = 1500, lsp_format = 'fallback' }
|
return { timeout_ms = 1500, lsp_format = 'fallback' }
|
||||||
end,
|
end,
|
||||||
default_format_opts = {
|
|
||||||
timeout_ms = 1500,
|
|
||||||
lsp_format = 'fallback',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ return {
|
||||||
|
|
||||||
local diff = require('mini.diff')
|
local diff = require('mini.diff')
|
||||||
diff.setup {
|
diff.setup {
|
||||||
options = { wrap_goto = true },
|
|
||||||
source = {
|
source = {
|
||||||
require('plugins.lib.minidiff_jj').gen_source(),
|
require('plugins.lib.minidiff_jj').gen_source(),
|
||||||
diff.gen_source.git(),
|
diff.gen_source.git(),
|
||||||
|
|
@ -109,7 +108,6 @@ return {
|
||||||
},
|
},
|
||||||
windows = {
|
windows = {
|
||||||
preview = true,
|
preview = true,
|
||||||
width_focus = 30,
|
|
||||||
width_preview = 50,
|
width_preview = 50,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -120,12 +118,8 @@ return {
|
||||||
vim.api.nvim_create_autocmd('User', {
|
vim.api.nvim_create_autocmd('User', {
|
||||||
pattern = 'MiniFilesBufferCreate',
|
pattern = 'MiniFilesBufferCreate',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
vim.keymap.set('n', '<leader>nc', function()
|
|
||||||
files.synchronize()
|
|
||||||
files.close()
|
|
||||||
end, { buffer = args.data.buf_id })
|
|
||||||
vim.keymap.set('n', '`', function()
|
vim.keymap.set('n', '`', function()
|
||||||
local cur_entry_path = MiniFiles.get_fs_entry().path
|
local _, cur_entry_path = pcall(MiniFiles.get_fs_entry().path)
|
||||||
local cur_directory = vim.fs.dirname(cur_entry_path)
|
local cur_directory = vim.fs.dirname(cur_entry_path)
|
||||||
if cur_directory ~= '' then
|
if cur_directory ~= '' then
|
||||||
vim.fn.chdir(cur_directory)
|
vim.fn.chdir(cur_directory)
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,6 @@ return {
|
||||||
mode = { 'n', 't' },
|
mode = { 'n', 't' },
|
||||||
desc = 'terminal open',
|
desc = 'terminal open',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'<C-/>',
|
|
||||||
function()
|
|
||||||
Snacks.terminal.toggle('command -v fish >/dev/null && exec fish || exec bash')
|
|
||||||
end,
|
|
||||||
mode = { 'n', 't' },
|
|
||||||
desc = 'terminal open',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'<leader><leader>',
|
'<leader><leader>',
|
||||||
function()
|
function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue