From a0d7062a2f50352e3389d17e712163e650c4f758 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sat, 25 Feb 2023 22:57:46 +0200 Subject: [PATCH] Changed keybinds --- lua/user/autocommands.lua | 21 +++------------------ lua/user/whichkey.lua | 14 ++++++-------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/lua/user/autocommands.lua b/lua/user/autocommands.lua index 84341df..1696920 100644 --- a/lua/user/autocommands.lua +++ b/lua/user/autocommands.lua @@ -3,9 +3,8 @@ vim.api.nvim_create_autocmd({ "FileType" }, { pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" }, callback = function() - vim.cmd([[ - nnoremap q :close - set nobuflisted + vim.cmd([[ nnoremap q :close + set nobuflisted ]]) end, }) @@ -62,7 +61,7 @@ vim.api.nvim_create_autocmd({ "InsertEnter" }, { }) vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "vimwiki" }, + pattern = { "vimwiki", "java" }, callback = function() vim.opt_local.ts = 2 vim.opt_local.sw = 2 @@ -76,20 +75,6 @@ vim.cmd([[ highlight CursorColumn ctermbg=White cterm=bold guibg=#222222 ]]) --- Run file -vim.cmd([[ - augroup run_file - autocmd FileType python imap wexec "!python3 %" - autocmd FileType python map wexec "!python3 %" - autocmd FileType rust imap wexec "!cargo run" - autocmd FileType rust map wexec "!cargo run" - autocmd FileType tex imap wexec "silent !lualatex %" - autocmd FileType tex map wexec "silent !lualatex %" - autocmd FileType cpp imap wexec "!g++ % -o %:r && %:r" - autocmd FileType cpp map wexec "!g++ % -o %:r && %:r" - augroup end -]]) - -- Autocommand that reloads waybar whenever you save the ~/.config/waybar/config file vim.cmd([[ augroup waybar_user_config diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 97d2b56..2f43c4b 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -103,8 +103,7 @@ local mappings = { ["e"] = { "NvimTreeToggle", "Explorer" }, ["F"] = { "Telescope live_grep theme=ivy", "Find Text" }, ["P"] = { "lua require('telescope').extensions.projects.projects()", "Projects" }, - - b = { + B = { name = "Buffers", j = { "BufferLinePick", "Jump" }, f = { "Telescope buffers", "Find" }, @@ -129,7 +128,6 @@ local mappings = { "Sort by language", }, }, - p = { name = "Packer", c = { "PackerCompile", "Compile" }, @@ -138,7 +136,6 @@ local mappings = { S = { "PackerStatus", "Status" }, u = { "PackerUpdate", "Update" }, }, - g = { name = "Git", g = { "lua _LAZYGIT_TOGGLE()", "Lazygit" }, @@ -161,7 +158,6 @@ local mappings = { "Git Diff", }, }, - l = { name = "LSP", a = { "lua vim.lsp.buf.code_action()", "Code Action" }, @@ -192,7 +188,6 @@ local mappings = { }, e = { "Telescope quickfix", "Telescope Quickfix" }, }, - s = { name = "Search", b = { "Telescope git_branches", "Checkout branch" }, @@ -211,7 +206,6 @@ local mappings = { "Colorscheme with Preview", }, }, - t = { name = "Terminal", n = { "lua _NODE_TOGGLE()", "Node" }, @@ -223,7 +217,6 @@ local mappings = { h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, }, - w = { name = "Vimwiki", w = { "VimwikiIndex", "Open index file" }, @@ -255,6 +248,11 @@ local mappings = { i = { "lua require('dap').step_into()", "Step into code" }, r = { "lua require('dap).repl.open()", "Inspect state" }, }, + b = { + name = "Build/compile/run", + b = { "w!!compiler '%:p'", "Run/compile file" }, + o = { "!opout '%:p'", "Open file" }, + }, } which_key.setup(setup)