From 8330555c19b51875a842af00b0f805e2417d6fd8 Mon Sep 17 00:00:00 2001 From: mace Date: Tue, 15 Aug 2023 09:11:20 +0200 Subject: [PATCH] added toggleterm, color lualine --- lua/custom/lua-line.lua | 27 +++++++++++++---- lua/custom/toggleterm.lua | 63 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 lua/custom/toggleterm.lua diff --git a/lua/custom/lua-line.lua b/lua/custom/lua-line.lua index e39c1e3..38aabb3 100644 --- a/lua/custom/lua-line.lua +++ b/lua/custom/lua-line.lua @@ -19,17 +19,34 @@ local new_colors = { } -- change nightlfy theme colors -lualine_nightfly.normal.a.bg = new_colors.blue -lualine_nightfly.insert.a.bg = new_colors.red -lualine_nightfly.visual.a.bg = new_colors.violet +lualine_nightfly.normal.a.fg = new_colors.blue +lualine_nightfly.insert.a.fg = new_colors.red +lualine_nightfly.visual.a.fg = new_colors.violet lualine_nightfly.command = { a = { gui = "bold", - bg = new_colors.yellow, - fg = new_colors.black, -- black + fg = new_colors.yellow, + bg = '', -- black }, } +lualine_nightfly.normal.a.bg = '' +lualine_nightfly.insert.a.bg = '' +lualine_nightfly.visual.a.bg = '' + +lualine_nightfly.normal.b.bg = '' +lualine_nightfly.insert.b.bg = '' +lualine_nightfly.visual.b.bg = '' + +lualine_nightfly.normal.b.bg = '' +lualine_nightfly.normal.c.bg = '' +lualine_nightfly.command = { + a = { + gui = "bold", + bg = '', + fg = new_colors.yellow, -- black + }, +} -- configure lualine with modified theme lualine.setup({ options = { diff --git a/lua/custom/toggleterm.lua b/lua/custom/toggleterm.lua new file mode 100644 index 0000000..593db59 --- /dev/null +++ b/lua/custom/toggleterm.lua @@ -0,0 +1,63 @@ +-- import toggleterm plugin safely +local toggleterm_setup, toggleterm = pcall(require, "toggleterm") +if not toggleterm_setup then + return +end + + +toggleterm.setup({ + open_mapping = [[]], + size = 20, + -- open_mapping = [[]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persist_size = true, + direction = "float", + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = "curved", + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + }, + +}) + +function _G.set_terminal_keymaps() + local opts = {buffer = 0} + vim.keymap.set('t', '', [[]], opts) + vim.keymap.set('t', 'jk', [[]], opts) + vim.keymap.set('t', '', [[wincmd h]], opts) + vim.keymap.set('t', '', [[wincmd j]], opts) + vim.keymap.set('t', '', [[wincmd k]], opts) + vim.keymap.set('t', '', [[wincmd l]], opts) + vim.keymap.set('t', '', [[]], opts) +end + +-- if you only want these mappings for toggle term use term://*toggleterm#* instead +vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') +local Terminal = require("toggleterm.terminal").Terminal +local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) + +function _LAZYGIT_TOGGLE() + lazygit:toggle() +end + +local node = Terminal:new({ cmd = "node", hidden = true }) + +function _NODE_TOGGLE() + node:toggle() +end + +local python = Terminal:new({ cmd = "python3", hidden = true }) + +function _PYTHON_TOGGLE() + python:toggle() +end