diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-09-11 21:11:53 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-09-11 21:11:53 +0200 |
| commit | a9347a8d6783b360d0e4481151944b0f961404d9 (patch) | |
| tree | b61a5e6beb4d150449ecf004a7e4a6099f4917dc /.config/nvim/lua/user/opts.lua | |
| parent | fd1646bb0d8bca44f263717ec63268947af1386c (diff) | |
| parent | 38ec7c480730e3f83322fa34a6a4ff700ca503d9 (diff) | |
| download | dotfiles-a9347a8d6783b360d0e4481151944b0f961404d9.tar.gz dotfiles-a9347a8d6783b360d0e4481151944b0f961404d9.zip | |
Merge commit '9489548bca74468976436df44134e4aeb40e8548'
Diffstat (limited to '.config/nvim/lua/user/opts.lua')
| -rw-r--r-- | .config/nvim/lua/user/opts.lua | 218 |
1 files changed, 118 insertions, 100 deletions
diff --git a/.config/nvim/lua/user/opts.lua b/.config/nvim/lua/user/opts.lua index bb7f36c..c724710 100644 --- a/.config/nvim/lua/user/opts.lua +++ b/.config/nvim/lua/user/opts.lua @@ -1,74 +1,40 @@ --[[ opts.lua ]] --- " Load indent files, to automatically do language-dependent indenting. ---vim.cmd([[ --- "filetype plugin indent on ---]]) - --- Let clipboard register be + -vim.cmd([[ - let g:clipbrdDefaultReg = '+' -]]) - ---vim.cmd([[ --- "autocmd BufEnter * :syntax sync fromstart --- "syntax enable --- "set nocompatible --- "autocmd FileType lua set comments=s1:---,m:--,ex:-- ---]]) - --- Fast macros without lazyredraw -vim.cmd([[ - set re=0 - nnoremap @ <cmd>execute "noautocmd norm! " . v:count1 . "@" . getcharstr()<cr> - xnoremap @ :<C-U>execute "noautocmd '<,'>norm! " . v:count1 . "@" . getcharstr()<cr> -]]) - --- Stop annoying auto commenting on new lines -vim.cmd [[ - augroup annoying - au! - au BufEnter * set fo-=c fo-=r fo-=o - augroup end -]] -- Environment --vim.opt.shell = "zsh" -- vim.o.updatetime = 250 -vim.o.shell = "/bin/zsh" -vim.scriptencoding = "utf-8" -- -vim.opt.encoding = "utf-8" -- -vim.opt.fileencoding = "utf-8" -- -vim.g.python3_host_prog = "/usr/bin/python3" -- +vim.o.shell = '/bin/zsh' +vim.scriptencoding = 'utf-8' -- +vim.opt.encoding = 'utf-8' -- +vim.opt.fileencoding = 'utf-8' -- +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.o.writeany= true --- Colors -vim.opt.termguicolors = true - -- Clipboard -vim.opt.clipboard:append({ "unnamedplus" }) -- Install xclip or this will slowdown startup +vim.opt.clipboard:append({ 'unnamedplus' }) -- Install xclip or this will slowdown startup -- Behaviour -vim.opt.backspace = { "start", "eol", "indent" } -- Make backspace work as you would expect. +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.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.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.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 @@ -96,7 +62,7 @@ vim.opt.smartindent = true -- smart indent vim.opt.number = true -- vim.opt.title = true -- --vim.opt.colorcolumn = "+1" -- -vim.opt.signcolumn = "yes:1" -- always show the sign column +vim.opt.signcolumn = 'yes:1' -- always show the sign column --vim.opt.signcolumn = "yes:" .. vim.o.numberwidth --vim.opt.signcolumn = "number" --vim.opt.signcolumn = "no" -- @@ -124,15 +90,15 @@ vim.opt.report = 0 -- Always report changed lines. --vim.opt.stl = " " -- Backup/undo/swap -local prefix = vim.env.XDG_CONFIG_HOME or vim.fn.expand("~/.config") +local prefix = vim.env.XDG_CONFIG_HOME or vim.fn.expand('~/.config') --vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -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.undofile = false -- +vim.opt.undodir = { prefix .. '/nvim/tmp/.undo//' } +vim.opt.directory = { prefix .. '/nvim/tmp/.swp//' } +vim.opt.backupdir = { prefix .. '/nvim/tmp/.backup//' } vim.opt.undofile = true -- -vim.opt.swapfile = true -- +vim.opt.swapfile = true -- +vim.opt.backup = true -- +--vim.opt.backupcopy = -- Add timestamp as extension for backup files vim.api.nvim_create_autocmd('BufWritePre', { group = vim.api.nvim_create_augroup('timestamp_backupext', { clear = true }), @@ -145,55 +111,73 @@ vim.api.nvim_create_autocmd('BufWritePre', { -- Format --vim.opt.textwidth = 80 -- -vim.opt.isfname:append("@-@") +vim.opt.isfname:append('@-@') vim.cmd([[let &t_Cs = "\e[4:3m"]]) -- Undercurl vim.cmd([[let &t_Ce = "\e[4:0m"]]) -- -vim.opt.path:append({ "**" }) -- Finding files - Search down into subfolder -vim.cmd("set whichwrap+=<,>,[,],h,l") -- +vim.opt.path:append({ '**' }) -- Finding files - Search down into subfolder +vim.cmd('set whichwrap+=<,>,[,],h,l') -- vim.cmd([[set iskeyword+=-]]) -- --vim.cmd([[set formatoptions-=cro]]) -- TODO: this doesn't seem to work vim.opt.formatoptions = vim.opt.formatoptions - - "t" -- wrap with text width - + "c" -- wrap comments - + "r" -- insert comment after enter - - "o" -- insert comment after o/O - - "q" -- allow formatting of comments with gq - - "a" -- format paragraphs - + "n" -- recognized numbered lists - - "2" -- use indent of second line for paragraph - + "l" -- long lines are not broken - + "j" -- remove comment when joining lines + - 't' -- wrap with text width + + 'c' -- wrap comments + + 'r' -- insert comment after enter + - 'o' -- insert comment after o/O + - 'q' -- allow formatting of comments with gq + - 'a' -- format paragraphs + + 'n' -- recognized numbered lists + - '2' -- use indent of second line for paragraph + + 'l' -- long lines are not broken + + 'j' -- remove comment when joining lines vim.opt.wrapscan = true -- " Searches wrap around end-of-file. --vim.wo.number = true -- --vim.opt.wrap = false -- No Wrap lines --vim.opt.foldmethod = 'manual' -- --vim.opt.foldmethod = "expr" -- -vim.opt.foldmethod = "manual" +vim.opt.foldmethod = 'manual' vim.opt.foldlevel = 3 vim.opt.confirm = false -vim.opt.shortmess:append("sI") +--vim.opt.shortmess:append("sI") --vim.opt.shortmess = "a" --vim.opt.shortmess = "sI" --vim.o.shortmess = vim.o.shortmess:gsub('s', '') +vim.opt.shortmess = table.concat({ -- Use abbreviations and short messages in command menu line. + 'f', -- Use "(3 of 5)" instead of "(file 3 of 5)". + 'i', -- Use "[noeol]" instead of "[Incomplete last line]". + 'l', -- Use "999L, 888C" instead of "999 lines, 888 characters". + 'm', -- Use "[+]" instead of "[Modified]". + 'n', -- Use "[New]" instead of "[New File]". + 'r', -- Use "[RO]" instead of "[readonly]". + 'w', -- Use "[w]", "[a]" instead of "written", "appended". + 'x', -- Use "[dos]", "[unix]", "[mac]" instead of "[dos format]", "[unix format]", "[mac format]". + 'o', -- Overwrite message for writing a file with subsequent message. + 'O', -- Message for reading a file overwrites any previous message. + 's', -- Disable "search hit BOTTOM, continuing at TOP" such messages. + 't', -- Truncate file message at the start if it is too long. + 'T', -- Truncate other messages in the middle if they are too long. + 'I', -- Don't give the :intro message when starting. + 'c', -- Don't give ins-completion-menu messages. + 'F', -- Don't give the file info when editing a file. +}) vim.opt.fillchars = { - horiz = "─", - horizup = "┴", - horizdown = "┬", - vert = "│", - vertleft = "┤", - vertright = "├", - verthoriz = "┼", - foldopen = "", - foldsep = "│", - foldclose = "", - fold = "─", - eob = " ", + horiz = '─', + horizup = '┴', + horizdown = '┬', + vert = '│', + vertleft = '┤', + vertright = '├', + verthoriz = '┼', + foldopen = '', + foldsep = '│', + foldclose = '', + fold = '─', + eob = ' ', --diff = "┃", - diff = "░", - msgsep = "━", + diff = '░', + msgsep = '━', --msgsep = "‾", } -vim.opt.listchars = { tab = "▸ ", trail = "·" } -- +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) @@ -210,14 +194,14 @@ vim.opt.smartcase = true -- smart case vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns. vim.opt.winblend = 30 --vim.opt.winblend = 5 -vim.opt.wildoptions = "pum" -- +vim.opt.wildoptions = 'pum' -- --vim.opt.pumblend = 5 -- vim.opt.pumblend = 12 -- --vim.opt.pumblend=15 vim.opt.pumheight = 10 -- pop up menu height -- Better Completion -vim.opt.complete = { ".", "w", "b", "u", "t" } -- +vim.opt.complete = { '.', 'w', 'b', 'u', 't' } -- --vim.opt.completeopt = { "longest,menuone,preview" } -- vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } --vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp @@ -225,25 +209,25 @@ vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } -- Wildmenu completion -- vim.opt.wildmenu = true -- -vim.opt.wildmode = { "list:longest" } -- -vim.opt.wildignore:append({ ".hg", ".git", ".svn" }) -- Version control -vim.opt.wildignore:append({ "*.aux", "*.out", "*.toc" }) -- LaTeX intermediate files -vim.opt.wildignore:append({ "*.jpg", "*.bmp", "*.gif", "*.png", "*.jpeg" }) -- binary images -vim.opt.wildignore:append({ "*.o", "*.obj", "*.exe", "*.dll", "*.manifest" }) -- compiled object files -vim.opt.wildignore:append({ "*.spl" }) -- compiled spelling word lists -vim.opt.wildignore:append({ "*.sw?" }) -- Vim swap files -vim.opt.wildignore:append({ "*.DS_Store" }) -- OSX bullshit -vim.opt.wildignore:append({ "*.luac" }) -- Lua byte code -vim.opt.wildignore:append({ "migrations" }) -- Django migrations -vim.opt.wildignore:append({ "*.pyc" }) -- Python byte code -vim.opt.wildignore:append({ "*.orig" }) -- Merge resolution files -vim.opt.wildignore:append({ "*/node_modules/*" }) -- +vim.opt.wildmode = { 'list:longest' } -- +vim.opt.wildignore:append({ '.hg', '.git', '.svn' }) -- Version control +vim.opt.wildignore:append({ '*.aux', '*.out', '*.toc' }) -- LaTeX intermediate files +vim.opt.wildignore:append({ '*.jpg', '*.bmp', '*.gif', '*.png', '*.jpeg' }) -- binary images +vim.opt.wildignore:append({ '*.o', '*.obj', '*.exe', '*.dll', '*.manifest' }) -- compiled object files +vim.opt.wildignore:append({ '*.spl' }) -- compiled spelling word lists +vim.opt.wildignore:append({ '*.sw?' }) -- Vim swap files +vim.opt.wildignore:append({ '*.DS_Store' }) -- OSX bullshit +vim.opt.wildignore:append({ '*.luac' }) -- Lua byte code +vim.opt.wildignore:append({ 'migrations' }) -- Django migrations +vim.opt.wildignore:append({ '*.pyc' }) -- Python byte code +vim.opt.wildignore:append({ '*.orig' }) -- Merge resolution files +vim.opt.wildignore:append({ '*/node_modules/*' }) -- -- Shada 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 = '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" }) @@ -253,6 +237,40 @@ vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 +-- " Load indent files, to automatically do language-dependent indenting. +--vim.cmd([[ +-- "filetype plugin indent on +--]]) +vim.cmd('filetype plugin on') +vim.cmd('filetype indent off') + +-- Let clipboard register be + +vim.cmd([[ + let g:clipbrdDefaultReg = '+' +]]) + +--vim.cmd([[ +-- "autocmd BufEnter * :syntax sync fromstart +-- "syntax enable +-- "set nocompatible +-- "autocmd FileType lua set comments=s1:---,m:--,ex:-- +--]]) + +-- Fast macros without lazyredraw +vim.cmd([[ + set re=0 + nnoremap @ <cmd>execute "noautocmd norm! " . v:count1 . "@" . getcharstr()<cr> + xnoremap @ :<C-U>execute "noautocmd '<,'>norm! " . v:count1 . "@" . getcharstr()<cr> +]]) + +-- Stop annoying auto commenting on new lines +vim.cmd([[ + augroup annoying + au! + au BufEnter * set fo-=c fo-=r fo-=o + augroup end +]]) + -- Cursorline vim.cmd([[ " Only show cursorline in the current window and in normal mode augroup cline @@ -262,7 +280,7 @@ vim.cmd([[ " Only show cursorline in the augroup END ]]) vim.opt.cursorline = true -- -vim.opt.guicursor = "i:ver100,r:hor100" -- +vim.opt.guicursor = 'i:ver100,r:hor100' -- -- Trailing whitespace vim.cmd([[ " Only show in insert mode |
