Greatly improve terminal features! Persistent terminals (#275)

* remove toggleTerm plugin

* Adding term binds, term hider & Telescope terms to bring them back

* Adding many term features!
This commit is contained in:
Galen Rowell 2021-08-18 20:13:35 +10:00 committed by GitHub
parent 51760c21f5
commit 575dc10ddc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 303 additions and 83 deletions

View file

@ -5,7 +5,7 @@ local present, bufferline = pcall(require, "bufferline")
if not present then
return
end
bufferline.setup {
options = {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
@ -24,6 +24,24 @@ bufferline.setup {
separator_style = "thin",
mappings = true,
always_show_bufferline = true,
custom_filter = function(buf_number)
-- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(buf_number, "term_type")
end)
if present_type then
if type == "vert" then
return false
elseif type == "hori" then
return false
else
return true
end
else
return true
end
end,
},
highlights = {
fill = {

View file

@ -65,8 +65,11 @@ telescope.setup {
},
}
-- NvChad pickers
-- load the theme_switcher extension
require("telescope").load_extension "themes"
-- load the term_picker extension
require("telescope").load_extension "terms"
if not pcall(function()
telescope.load_extension "fzf"

View file

@ -1,47 +0,0 @@
local present, toggleterm = pcall(require, "toggleterm")
if not present then
return
end
toggleterm.setup {
-- size can be a number or function which is passed the current terminal
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
-- open_mapping = [[<C-\>]], -- mapping set in mappings.lua
hide_numbers = true, -- hide the number column in toggleterm buffers
shade_terminals = false,
start_in_insert = true,
-- insert_mappings = true, -- see 'open_mapping', not set on purpose
-- whether or not the open mapping applies in insert mode
persist_size = true,
direction = "vertical",
close_on_exit = true, -- close the terminal window when the process exits
-- This field is only relevant if direction is set to 'float'
float_opts = {
border = "single",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
}
local Terminal = require("toggleterm.terminal").Terminal
_G.termW = Terminal:new {
direction = "window",
}
_G.termV = Terminal:new {
direction = "vertical",
}
_G.termH = Terminal:new {
direction = "horizontal",
}