nvim

Personal nvim configurations
git clone https://git.kamikakushi.net/nvim.git
Log | Files | Refs | LICENSE

commit d707a374b8b24587b742ca5edf2d2b938267676a
parent 79f62604f759d895809ffaafbd9144c84966f465
Author: Inoue Yosuke <[email protected]>
Date:   Mon, 21 Nov 2022 11:23:07 +0900

tweak terminal configurations

Diffstat:
Minit.lua | 4++--
Mlua/plugins.lua | 28++++------------------------
Mlua/terminal.lua | 16++++++++++++++--
3 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/init.lua b/init.lua @@ -8,10 +8,10 @@ vim.g.loaded_netrwPlugin = 1 -- opts vim.o.backup = false vim.o.fileformat = "unix" +vim.o.statusline = "%F%m%h%w%=%l,%c %{&ff}:%{&fenc!=''?&fenc:&enc}" vim.api.nvim_create_user_command("M", "marks", {}) -vim.api.nvim_create_user_command("Q", "qa", {}) -require('terminal') +require ('terminal') vim.api.nvim_create_user_command('PackerSync', function () require('plugins').sync() diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -26,6 +26,7 @@ local function init() packer.reset() use 'wbthomason/packer.nvim' + use 'tpope/vim-commentary' use 'sirtaj/vim-maildrop' use { 'sindrets/diffview.nvim', @@ -42,25 +43,13 @@ local function init() end } use { - 'akinsho/toggleterm.nvim', - config = function() - require("toggleterm").setup({ - auto_scroll = true, - autochdir = true, - close_on_exit = true, - open_mapping = [[<C-\>]], - shell = vim.o.shell, - start_in_insert = true, - terminal_mappings = true, - }) - end - } - use { 'nvim-tree/nvim-tree.lua', - after = 'toggleterm.nvim', config = function() vim.o.termguicolors = true require('nvim-tree').setup({ + filesystem_watchers = { + enable = false, + }, hijack_directories = { enable = true, auto_open = true, @@ -85,15 +74,6 @@ local function init() mappings = { list = { { - key = 'gt', - action = 'open_terminal', - action_cb = function(node) - if node.type == 'directory' then - vim.cmd('ToggleTerm dir="' .. node.absolute_path .. '"') - end - end, - }, - { key = 'gp', action = 'set_parent', action_cb = function(node) diff --git a/lua/terminal.lua b/lua/terminal.lua @@ -1,8 +1,20 @@ -- vim: expandtab:ts=2:sw=2 +vim.keymap.set('n', '<C-w><C-e>', ':tabe<CR>:terminal<CR>i') +vim.keymap.set('t', [[<C-\><C-\>]], [[<C-\><C-n>]]) + +vim.api.nvim_create_autocmd('TermClose', { + pattern = '*', + command = [[if !v:event.status | exe 'bdelete! '..expand('<abuf>') | endif]], +}) + if vim.fn.has('win32') then - -- https://github.com/akinsho/toggleterm.nvim/wiki/Tips-and-Tricks#using-toggleterm-with-powershell - vim.o.shell = 'powershell.exe' + -- @see :h shell-powershell + if vim.fn.executable('pwsh') == 1 then + vim.o.shell = 'pwsh' + else + vim.o.shell = 'powershell' + end vim.o.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;' vim.o.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait' vim.o.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'