saner settings for me

This commit is contained in:
Christoph J. Scherr 2024-01-19 18:23:22 +01:00
parent 0bf822d2a2
commit 7c63964eb6
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
3 changed files with 164 additions and 14 deletions

View File

@ -1,7 +1,3 @@
-- local autocmd = vim.api.nvim_create_autocmd
-- Auto resize panes when resizing nvim window
-- autocmd("VimResized", {
-- pattern = "*",
-- command = "tabdo wincmd =",
-- })
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"

View File

@ -1,21 +1,119 @@
---@type MappingsTable
local M = {}
local M = {
n = {
["<C-s>"] = "",
},
}
M.disabled = {
n = {
["<leader>h"] = "",
["<C-a>"] = "",
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<localleader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
["<localleader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<localleader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<localleader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<localleader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<localleader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git
["<localleader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term
["<localleader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- theme switcher
["<localleader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
["<localleader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<localleader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
M.general = {
i = {
-- go to beginning and end
["<C-b>"] = { "<HOME>", "Beginning of line" },
["<C-e>"] = { "<End>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<Left>", "Move left" },
["<C-l>"] = { "<Right>", "Move right" },
["<C-j>"] = { "<Down>", "Move down" },
["<C-k>"] = { "<Up>", "Move up" },
},
n = {
[";"] = { ":", "enter command mode", opts = { nowait = true } },
--big move
["<A-k>"] = { "<C-u>", "big step down"},
["<A-j>"] = { "<C-d>", "big step down"},
-- easy newline
["OO"] = { "O<ESC>", "insert a line above", opts = { nowait = true } },
["oo"] = { "o<ESC>", "insert a line below", opts = { nowait = true } },
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<End>", "End of line" },
-- do something useful with the arrows
["<Up>"] = { "<cmd>move-2<CR>==", "Move line up", opts = { expr = true } },
["<Down>"] = { "<cmd>move+<CR>==", "Move line down", opts = { expr = true } },
["<LEFT>"] = { "<<", "Less indentation", opts = { expr = true } },
["<RIGHT>"] = { ">>", "More indentation", opts = { expr = true } },
-- format with conform
["<leader>ff"] = {
["<leader>fm"] = {
function()
require("conform").format()
end,
"formatting",
}
},
["<leader>tw"] = {
function()
vim.opt_local.wrap = not vim.wo.wrap
vim.opt_local.breakindent = not vim.wo.breakindent
if vim.wo.colorcolumn == "" then
vim.opt_local.colorcolumn = tostring(vim.bo.textwidth)
else
vim.opt_local.colorcolumn = ""
end
end,
"toggle wrap",
},
},
v = {
[">"] = { ">gv", "indent"},
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<End>", "End of line" },
["<LEFT>"] = { "<gv", "Less indentation" },
["<RIGHT>"] = { ">gv", "More indentation" },
},
x = {
["<Up>"] = { "move'<-2<CR>gv=gv", "Move line up", opts = { expr = true } },
["<Down>"] = { "move'<-2<CR>gv=gv", "Move line down", opts = { expr = true } },
},
}

View File

@ -1,4 +1,4 @@
local overrides = require("custom.configs.overrides")
local overrides = require "custom.configs.overrides"
---@type NvPluginSpec[]
local plugins = {
@ -16,7 +16,7 @@ local plugins = {
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason
opts = overrides.mason,
},
{
@ -46,6 +46,62 @@ local plugins = {
require "custom.configs.conform"
end,
},
{
-- NOTE: This is leap for selecting things!
"ggandor/flit.nvim",
config = function()
require("flit").setup {
keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = "nvo",
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
}
end,
enabled = true,
},
{
"ggandor/leap.nvim",
-- stylua: ignore
keys = {
{ 'gl', '<Plug>(leap-forward-to)', mode = { 'n', 'x', 'o' }, desc = 'Leap forward to' },
{ 'gL', '<Plug>(leap-backward-to)', mode = { 'n', 'x', 'o' }, desc = 'Leap backward to' },
{ '<leader>wgl', '<Plug>(leap-from-window)', mode = { 'n', 'x', 'o' }, desc = 'Leap to windows' },
},
config = function()
local leap = require "leap"
leap.opts.case_sensitive = false
leap.opts.safe_labels = { "f", "n", "u", "t", "g", "ö", "w", "b", "m" }
leap.opts.labels = {
"a",
"s",
"f",
"n",
"j",
"k",
"r",
"e",
"r",
"m",
"ö",
"b",
"v",
"u",
"z",
"w",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
}
end,
},
}
return plugins