dotfiles/.config/nvim/lua/other.lua

90 lines
4.2 KiB
Lua
Raw Normal View History

2021-09-03 01:18:44 -07:00
local M = {}
-- nvimtree >>>
2021-09-03 01:18:44 -07:00
M.nvimtree = function ()
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
-- default mappings
vim.g.nvim_tree_bindings = {
{ key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit") },
{ key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd") },
{ key = "<C-v>", cb = tree_cb("vsplit") },
{ key = "<C-x>", cb = tree_cb("split") },
{ key = "<C-t>", cb = tree_cb("tabnew") },
{ key = "<", cb = tree_cb("prev_sibling") },
{ key = ">", cb = tree_cb("next_sibling") },
{ key = "P", cb = tree_cb("parent_node") },
{ key = "<BS>", cb = tree_cb("close_node") },
{ key = "<S-CR>", cb = tree_cb("close_node") },
{ key = "<Tab>", cb = tree_cb("preview") },
{ key = "K", cb = tree_cb("first_sibling") },
{ key = "J", cb = tree_cb("last_sibling") },
{ key = "I", cb = tree_cb("toggle_ignored") },
{ key = "H", cb = tree_cb("toggle_dotfiles") },
{ key = "R", cb = tree_cb("refresh") },
{ key = "a", cb = tree_cb("create") },
{ key = "d", cb = tree_cb("remove") },
{ key = "r", cb = tree_cb("rename") },
{ key = "<C-r>", cb = tree_cb("full_rename") },
{ key = "x", cb = tree_cb("cut") },
{ key = "c", cb = tree_cb("copy") },
{ key = "p", cb = tree_cb("paste") },
{ key = "y", cb = tree_cb("copy_name") },
{ key = "Y", cb = tree_cb("copy_path") },
{ key = "gy", cb = tree_cb("copy_absolute_path") },
{ key = "[c", cb = tree_cb("prev_git_item") },
{ key = "]c", cb = tree_cb("next_git_item") },
{ key = "-", cb = tree_cb("dir_up") },
{ key = "s", cb = tree_cb("system_open") },
{ key = "q", cb = tree_cb("close") },
{ key = "g?", cb = tree_cb("toggle_help") },
}
end
-- <<<
2021-09-03 01:18:44 -07:00
-- toggleterm >>>
2021-09-03 01:18:44 -07:00
M.toggleterm = function()
require("toggleterm").setup{
-- size can be a number or function which is passed the current terminal
-- size = 20 | 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-\>]],
toggleterm_terminal_mapping = '<Leader>t',
hide_numbers = true, -- hide the number column in toggleterm buffers
shade_filetypes = {},
shade_terminals = true,
shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
start_in_insert = true,
insert_mappings = true, -- whether or not the open mapping applies in insert mode
persist_size = true,
direction = 'vertical', -- | 'horizontal' | 'window' | 'float',
close_on_exit = true, -- close the terminal window when the process exits
-- shell = vim.o.shell, -- change the default shell
-- This field is only relevant if direction is set to 'float'
float_opts = {
-- The border key is *almost* the same as 'nvim_open_win'
-- see :h nvim_open_win for details on borders however
-- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin.
border = 'single',
width = 120,
height = 32,
winblend = 3,
highlights = {
border = "Normal",
background = "Normal",
}
}
}
end
-- <<<
2021-09-03 01:18:44 -07:00
return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3