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
|
||||
gopls
|
||||
lua-language-server
|
||||
nil
|
||||
nixd
|
||||
basedpyright
|
||||
|
||||
#other
|
||||
jujutsu
|
||||
];
|
||||
in
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ if not LAZY_OPTS then
|
|||
},
|
||||
}
|
||||
end
|
||||
vim.cmd('packadd cfilter')
|
||||
vim.cmd('colorscheme iofq')
|
||||
require('lazy').setup(LAZY_OPTS)
|
||||
require('config')
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ return {
|
|||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
codeLens = {
|
||||
enable = true,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
arrayIndex = 'Enable',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
vim.opt.autowrite = true
|
||||
vim.opt.backspace = 'indent,eol,start'
|
||||
vim.opt.confirm = true
|
||||
vim.opt.completeopt = "menuone,popup,noselect,fuzzy"
|
||||
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
||||
vim.opt.expandtab = true -- insert tabs as spaces
|
||||
vim.opt.inccommand = 'split' -- incremental live completion
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ M.setup = function()
|
|||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>fs', function()
|
||||
require('plugins.lib.session_jj').load()
|
||||
M.load()
|
||||
end, { noremap = true, desc = 'mini session select' })
|
||||
end
|
||||
|
||||
|
|
@ -50,7 +50,6 @@ M.load = function()
|
|||
if id == '' then
|
||||
return
|
||||
end
|
||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
||||
if M.check_exists(id) then
|
||||
vim.ui.select({
|
||||
'Yes',
|
||||
|
|
@ -58,6 +57,7 @@ M.load = function()
|
|||
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
||||
if c == 'Yes' then
|
||||
-- load session (buffers, etc) as well as shada (marks)
|
||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
||||
MiniSessions.read(id)
|
||||
vim.notify('loaded jj session: ' .. id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ function M.status()
|
|||
local files = {}
|
||||
|
||||
for status in status_raw:gmatch('[^\r\n]+') do
|
||||
local state, text = string.match(status, '^(%a)%s(.+)$')
|
||||
|
||||
if state and text then
|
||||
local file = text
|
||||
local state, file = string.match(status, '^(%a)%s(.+)$')
|
||||
|
||||
if state and file then
|
||||
local hl = ''
|
||||
if state == 'A' then
|
||||
hl = 'SnacksPickerGitStatusAdded'
|
||||
|
|
@ -20,15 +18,13 @@ function M.status()
|
|||
hl = 'SnacksPickerGitStatusDeleted'
|
||||
elseif state == 'R' then
|
||||
hl = 'SnacksPickerGitStatusRenamed'
|
||||
file = string.match(text, '{.-=>%s*(.-)}')
|
||||
file = string.match(file, '{.-=>%s*(.-)}')
|
||||
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, {
|
||||
text = text,
|
||||
file = file,
|
||||
filename_hl = hl,
|
||||
state = state,
|
||||
diff = diff,
|
||||
})
|
||||
end
|
||||
|
|
@ -37,11 +33,9 @@ function M.status()
|
|||
return files
|
||||
end
|
||||
|
||||
local files = get_files()
|
||||
|
||||
Snacks.picker.pick {
|
||||
source = 'jj_status',
|
||||
items = files,
|
||||
items = get_files(),
|
||||
format = 'file',
|
||||
title = 'jj status',
|
||||
preview = function(ctx)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ return {
|
|||
event = 'VeryLazy',
|
||||
config = function()
|
||||
vim.lsp.enable {
|
||||
'nil_ls',
|
||||
'nixd',
|
||||
'phpactor',
|
||||
'gopls',
|
||||
'lua_ls',
|
||||
|
|
@ -34,27 +34,18 @@ return {
|
|||
vim.diagnostic.setqflist()
|
||||
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
|
||||
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' }, {
|
||||
group = vim.api.nvim_create_augroup(string.format('lsp-%s-%s', ev.buf, client.id), {}),
|
||||
callback = function()
|
||||
vim.lsp.codelens.refresh { bufnr = ev.buf }
|
||||
end,
|
||||
buffer = ev.buf,
|
||||
})
|
||||
vim.lsp.codelens.refresh()
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_exec_autocmds('FileType', {})
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
|
@ -65,7 +56,7 @@ return {
|
|||
'\\f',
|
||||
function()
|
||||
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,
|
||||
mode = { 'n', 'x' },
|
||||
desc = 'toggle buffer formatting',
|
||||
|
|
@ -74,7 +65,7 @@ return {
|
|||
'\\F',
|
||||
function()
|
||||
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,
|
||||
mode = { 'n', 'x' },
|
||||
desc = 'toggle global formatting',
|
||||
|
|
@ -97,10 +88,6 @@ return {
|
|||
end
|
||||
return { timeout_ms = 1500, lsp_format = 'fallback' }
|
||||
end,
|
||||
default_format_opts = {
|
||||
timeout_ms = 1500,
|
||||
lsp_format = 'fallback',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ return {
|
|||
|
||||
local diff = require('mini.diff')
|
||||
diff.setup {
|
||||
options = { wrap_goto = true },
|
||||
source = {
|
||||
require('plugins.lib.minidiff_jj').gen_source(),
|
||||
diff.gen_source.git(),
|
||||
|
|
@ -109,7 +108,6 @@ return {
|
|||
},
|
||||
windows = {
|
||||
preview = true,
|
||||
width_focus = 30,
|
||||
width_preview = 50,
|
||||
},
|
||||
}
|
||||
|
|
@ -120,12 +118,8 @@ return {
|
|||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'MiniFilesBufferCreate',
|
||||
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()
|
||||
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)
|
||||
if cur_directory ~= '' then
|
||||
vim.fn.chdir(cur_directory)
|
||||
|
|
|
|||
|
|
@ -68,14 +68,6 @@ return {
|
|||
mode = { 'n', 't' },
|
||||
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>',
|
||||
function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue