From 1e86949e066f2ada7284c44d927c926ba1725142 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 27 Sep 2023 20:10:54 +0200 Subject: Enable mouse scrollback --- lua/user/opts.lua | 66 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/lua/user/opts.lua b/lua/user/opts.lua index c724710..3bf5b37 100644 --- a/lua/user/opts.lua +++ b/lua/user/opts.lua @@ -18,30 +18,30 @@ vim.opt.clipboard:append({ 'unnamedplus' }) -- Install xclip or this will slowdo -- Behaviour vim.opt.backspace = { 'start', 'eol', 'indent' } -- Make backspace work as you would expect. -vim.opt.hidden = true -- Switch between buffers without having to save first. -vim.opt.splitbelow = true -- make split put the new buffer below the current buffer -vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer -vim.opt.scrolloff = 8 -- -vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar -vim.opt.autoread = true -- reload files if changed externally -vim.opt.display = 'lastline' -- Show as much as possible of the last line. -vim.opt.inccommand = 'split' -- -vim.opt.ttyfast = true -- Faster redrawing. -vim.opt.lazyredraw = false -- Only redraw when necessary -vim.opt.keywordprg = ':help' -- :help options -vim.opt.ruler = true -- -vim.opt.errorbells = false -- -vim.opt.list = true -- Show non-printable characters. -vim.opt.showmatch = true -- -vim.opt.matchtime = 3 -- -vim.opt.showbreak = '↪ ' -- -vim.opt.linebreak = true -- -vim.opt.exrc = true -- +vim.opt.hidden = true -- Switch between buffers without having to save first. +vim.opt.splitbelow = true -- make split put the new buffer below the current buffer +vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer +vim.opt.scrolloff = 8 -- +vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar +vim.opt.autoread = true -- reload files if changed externally +vim.opt.display = 'lastline' -- Show as much as possible of the last line. +vim.opt.inccommand = 'split' -- +vim.opt.ttyfast = true -- Faster redrawing. +vim.opt.lazyredraw = false -- Only redraw when necessary +vim.opt.keywordprg = ':help' -- :help options +vim.opt.ruler = true -- +vim.opt.errorbells = false -- +vim.opt.list = true -- Show non-printable characters. +vim.opt.showmatch = true -- +vim.opt.matchtime = 3 -- +vim.opt.showbreak = '↪ ' -- +vim.opt.linebreak = true -- +vim.opt.exrc = true -- --vim.opt.autochdir = true -- or use this to use <:e> to create a file in current directory -vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking +vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking --vim.opt.notimeout = true -- Timeout on keycodes and not mappings -vim.opt.ttimeout = true -- Makes terminal vim work sanely -vim.opt.ttimeoutlen = 10 -- +vim.opt.ttimeout = true -- Makes terminal vim work sanely +vim.opt.ttimeoutlen = 10 -- --vim.opt.timeoutlen = 100 -- time to wait for a mapped sequence to complete (in milliseconds) --vim.cmd([[set diffopt = vertical = true]]) -- diffs are shown side-by-side not above/below @@ -179,8 +179,8 @@ vim.opt.fillchars = { } vim.opt.listchars = { tab = '▸ ', trail = '·' } -- --vim.opt.fillchars:append({ eob = " " }) -- remove the ~ from end of buffer -vim.opt.modeline = true -- -vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) +vim.opt.modeline = true -- +vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) --vim.opt.modelineexpr = true --vim.opt.nofoldenable = true -- turn folding off --vim.opt.foldenable = false -- turn folding off @@ -301,3 +301,21 @@ vim.cmd([[ " Return to the same line when \ endif augroup END ]]) + +-- Enable mouse scrollback +vim.cmd([[ + set mouse=a + tnoremap + tnoremap + function! ClearTerminal() + set scrollback=1 + let &g:scrollback=1 + echo &scrollback + call feedkeys("\i") + call feedkeys("clear\") + call feedkeys("\\") + call feedkeys("\i") + sleep 100m + let &scrollback=s:scroll_value + endfunction +]]) -- cgit v1.2.3