diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 31141c67..80223ad1 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -2,7 +2,7 @@ vim.g.mapleader = " " vim.g.maplocalleader = "\\" --- Enable LazyVim auto format +-- LazyVim auto format vim.g.autoformat = true -- LazyVim root dir detection @@ -28,18 +28,24 @@ vim.g.lazygit_config = true local opt = vim.opt opt.autowrite = true -- Enable auto write - -if not vim.env.SSH_TTY then - -- only set clipboard if not in ssh, to make sure the OSC 52 - -- integration works automatically. Requires Neovim >= 0.10.0 - opt.clipboard = "unnamedplus" -- Sync with system clipboard -end - +-- only set clipboard if not in ssh, to make sure the OSC 52 +-- integration works automatically. Requires Neovim >= 0.10.0 +opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.cursorline = true -- Enable highlighting of the current line opt.expandtab = true -- Use spaces instead of tabs +opt.fillchars = { + foldopen = "", + foldclose = "", + fold = " ", + foldsep = " ", + diff = "╱", + eob = " ", +} +opt.foldlevel = 99 +opt.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" @@ -66,11 +72,10 @@ opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current +opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support -if not vim.g.vscode then - opt.timeoutlen = 300 -- Lower than default (1000) to quickly trigger which-key -end +opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key opt.undofile = true opt.undolevels = 10000 opt.updatetime = 200 -- Save swap file and trigger CursorHold @@ -78,38 +83,16 @@ opt.virtualedit = "block" -- Allow cursor to move where there is no text in visu opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -opt.fillchars = { - foldopen = "", - foldclose = "", - fold = " ", - foldsep = " ", - diff = "╱", - eob = " ", -} if vim.fn.has("nvim-0.10") == 1 then opt.smoothscroll = true -end - --- Folding -opt.foldlevel = 99 - -if vim.fn.has("nvim-0.9.0") == 1 then - opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] + opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" + opt.foldmethod = "expr" + opt.foldtext = "" +else + opt.foldmethod = "indent" opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" end --- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now -if vim.fn.has("nvim-0.10") == 1 then - opt.foldmethod = "expr" - opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" - opt.foldtext = "" - opt.fillchars = "fold: " -else - opt.foldmethod = "indent" -end - -vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" - -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0