diff options
Diffstat (limited to '.config/nvim/lua/user/opts.lua')
| -rw-r--r-- | .config/nvim/lua/user/opts.lua | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/.config/nvim/lua/user/opts.lua b/.config/nvim/lua/user/opts.lua index c1b5027..78a84a4 100644 --- a/.config/nvim/lua/user/opts.lua +++ b/.config/nvim/lua/user/opts.lua @@ -43,7 +43,7 @@ vim.g.python3_host_prog = "/usr/bin/python3" -- vim.g.loaded_python3_provider = 1 -- vim.g.sh_noisk = 1 -- iskeyword word boundaries when editing a 'sh' file vim.o.autochdir = true ---vim.opt.sessionoptions = "buffers,curdir,folds,help,tabpages,winsize,resize,winpos,terminal,globals" -- +--vim.o.writeany= true -- Colors vim.opt.termguicolors = true @@ -122,11 +122,23 @@ vim.opt.report = 0 -- Always report changed lines. ---- it'll get replaced by the default stline). --vim.opt.stl = " " --- Backup/undo +-- Backup/undo/swap +local prefix = vim.env.XDG_CONFIG_HOME or vim.fn.expand("~/.config") +vim.opt.undodir = { prefix .. "/nvim/tmp/.undo//" } +vim.opt.backupdir = { prefix .. "/nvim/tmp/.backup//" } +vim.opt.directory = { prefix .. "/nvim/tmp/.swp//" } vim.opt.backup = false -- ---vim.opt.noswapfile = true -- ---vim.opt.undofile = true -- -vim.opt.backupskip = { "/tmp/*", "/private/tmp/*" } -- +vim.opt.undofile = false -- +vim.opt.swapfile = true -- +-- Add timestamp as extension for backup files +vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('timestamp_backupext', { clear = true }), + desc = 'Add timestamp to backup extension', + pattern = '*', + callback = function() + vim.opt.backupext = '-' .. vim.fn.strftime('%Y%m%d%H%M') + end, +}) -- Format --vim.opt.textwidth = 80 -- @@ -154,7 +166,7 @@ vim.opt.wrapscan = true -- " Searches wrap around end-of-file. --vim.opt.foldmethod = "expr" -- vim.opt.foldmethod = "manual" vim.opt.foldlevel = 3 -vim.opt.confirm = true +vim.opt.confirm = false vim.opt.shortmess:append("sI") --vim.opt.shortmess = "a" --vim.opt.shortmess = "sI" @@ -226,7 +238,11 @@ vim.opt.shada = "!,'1000,f1,<1000,s100,:1000,/1000,h" -- Sessions vim.opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" +--vim.opt.sessionoptions = "curdir,folds,help,options,tabpages,winsize,winpos,terminal,globals" -- +--vim.opt.sessionoptions = "buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" +--vim.opt.sessionoptions:remove({ "blank", "buffers", "globals" }) +vim.opt.clipboard:append({ "unnamedplus" }) -- Install xclip or this will slowdown startup -- Cursorline vim.cmd([[ " Only show cursorline in the current window and in normal mode augroup cline @@ -248,12 +264,12 @@ vim.cmd([[ " Only show in insert mode ]]) -- Line Return ---vim.cmd([[ " Return to the same line when we reopen a file --- augroup line_return --- au! --- au BufReadPost * --- \ if line("'\"") > 0 && line("'\"") <= line("$") | --- \ execute 'normal! g`"zvzz' | --- \ endif --- augroup END ---]]) +vim.cmd([[ " Return to the same line when we reopen a file + augroup line_return + au! + au BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ execute 'normal! g`"zvzz' | + \ endif + augroup END +]]) |
