diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-07-19 02:17:18 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-07-19 02:17:18 +0530 |
commit | 3e4ce0d7db1a308a8e0d6051e8020211bd84ea94 (patch) | |
tree | 5128c213d68da7bc9b11a71fb0f83f2660cb9595 /.config/nvim/lua | |
parent | 55d2488635f81916d092c81e6ec79740f7b45461 (diff) |
nvim: Adding toggleterm plugin + whickey spacebinds w term,lazygit and packer
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/justsaumit/plugins.lua | 3 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/toggleterm-config.lua | 16 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/which-key-config.lua | 27 |
3 files changed, 45 insertions, 1 deletions
diff --git a/.config/nvim/lua/justsaumit/plugins.lua b/.config/nvim/lua/justsaumit/plugins.lua index c14149b..63aa83a 100644 --- a/.config/nvim/lua/justsaumit/plugins.lua +++ b/.config/nvim/lua/justsaumit/plugins.lua @@ -86,6 +86,9 @@ return packer.startup(function(use) --Markdown + Zenmode --Telescope use {'nvim-telescope/telescope.nvim', tag = '0.1.2', requires = { {'nvim-lua/plenary.nvim'} }} +-- ToggleTerm + use ('akinsho/toggleterm.nvim') + -- use "rafamadriz/friendly-snippets" -- a bunch of snippets to use -- -- Comments - Toggle comments in Neovim diff --git a/.config/nvim/lua/justsaumit/toggleterm-config.lua b/.config/nvim/lua/justsaumit/toggleterm-config.lua new file mode 100644 index 0000000..b1579cd --- /dev/null +++ b/.config/nvim/lua/justsaumit/toggleterm-config.lua @@ -0,0 +1,16 @@ +require'toggleterm'.setup{ + size = 20, + open_mapping = [[<c-\>]], + hide_numbers = true, -- hide the number column in toggleterm buffers + shade_filetypes = {}, + autochdir = false, + shade_terminals = true, + shading_factor = 1, + start_in_insert = true, + insert_mappings = true, -- whether or not the open mapping applies in insert mode + terminal_mappings = true, -- whether or not the open mapping applies in the opened terminals + persist_size = true, + direction = 'horizontal', + close_on_exit = true, + shell = '/usr/bin/zsh', +} diff --git a/.config/nvim/lua/justsaumit/which-key-config.lua b/.config/nvim/lua/justsaumit/which-key-config.lua index 25ec150..16ffedd 100644 --- a/.config/nvim/lua/justsaumit/which-key-config.lua +++ b/.config/nvim/lua/justsaumit/which-key-config.lua @@ -1,13 +1,38 @@ local wk = require("which-key") +local Terminal = require('toggleterm.terminal').Terminal +local toggle_float = function() + local float = Terminal:new({ direction = "float" }) + return float:toggle() +end +local toggle_lazygit = function() + local lazygit = Terminal:new({ cmd = "lazygit", direction = "float" }) + return lazygit:toggle() +end local mappings = { q = {":q<CR>", "Quit"}, Z = {":wq<CR>", "Save and Quit"}, w = {":w<CR>", "Save"}, x ={":bdelete<CR>", "Close"}, + E = { ":e ~/.config/nvim/init.lua<cr>", "Edit config" }, f = { ":Telescope find_files<CR>", "Telescope Find Files" }, h = { ":Telescope find_files hidden=true<CR>", "Telescope Find Files" }, g = { ":Telescope live_grep<CR>", "Telescope Live Grep" }, - r = { ":Telescope oldfiles<CR>", "Recent files" } + r = { ":Telescope oldfiles<CR>", "Recent files" }, + t = { + t = { ":ToggleTerm<cr>", "Split Below" }, + f = { toggle_float, "Floating Terminal" }, + l = { toggle_lazygit, "Lazygit" }, + }, + p = { + name = "Packer", + s = { ":PackerSync<cr>", "Sync Plugins" }, + r = { ":PackerClean<cr>", "Remove Unused Plugins" }, + c = { ":PackerCompile profile=true<cr>", "Recompile Plugins" }, + i = { ":PackerInstall<cr>", "Install Plugins" }, + p = { ":PackerProfile<cr>", "Packer Profile" }, + S = { ":PackerStatus<cr>", "Packer Status" }, + u = { ":PackerUpdate<cr>", "Update Plugins" } + }, } local opts = {prefix = '<leader>'} wk.register(mappings, opts) |