From ceb4c7ece2a9eba2293dcba0abfd5affcd0e090a Mon Sep 17 00:00:00 2001 From: Max Richter Date: Thu, 5 Jan 2023 16:30:32 +0100 Subject: [PATCH] lazy git state --- configs/nvim/lua/max/core/autocommands.lua | 11 +++++------ configs/nvim/lua/max/core/keymappings.lua | 19 ++++--------------- configs/nvim/lua/max/core/plugins.lua | 2 +- configs/zsh/functions/conf.zsh | 4 +--- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/configs/nvim/lua/max/core/autocommands.lua b/configs/nvim/lua/max/core/autocommands.lua index 4678dcc..7be5a00 100644 --- a/configs/nvim/lua/max/core/autocommands.lua +++ b/configs/nvim/lua/max/core/autocommands.lua @@ -1,24 +1,22 @@ local autocmd = vim.api.nvim_create_autocmd local augroup = vim.api.nvim_create_augroup -local config_group = vim.api.nvim_create_augroup("Config", {}) +local config_group = augroup("Config", {}) -vim.api.nvim_create_autocmd({ "TextYankPost" }, { +autocmd({ "TextYankPost" }, { group = config_group, callback = function() vim.highlight.on_yank() end, }) - -vim.api.nvim_create_autocmd({ "BufReadPost" }, { +autocmd({ "BufReadPost" }, { group = config_group, callback = function() vim.cmd("filetype detect") end, }) - local save_fold = augroup("Persistent Folds", { clear = true }) autocmd("BufWinLeave", { pattern = "*.*", @@ -39,10 +37,11 @@ vim.cmd([[ augroup filetypedetect au BufNewFile,BufRead *.frag setl ft=glsl au BufNewFile,BufRead *.vert setl ft=glsl + au BufNewFile,BufRead tsconfig.json setl ft=jsonc augroup END ]]) -vim.api.nvim_create_autocmd({ "BufReadPost" }, { +autocmd({ "BufReadPost" }, { pattern = "*", group = config_group, command = "filetype detect", diff --git a/configs/nvim/lua/max/core/keymappings.lua b/configs/nvim/lua/max/core/keymappings.lua index 09cffeb..2dd9559 100644 --- a/configs/nvim/lua/max/core/keymappings.lua +++ b/configs/nvim/lua/max/core/keymappings.lua @@ -2,7 +2,6 @@ local map = vim.keymap.set local opts = { noremap = true, silent = true } -local translate = require("max.configs.translate") local saga = require("lspsaga") saga.init_lsp_saga() @@ -13,7 +12,6 @@ map("n", "", ":Telescope find_files preview={timeout=1000}", opts) map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", opts) map("n", "", "za", opts) - map("v", ">", ">gv", opts) map("v", "<", "Lspsaga lsp_finder", opts) map("n", "u", ":UndotreeToggle", opts) --- This is my [i]nspect section, [i]nspect [s]ymbols, [ +-- This is my [i]nspect section, [i]nspect [s]ymbols map("n", "is", "lua require('litee.lib.lsp.wrappers').buf_document_symbol()", opts) map("n", "io", "Lspsaga outline", opts) map("n", "ip", ":TroubleToggle", opts) -map({ "n", "v" }, "t", translate, opts) +map({ "n", "v" }, "t", require("max.configs.translate"), opts) -- DAP Functionality map("n", "b", ":lua require('dap').toggle_breakpoint()", opts) @@ -64,29 +62,20 @@ map("n", "0", ":tablast", opts) map("n", "", ":bprevious", opts) map("n", "", ":bnext", opts) --- Backspace Delete like Browser --- map("i", "", "dbxi", opts) - -- Copy visual selection to keyboard map("v", "Y", '"+y', opts) map("n", "k", "{", opts) map("n", "j", "}", opts) --- I dont use macros at the moment, can disable this if i want to --- map('v', 'Q', 'q', {}) --- map('v', 'Q', 'q', {}) --- map('n', 'q', '', {}) --- map('n', 'q', '', {}) - -- Move lines vscode style map("n", "", "move +1", opts) map("n", "", "move -2", opts) -map("n", "", "yyP", opts) -map("n", "", "yyp", opts) map("i", "", "move +1", opts) map("i", "", "move -2", opts) map("v", "", ":m '>+1gv=gv", opts) map("v", "", ":m '<-2gv=gv", opts) +map("n", "", "yyP", opts) +map("n", "", "yyp", opts) -- If i paste with p, the replaced content doesnt replace my clipboard map("v", "p", '"_dP', opts) diff --git a/configs/nvim/lua/max/core/plugins.lua b/configs/nvim/lua/max/core/plugins.lua index 5f837e4..ca9cf69 100644 --- a/configs/nvim/lua/max/core/plugins.lua +++ b/configs/nvim/lua/max/core/plugins.lua @@ -29,7 +29,7 @@ local plugins = { }, { "ldelossa/litee.nvim", - event = "BufRead", + command = "InsertEnter", dependencies = { "ldelossa/litee-symboltree.nvim", "ldelossa/litee-calltree.nvim", diff --git a/configs/zsh/functions/conf.zsh b/configs/zsh/functions/conf.zsh index 9368f61..fcf3f08 100644 --- a/configs/zsh/functions/conf.zsh +++ b/configs/zsh/functions/conf.zsh @@ -15,9 +15,7 @@ function conf(){ cd $1 fi - if [[ -f "init.lua" ]]; then - nvim init.lua - elif [[ -f ".zshrc" ]]; then + if [[ -f ".zshrc" ]]; then nvim .zshrc source ~/.zshrc elif [[ -f "config" ]]; then