Heirline separators, leap.nvim, better binds

This commit is contained in:
Natty 2024-01-20 01:58:39 +01:00
parent 1263ea6a42
commit 7afdcaf81a
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
4 changed files with 127 additions and 16 deletions

View File

@ -12,6 +12,13 @@ local config = {
remotes = {}
},
colorscheme = "catppuccin",
heirline = {
separators = {
left = { "", "" }, -- separator for the left side of the statusline
right = { "", " " }, -- separator for the right side of the statusline
tab = { "", "" },
}
},
polish = function()
end
}

View File

@ -1,15 +1,20 @@
return {
n = {
["<C-h>"] = {"db", desc = "Ctrl+Backspace to delete a word backwards"},
["<C-BS>"] = {"db", desc = "Ctrl+Backspace to delete a word backwards (Neovide)"},
["<C-Del>"] = {"dw", desc = "Ctrl+Delete to delete a word forwards"},
["<leader><F2>"] = {":Neotree close<CR>:UndotreeToggle<CR>", desc = "Toggle undo tree"},
["<leader><Left>"] = {"<C-W>h", desc = "Go to the window left"},
["<leader><Right>"] = {"<C-W>l", desc = "Go to the window right"},
["<leader><Up>"] = {"<C-W>k", desc = "Go to the window up"},
["<leader><Down>"] = {"<C-W>j", desc = "Go to the window down"}
["<leader><Down>"] = {"<C-W>j", desc = "Go to the window down"},
["K"] = {require("hover").hover, desc = "Show hover.nvim popup"},
["<C-B>"] = {":Telescope buffers<CR>", desc = "Show Telescope for open buffers"},
["<C-P>"] = {":Telescope registers<CR>", desc = "Show Telescope for register paste"}
},
i = {
["\b"] = {"<C-O>db", desc = "Ctrl+Backspace to delete a word backwards"},
["<C-BS>"] = {"<C-O>db", desc = "Ctrl+Backspace to delete a word backwards (Neovide)"},
["<C-Del>"] = {"<C-O>dw", desc = "Ctrl+Delete to delete a word forwards"}
}
}

View File

@ -5,6 +5,16 @@ local options = function(local_vim)
local_vim.expandtab = {}
local_vim.smartindent = {}
local_vim.autoindent = {}
-- Neovide
local_vim.opt.guifont = "Monaspace Radon:h11"
local_vim.g.neovide_cursor_vfx_mode = "pixiedust"
local_vim.g.neovide_cursor_vfx_particle_density = 14.0
-- Currently buggy, needs an edit to trigger
local_vim.g.inlay_hints_enabled = true
-- Grey out the search area for leap.nvim
vim.api.nvim_set_hl(0, 'LeapBackdrop', { fg = "#888888" })
return local_vim
end

View File

@ -185,4 +185,93 @@ return {{
-- return the new table to be used
return opts
end,
}, {
"lewis6991/hover.nvim",
name = "hover",
config = function()
require("hover").setup {
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.man')
-- require('hover.providers.dictionary')
end,
preview_opts = {
border = 'single'
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
'LSP'
},
mouse_delay = 1000
}
end
}, {
"ggandor/leap.nvim",
name = "leap",
lazy = false,
config = function()
local leap = require('leap')
leap.setup {
highlight_unlabeled_phase_one_targets = true
}
leap.create_default_mappings()
-- Magic trick from https://github.com/ggandor/leap.nvim/issues/65#issuecomment-1637749795
-- to highlight already matched parts
local function highlight_unlabeled_phase_one_targets(targets, first_idx, last_idx)
local hl = require('leap.highlight')
for i = first_idx or 1, last_idx or #targets do
local target = targets[i]
if target.chars then
local bufnr = target.wininfo.bufnr
local id = vim.api.nvim_buf_set_extmark(
bufnr, hl.ns, target.pos[1] - 1, target.pos[2] - 1,
{
virt_text = { { table.concat(target.chars), "LeapMatch" } },
virt_text_pos = "overlay",
hl_mode = "combine",
priority = hl.priority.label,
}
)
-- This way Leap automatically cleans up your stuff together with its own.
table.insert(hl.extmarks, { bufnr, id })
end
end
-- Continue with Leap's native function body.
return true
end
leap.opts.on_beacons = highlight_unlabeled_phase_one_targets
end
}, {
"rebelot/heirline.nvim",
opts = function(_, opts)
-- Config override from: https://docs.astronvim.com/recipes/status#default-statusline-with-mode-text
local status = require("astronvim.utils.status")
opts.statusline = { -- statusline
hl = { fg = "fg", bg = "bg" },
status.component.mode { mode_text = { padding = { left = 1, right = 1 } } }, -- add the mode text
status.component.git_branch(),
status.component.file_info { filetype = {}, filename = false, file_modified = false },
status.component.git_diff(),
status.component.diagnostics(),
status.component.fill(),
status.component.cmd_info(),
status.component.fill(),
status.component.lsp(),
status.component.treesitter(),
status.component.nav(),
-- remove the 2nd mode indicator on the right
}
-- return the final configuration table
return opts
end,
}}