aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins')
-rw-r--r--.config/nvim/lua/plugins/lsp.lua4
-rw-r--r--.config/nvim/lua/plugins/toggleterm.lua71
2 files changed, 61 insertions, 14 deletions
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index 2d3944a..548df74 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -11,7 +11,7 @@ require('mason').setup()
require("mason-lspconfig").setup({
ensure_installed = {
"clangd",
- "sumneko_lua",
+ "lua_ls",
"pylsp",
"pyright",
},
@@ -223,7 +223,7 @@ if utils.executable("bash-language-server") then
end
if utils.executable("lua-language-server") then
- lspconfig.sumneko_lua.setup({
+ lspconfig.lua_ls.setup({
on_attach = on_attach,
settings = {
Lua = {
diff --git a/.config/nvim/lua/plugins/toggleterm.lua b/.config/nvim/lua/plugins/toggleterm.lua
index 0c3c45f..024c2f6 100644
--- a/.config/nvim/lua/plugins/toggleterm.lua
+++ b/.config/nvim/lua/plugins/toggleterm.lua
@@ -4,13 +4,13 @@ if not status_ok then
end
toggleterm.setup({
- size = function(term)
- if term.direction == "horizontal" then
- return 12
- elseif term.direction == "vertical" then
- return vim.o.columns * 0.3
- end
- end,
+ --size = function(term)
+ -- if term.direction == "horizontal" then
+ -- return 12
+ -- elseif term.direction == "vertical" then
+ -- return vim.o.columns * 0.3
+ -- end
+ --end,
--size = 20,
open_mapping = [[<leader>tt]],
hide_numbers = true,
@@ -31,7 +31,18 @@ toggleterm.setup({
Normal = {
background = "#000000",
},
- },
+ --float_opts = {
+ -- border = as.style.current.border,
+ -- winblend = 3,
+ --},
+ size = function(term)
+ if term.direction == 'horizontal' then
+ return 15
+ elseif term.direction == 'vertical' then
+ return math.floor(vim.o.columns * 0.4)
+ end
+ end,
+ },
float_opts = {
width = 70,
height = 15,
@@ -44,6 +55,14 @@ toggleterm.setup({
},
},
})
+local utils = require("user.utils")
+local float_handler = function(term)
+
+ if not utils.empty(vim.fn.mapcheck('jj', 't')) then
+ vim.keymap.del('t', 'jj', { buffer = term.bufnr })
+ vim.keymap.del('t', '<esc>', { buffer = term.bufnr })
+ end
+end
function _G.set_terminal_keymaps()
local opts = { noremap = true }
@@ -56,13 +75,40 @@ function _G.set_terminal_keymaps()
vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<C-\><C-n><C-W>l]], opts)
end
-vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
+-- if you only want these mappings for toggle term use term://*toggleterm#* instead
+vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
+--vim.cmd("autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()")
local Terminal = require("toggleterm.terminal").Terminal
-local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
+local lazygit = Terminal:new({
+ cmd = "lazygit",
+ count = 5,
+ dir = "git_dir",
+ direction = "float",
+ on_open = float_handler,
+ hidden = true,
+ float_opts = {
+ border = { '╒', '═', '╕', '│', '╛', '═', '╘', '│' },
+ width = 150,
+ height = 40
+ },
+ ---- Function to run on opening the terminal
+ --on_open = function(term)
+ -- vim.api.nvim_buf_set_keymap(term.bufnr, 'n', 'q', '<cmd>close<CR>',
+ -- {noremap = true, silent = true})
+ -- vim.api.nvim_buf_set_keymap(term.bufnr, 'n', '<esc>', '<cmd>close<CR>',
+ -- {noremap = true, silent = true})
+ -- vim.api.nvim_buf_set_keymap(term.bufnr, 'n', '<C-\\>', '<cmd>close<CR>',
+ -- {noremap = true, silent = true})
+ --end,
+ ---- Function to run on closing the terminal
+ --on_close = function(term)
+ -- vim.cmd("startinsert!")
+ --end
+})
-function _LAZYGIT_TOGGLE()
- lazygit:toggle()
+function Lazygit_toggle()
+ lazygit:toggle()
end
local node = Terminal:new({ cmd = "node", hidden = true })
@@ -88,3 +134,4 @@ local python = Terminal:new({ cmd = "python", hidden = true })
function _PYTHON_TOGGLE()
python:toggle()
end
+