aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/user/opts.lua
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2023-10-17 21:26:40 +0200
committersrdusr <trevorgray@srdusr.com>2023-10-17 21:26:40 +0200
commit54a7c1bf02da30c353ddb4af51b065d895801f47 (patch)
tree08dfaa302a7c7018d0dc03fe00518c8129c87c7b /.config/nvim/lua/user/opts.lua
parent1938838a043b13169a550af5ea37239adfc75293 (diff)
parentc3c0307c2fc26410249df9578c7bf16eb0caa9df (diff)
downloaddotfiles-54a7c1bf02da30c353ddb4af51b065d895801f47.tar.gz
dotfiles-54a7c1bf02da30c353ddb4af51b065d895801f47.zip
Merge commit '67d475c7259bf2448fa3f1d330885ea88036668d'
Diffstat (limited to '.config/nvim/lua/user/opts.lua')
-rw-r--r--.config/nvim/lua/user/opts.lua98
1 files changed, 73 insertions, 25 deletions
diff --git a/.config/nvim/lua/user/opts.lua b/.config/nvim/lua/user/opts.lua
index c724710..cc8debc 100644
--- a/.config/nvim/lua/user/opts.lua
+++ b/.config/nvim/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
@@ -192,7 +192,7 @@ vim.opt.hlsearch = true -- Keep matches highlighted.
vim.opt.ignorecase = true -- ignore case in search patterns UNLESS /C or capital in search
vim.opt.smartcase = true -- smart case
vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns.
-vim.opt.winblend = 30
+--vim.opt.winblend = 30
--vim.opt.winblend = 5
vim.opt.wildoptions = 'pum' --
--vim.opt.pumblend = 5 --
@@ -301,3 +301,51 @@ vim.cmd([[ " Return to the same line when
\ endif
augroup END
]])
+
+-- Enable mouse scrollback
+vim.cmd([[
+ set mouse=a
+ tnoremap <Esc> <C-\><C-n>
+ tnoremap <c-b> <c-\><c-n>
+ function! ClearTerminal()
+ set scrollback=1
+ let &g:scrollback=1
+ echo &scrollback
+ call feedkeys("\i")
+ call feedkeys("clear\<CR>")
+ call feedkeys("\<C-\>\<C-n>")
+ call feedkeys("\i")
+ sleep 100m
+ let &scrollback=s:scroll_value
+ endfunction
+]])
+
+-- Yank to clipboard in Termux
+if vim.fn.has('termux') == 1 then
+ local Job = require('plenary.job')
+ vim.api.nvim_create_autocmd('TextYankPost', {
+ pattern = '*',
+ callback = function()
+ Job:new({
+ command = 'termux-clipboard-set',
+ writer = vim.fn.getreg('@'),
+ }):start()
+ end,
+ })
+end
+
+function GetTermuxClipboard()
+ if vim.fn.has('termux') == 1 then
+ local sysclip = vim.fn.system('termux-clipboard-get')
+ if sysclip ~= '@' then
+ vim.fn.setreg('@', sysclip)
+ end
+ end
+ return ''
+end
+
+if vim.fn.has('termux') == 1 then
+ vim.cmd('autocmd TextYankPost * call GetTermuxClipboard()')
+ vim.cmd('noremap <expr> p Paste("p")')
+ vim.cmd('noremap <expr> P Paste("P")')
+end