Skip to content

Commit

Permalink
few bugfixes, mini.files
Browse files Browse the repository at this point in the history
  • Loading branch information
iofq committed Aug 21, 2024
1 parent 4ceceff commit 14fec02
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 158 deletions.
18 changes: 11 additions & 7 deletions nix/mkNeovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,26 @@ with lib;
# and prepends the nvim and after directory to the RTP
initLua = ''
vim.opt.rtp:prepend('${nvimRtp}/lua')
lazy_opts = {
LAZY_OPTS = {
performance = {
reset_packpath = false,
rtp = { reset = false, },
rtp = {
reset = false,
disabled_plugins = {
"netrwPlugin",
"tutor",
},
},
},
dev = {
path = "${pkgs.neovimUtils.packDir neovimConfig.packpathDirs}/pack/myNeovimPackages/start",
patterns = {""},
},
checker = {
enabled = false,
},
install = { missing = false, },
spec = {{ import = "plugins" }},
disabled_plugins = {
"netrwPlugin",
"tutor",
"zipPlugin",
},
}
'' + (builtins.readFile ../nvim/init.lua);

Expand Down
3 changes: 1 addition & 2 deletions nix/neovim-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ with final.pkgs.lib; let
nvim-lspconfig
nvim-neoclip-lua
nvim-nio
nvim-autopairs
nvim-treesitter-context
nvim-treesitter-textobjects
(nvim-treesitter.withPlugins(p: with p; [
Expand Down Expand Up @@ -72,8 +73,6 @@ with final.pkgs.lib; let
tree-sitter-typescript
tree-sitter-yaml
]))
nvim-web-devicons
oil-nvim
outline-nvim
scope-nvim
snipe-nvim
Expand Down
19 changes: 12 additions & 7 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vim.g.mapleader = ' '
-- 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
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
Expand All @@ -14,14 +14,19 @@ if not lazy_opts then
}
end
vim.opt.rtp:prepend(lazypath)
lazy_opts = {
LAZY_OPTS = {
spec = { { import = 'plugins' } },
disabled_plugins = {
'netrwPlugin',
'tutor',
'zipPlugin',
performance = {
reset_packpath = false,
rtp = {
reset = false,
disabled_plugins = {
"netrwPlugin",
"tutor",
},
},
},
}
end
require('lazy').setup(lazy_opts)
require('lazy').setup(LAZY_OPTS)
require('config')
7 changes: 5 additions & 2 deletions nvim/lua/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ vim.opt.relativenumber = true
vim.opt.shadafile = 'NONE' -- disable shada
vim.opt.shiftwidth = 0 -- >> shifts by tabstop
vim.opt.showmatch = true -- highlight matching brackets
vim.opt.showmode = true
vim.opt.showmode = false
vim.opt.signcolumn = 'no'
vim.opt.spell = false
vim.opt.softtabstop = -1 -- backspace removes tabstop
Expand Down Expand Up @@ -84,7 +84,10 @@ vim.diagnostic.config {

-- random keymaps
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({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true })
Expand Down
8 changes: 3 additions & 5 deletions nvim/lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ return {
},
{
'neovim/nvim-lspconfig',
event = 'VeryLazy',
lazy = false,
dependencies = {
'hrsh7th/cmp-nvim-lsp',
},
Expand All @@ -39,7 +39,7 @@ return {
lspconfig.util.default_config.capabilities,
require('cmp_nvim_lsp').default_capabilities()
)

vim.lsp.inlay_hint.enable(true)
lspconfig.gopls.setup {
settings = {
gopls = {
Expand Down Expand Up @@ -91,15 +91,12 @@ return {
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', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local bufnr = ev.buf
local client = vim.lsp.get_client_by_id(ev.data.client_id)
require('workspace-diagnostics').populate_workspace_diagnostics(client, bufnr)
vim.keymap.set(
'n',
'K',
Expand Down Expand Up @@ -175,6 +172,7 @@ return {
})
vim.lsp.codelens.refresh { bufnr = bufnr }
end
require('workspace-diagnostics').populate_workspace_diagnostics(client, bufnr)
end,
})
vim.api.nvim_exec_autocmds('FileType', {})
Expand Down
189 changes: 95 additions & 94 deletions nvim/lua/plugins/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ return {
'echasnovski/mini.nvim',
lazy = false,
config = function()
require('mini.ai').setup()
require('mini.comment').setup()
require('mini.pairs').setup()
require('mini.tabline').setup({
tabpage_section = 'right',
show_icons = false,
})
require('mini.statusline').setup {
content = {
active = function()
Expand Down Expand Up @@ -50,103 +51,103 @@ return {
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')
miniclue.setup {
triggers = {
{ mode = 'n', keys = '<Leader>' },
{ mode = 'n', keys = 'g' },
{ mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' },
{ mode = 'n', keys = '"' },
{ mode = 'n', keys = '<C-w>' },
{ 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 miniclue = require('mini.clue')
miniclue.setup {
triggers = {
{ mode = 'n', keys = '<Leader>' },
{ mode = 'n', keys = 'g' },
{ mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' },
{ mode = 'n', keys = '"' },
{ mode = 'n', keys = '<C-w>' },
{ mode = 'n', keys = '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' })
clues = {
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
},
}

-- 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()
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 = {
anchor = 'SE',
border = 'double',
row = vim.o.lines,
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,
},
}
Loading

0 comments on commit 14fec02

Please sign in to comment.