few bugfixes, mini.files

This commit is contained in:
iofq 2024-08-21 02:35:12 -05:00
parent 4ceceff9bf
commit 14fec02d63
9 changed files with 149 additions and 162 deletions

View file

@ -105,22 +105,26 @@ with lib;
# and prepends the nvim and after directory to the RTP # and prepends the nvim and after directory to the RTP
initLua = '' initLua = ''
vim.opt.rtp:prepend('${nvimRtp}/lua') vim.opt.rtp:prepend('${nvimRtp}/lua')
lazy_opts = { LAZY_OPTS = {
performance = { performance = {
reset_packpath = false, reset_packpath = false,
rtp = { reset = false, }, rtp = {
reset = false,
disabled_plugins = {
"netrwPlugin",
"tutor",
},
},
}, },
dev = { dev = {
path = "${pkgs.neovimUtils.packDir neovimConfig.packpathDirs}/pack/myNeovimPackages/start", path = "${pkgs.neovimUtils.packDir neovimConfig.packpathDirs}/pack/myNeovimPackages/start",
patterns = {""}, patterns = {""},
}, },
checker = {
enabled = false,
},
install = { missing = false, }, install = { missing = false, },
spec = {{ import = "plugins" }}, spec = {{ import = "plugins" }},
disabled_plugins = {
"netrwPlugin",
"tutor",
"zipPlugin",
},
} }
'' + (builtins.readFile ../nvim/init.lua); '' + (builtins.readFile ../nvim/init.lua);

View file

@ -43,6 +43,7 @@ with final.pkgs.lib; let
nvim-lspconfig nvim-lspconfig
nvim-neoclip-lua nvim-neoclip-lua
nvim-nio nvim-nio
nvim-autopairs
nvim-treesitter-context nvim-treesitter-context
nvim-treesitter-textobjects nvim-treesitter-textobjects
(nvim-treesitter.withPlugins(p: with p; [ (nvim-treesitter.withPlugins(p: with p; [
@ -72,8 +73,6 @@ with final.pkgs.lib; let
tree-sitter-typescript tree-sitter-typescript
tree-sitter-yaml tree-sitter-yaml
])) ]))
nvim-web-devicons
oil-nvim
outline-nvim outline-nvim
scope-nvim scope-nvim
snipe-nvim snipe-nvim

View file

@ -1,6 +1,6 @@
vim.g.mapleader = ' ' vim.g.mapleader = ' '
-- If lazy_opts is set, we're running in wrapped neovim via nix -- If lazy_opts is set, we're running in wrapped neovim via nix
if not lazy_opts then if not LAZY_OPTS then
-- Bootstrapping lazy.nvim -- Bootstrapping lazy.nvim
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
@ -14,14 +14,19 @@ if not lazy_opts then
} }
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
lazy_opts = { LAZY_OPTS = {
spec = { { import = 'plugins' } }, spec = { { import = 'plugins' } },
disabled_plugins = { performance = {
'netrwPlugin', reset_packpath = false,
'tutor', rtp = {
'zipPlugin', reset = false,
disabled_plugins = {
"netrwPlugin",
"tutor",
},
},
}, },
} }
end end
require('lazy').setup(lazy_opts) require('lazy').setup(LAZY_OPTS)
require('config') require('config')

View file

@ -10,7 +10,7 @@ vim.opt.relativenumber = true
vim.opt.shadafile = 'NONE' -- disable shada vim.opt.shadafile = 'NONE' -- disable shada
vim.opt.shiftwidth = 0 -- >> shifts by tabstop vim.opt.shiftwidth = 0 -- >> shifts by tabstop
vim.opt.showmatch = true -- highlight matching brackets vim.opt.showmatch = true -- highlight matching brackets
vim.opt.showmode = true vim.opt.showmode = false
vim.opt.signcolumn = 'no' vim.opt.signcolumn = 'no'
vim.opt.spell = false vim.opt.spell = false
vim.opt.softtabstop = -1 -- backspace removes tabstop vim.opt.softtabstop = -1 -- backspace removes tabstop
@ -84,7 +84,10 @@ vim.diagnostic.config {
-- random keymaps -- random keymaps
vim.keymap.set('n', 'gq', vim.cmd.bdelete, { silent = true }) vim.keymap.set('n', 'gq', vim.cmd.bdelete, { silent = true })
vim.keymap.set('n', 'gr', 'gT', { noremap = true, silent = true }) vim.keymap.set('n', 'gt', vim.cmd.bnext, { silent = true })
vim.keymap.set('n', 'gr', vim.cmd.bprev, { silent = true })
vim.keymap.set('n', 'tr', 'gT', { noremap = true, silent = true })
vim.keymap.set('n', 'tt', 'gt', { noremap = true, silent = true })
vim.keymap.set('n', 'n', 'nzz', { noremap = true, silent = true }) vim.keymap.set('n', 'n', 'nzz', { noremap = true, silent = true })
vim.keymap.set('n', 'N', 'Nzz', { noremap = true, silent = true }) vim.keymap.set('n', 'N', 'Nzz', { noremap = true, silent = true })
vim.keymap.set({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true }) vim.keymap.set({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true })

View file

@ -28,7 +28,7 @@ return {
}, },
{ {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
event = 'VeryLazy', lazy = false,
dependencies = { dependencies = {
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
}, },
@ -39,7 +39,7 @@ return {
lspconfig.util.default_config.capabilities, lspconfig.util.default_config.capabilities,
require('cmp_nvim_lsp').default_capabilities() require('cmp_nvim_lsp').default_capabilities()
) )
vim.lsp.inlay_hint.enable(true)
lspconfig.gopls.setup { lspconfig.gopls.setup {
settings = { settings = {
gopls = { gopls = {
@ -91,15 +91,12 @@ return {
Lua = {}, Lua = {},
}, },
} }
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Prev diagnostic' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Next diagnostic' })
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}), group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev) callback = function(ev)
local bufnr = ev.buf local bufnr = ev.buf
local client = vim.lsp.get_client_by_id(ev.data.client_id) local client = vim.lsp.get_client_by_id(ev.data.client_id)
require('workspace-diagnostics').populate_workspace_diagnostics(client, bufnr)
vim.keymap.set( vim.keymap.set(
'n', 'n',
'K', 'K',
@ -175,6 +172,7 @@ return {
}) })
vim.lsp.codelens.refresh { bufnr = bufnr } vim.lsp.codelens.refresh { bufnr = bufnr }
end end
require('workspace-diagnostics').populate_workspace_diagnostics(client, bufnr)
end, end,
}) })
vim.api.nvim_exec_autocmds('FileType', {}) vim.api.nvim_exec_autocmds('FileType', {})

View file

@ -3,9 +3,10 @@ return {
'echasnovski/mini.nvim', 'echasnovski/mini.nvim',
lazy = false, lazy = false,
config = function() config = function()
require('mini.ai').setup() require('mini.tabline').setup({
require('mini.comment').setup() tabpage_section = 'right',
require('mini.pairs').setup() show_icons = false,
})
require('mini.statusline').setup { require('mini.statusline').setup {
content = { content = {
active = function() active = function()
@ -50,103 +51,103 @@ return {
end, end,
}, },
} }
vim.opt.showmode = false vim.schedule(function()
require('mini.ai').setup()
require('mini.align').setup()
require('mini.bracketed').setup()
require('mini.comment').setup()
require('mini.icons').setup()
require('mini.surround').setup()
require('mini.jump2d').setup { mappings = { start_jumping = '<leader>S' } }
require('mini.splitjoin').setup { detect = { separator = '[,;\n]' }, }
require('mini.basics').setup { mappings = { windows = true, }, }
require('mini.trailspace').setup()
vim.api.nvim_create_user_command('Trim', function()
require('mini.trailspace').trim()
end, {})
local indent = require('mini.indentscope')
indent.setup {
draw = { delay = 0 },
}
indent.gen_animation.none()
local miniclue = require('mini.clue') local miniclue = require('mini.clue')
miniclue.setup { miniclue.setup {
triggers = { triggers = {
{ mode = 'n', keys = '<Leader>' }, { mode = 'n', keys = '<Leader>' },
{ mode = 'n', keys = 'g' }, { mode = 'n', keys = 'g' },
{ mode = 'n', keys = "'" }, { mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' }, { mode = 'n', keys = '`' },
{ mode = 'n', keys = '"' }, { mode = 'n', keys = '"' },
{ mode = 'n', keys = '<C-w>' }, { mode = 'n', keys = '<C-w>' },
{ mode = 'n', keys = 'z' }, { mode = 'n', keys = 'z' },
},
clues = {
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
},
}
-- Add surrounding with sa
-- Delete surrounding with sd.
-- Replace surrounding with sr.
-- Find surrounding with sf or sF (move cursor right or left).
-- Highlight surrounding with sh<char>.
-- 'f' - function call (string of alphanumeric symbols or '_' or '.' followed by balanced '()'). In "input" finds function call, in "output" prompts user to enter function name.
-- 't' - tag. In "input" finds tag with same identifier, in "output" prompts user to enter tag name.
-- All symbols in brackets '()', '[]', '{}', '<>".
-- '?' - interactive. Prompts user to enter left and right parts.
require('mini.surround').setup()
require('mini.trailspace').setup()
vim.api.nvim_create_user_command('Trim', function()
require('mini.trailspace').trim()
end, {})
-- prefix \
-- `b` - |'background'|.
-- `c` - |'cursorline'|.
-- `C` - |'cursorcolumn'|.
-- `d` - diagnostic (via |vim.diagnostic.enable()| and |vim.diagnostic.disable()|).
-- `h` - |'hlsearch'| (or |v:hlsearch| to be precise).
-- `i` - |'ignorecase'|.
-- `l` - |'list'|.
-- `n` - |'number'|.
-- `r` - |'relativenumber'|.
-- `s` - |'spell'|.
-- `w` - |'wrap'|.
require('mini.basics').setup {
mappings = {
windows = true,
},
}
local map = require('mini.map')
map.setup {
symbols = {
scroll_line = '',
scroll_view = '',
},
integrations = {
map.gen_integration.builtin_search(),
map.gen_integration.diagnostic(),
map.gen_integration.gitsigns(),
},
window = {
show_integration_count = false,
winblend = 0,
width = 5,
},
}
vim.keymap.set('n', '<leader>nm', map.toggle, { noremap = true, desc = 'minimap open' })
-- gS
require('mini.splitjoin').setup {
detect = { separator = '[,;\n]' },
}
require('mini.jump2d').setup { mappings = { start_jumping = '<leader>S' } }
local indent = require('mini.indentscope')
indent.setup {
draw = { delay = 0 },
}
indent.gen_animation.none()
require('mini.notify').setup {
window = {
winblend = 0,
config = {
anchor = 'SE',
border = 'double',
row = vim.o.lines,
}, },
},
} clues = {
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
},
}
local map = require('mini.map')
map.setup {
symbols = {
scroll_line = '',
scroll_view = '',
},
integrations = {
map.gen_integration.builtin_search(),
map.gen_integration.diagnostic(),
map.gen_integration.gitsigns(),
},
window = {
show_integration_count = false,
winblend = 0,
width = 5,
},
}
vim.keymap.set('n', '<leader>nm', map.toggle, { noremap = true, desc = 'minimap open' })
require('mini.notify').setup {
window = {
winblend = 0,
config = {
border = 'double',
},
},
}
local files = require("mini.files")
files.setup {
mappings = {
synchronize = "w",
go_in_plus="<CR>"
},
windows = {
preview = true,
width_preview = 50,
}
}
vim.keymap.set('n', '<leader>c', files.open, { noremap = true, desc = 'minifiles open' })
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
local buf_id = args.data.buf_id
vim.keymap.set(
"n",
"<leader>c",
function()
files.synchronize()
files.close()
end,
{ buffer = buf_id }
)
end,
})
end)
end, end,
}, },
} }

View file

@ -1,4 +1,9 @@
return { return {
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
},
{ {
'danymat/neogen', 'danymat/neogen',
event = 'VeryLazy', event = 'VeryLazy',
@ -27,7 +32,6 @@ return {
event = 'VeryLazy', event = 'VeryLazy',
dependencies = { dependencies = {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons"
} }
}, },
{ 'tiagovla/scope.nvim', event = 'VeryLazy', config = true }, { 'tiagovla/scope.nvim', event = 'VeryLazy', config = true },
@ -59,9 +63,6 @@ return {
'leath-dub/snipe.nvim', 'leath-dub/snipe.nvim',
event = 'VeryLazy', event = 'VeryLazy',
opts = { opts = {
ui = {
position = 'center',
},
sort = 'last', sort = 'last',
}, },
config = function(_, opts) config = function(_, opts)
@ -108,31 +109,6 @@ return {
}, },
}, },
}, },
{
'stevearc/oil.nvim',
opts = {
watch_for_changes = true,
columns = {
'permissions',
'size',
},
view_options = {
show_hidden = true,
},
keymaps = {
['wq'] = 'actions.close',
},
},
keys = {
{
'<leader>nc',
function()
require('oil').toggle_float()
end,
{ noremap = true, silent = true },
},
},
},
{ {
'mbbill/undotree', 'mbbill/undotree',
event = 'VeryLazy', event = 'VeryLazy',
@ -157,16 +133,18 @@ return {
config = function(_, opts) config = function(_, opts)
require('nightfox').setup(opts) require('nightfox').setup(opts)
vim.cmd('colorscheme terafox') vim.cmd('colorscheme terafox')
vim.api.nvim_set_hl(0, 'MiniNotifyNormal', { bg = 'none' }) vim.schedule(function()
vim.api.nvim_set_hl(0, 'MiniNotifyTitle', { bg = 'none' }) vim.api.nvim_set_hl(0, 'MiniNotifyNormal', { bg = 'none' })
vim.api.nvim_set_hl(0, 'MiniNotifyBorder', { bg = 'none' }) vim.api.nvim_set_hl(0, 'MiniNotifyTitle', { bg = 'none' })
vim.api.nvim_set_hl(0, 'MiniMapNormal', { bg = 'none' }) vim.api.nvim_set_hl(0, 'MiniNotifyBorder', { bg = 'none' })
vim.api.nvim_set_hl(0, 'MiniClueNormal', { bg = 'none' }) vim.api.nvim_set_hl(0, 'MiniMapNormal', { bg = 'none' })
vim.api.nvim_set_hl(0, 'StatusLine', { bg = 'none' }) vim.api.nvim_set_hl(0, 'MiniClueNormal', { bg = 'none' })
vim.api.nvim_set_hl(0, 'StatusLineNC', { bg = 'none' }) vim.api.nvim_set_hl(0, 'StatusLine', { bg = 'none' })
vim.api.nvim_set_hl(0, 'GitSignsAdd', { fg = 'green', bold = true }) vim.api.nvim_set_hl(0, 'StatusLineNC', { bg = 'none' })
vim.api.nvim_set_hl(0, 'GitSignsDelete', { fg = 'red', bold = true }) vim.api.nvim_set_hl(0, 'GitSignsAdd', { fg = 'green', bold = true })
vim.api.nvim_set_hl(0, 'GitSignsChange', { fg = 'green', bold = true }) vim.api.nvim_set_hl(0, 'GitSignsDelete', { fg = 'red', bold = true })
vim.api.nvim_set_hl(0, 'GitSignsChange', { fg = 'green', bold = true })
end)
end, end,
}, },
{ {

View file

@ -10,7 +10,6 @@ return {
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-fzf-native.nvim', 'nvim-telescope/telescope-fzf-native.nvim',
'nvim-tree/nvim-web-devicons',
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
'tiagovla/scope.nvim', 'tiagovla/scope.nvim',
}, },

View file

@ -1,7 +1,7 @@
return { return {
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
lazy = false, event = 'VeryLazy',
dependencies = { dependencies = {
'nvim-treesitter/nvim-treesitter-context', 'nvim-treesitter/nvim-treesitter-context',
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',