mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-18 08:18:32 +02:00
refactor(options): refactored options
This commit is contained in:
parent
183d6eea60
commit
2391ac0420
1 changed files with 21 additions and 38 deletions
|
@ -2,7 +2,7 @@
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = "\\"
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
-- Enable LazyVim auto format
|
-- LazyVim auto format
|
||||||
vim.g.autoformat = true
|
vim.g.autoformat = true
|
||||||
|
|
||||||
-- LazyVim root dir detection
|
-- LazyVim root dir detection
|
||||||
|
@ -28,18 +28,24 @@ vim.g.lazygit_config = true
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
opt.autowrite = true -- Enable auto write
|
opt.autowrite = true -- Enable auto write
|
||||||
|
-- only set clipboard if not in ssh, to make sure the OSC 52
|
||||||
if not vim.env.SSH_TTY then
|
-- integration works automatically. Requires Neovim >= 0.10.0
|
||||||
-- only set clipboard if not in ssh, to make sure the OSC 52
|
opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard
|
||||||
-- integration works automatically. Requires Neovim >= 0.10.0
|
|
||||||
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
|
||||||
end
|
|
||||||
|
|
||||||
opt.completeopt = "menu,menuone,noselect"
|
opt.completeopt = "menu,menuone,noselect"
|
||||||
opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions
|
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.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||||
opt.cursorline = true -- Enable highlighting of the current line
|
opt.cursorline = true -- Enable highlighting of the current line
|
||||||
opt.expandtab = true -- Use spaces instead of tabs
|
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.formatoptions = "jcroqlnt" -- tcqj
|
||||||
opt.grepformat = "%f:%l:%c:%m"
|
opt.grepformat = "%f:%l:%c:%m"
|
||||||
opt.grepprg = "rg --vimgrep"
|
opt.grepprg = "rg --vimgrep"
|
||||||
|
@ -66,11 +72,10 @@ opt.spelllang = { "en" }
|
||||||
opt.splitbelow = true -- Put new windows below current
|
opt.splitbelow = true -- Put new windows below current
|
||||||
opt.splitkeep = "screen"
|
opt.splitkeep = "screen"
|
||||||
opt.splitright = true -- Put new windows right of current
|
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.tabstop = 2 -- Number of spaces tabs count for
|
||||||
opt.termguicolors = true -- True color support
|
opt.termguicolors = true -- True color support
|
||||||
if not vim.g.vscode then
|
opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key
|
||||||
opt.timeoutlen = 300 -- Lower than default (1000) to quickly trigger which-key
|
|
||||||
end
|
|
||||||
opt.undofile = true
|
opt.undofile = true
|
||||||
opt.undolevels = 10000
|
opt.undolevels = 10000
|
||||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
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.wildmode = "longest:full,full" -- Command-line completion mode
|
||||||
opt.winminwidth = 5 -- Minimum window width
|
opt.winminwidth = 5 -- Minimum window width
|
||||||
opt.wrap = false -- Disable line wrap
|
opt.wrap = false -- Disable line wrap
|
||||||
opt.fillchars = {
|
|
||||||
foldopen = "",
|
|
||||||
foldclose = "",
|
|
||||||
fold = " ",
|
|
||||||
foldsep = " ",
|
|
||||||
diff = "╱",
|
|
||||||
eob = " ",
|
|
||||||
}
|
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.10") == 1 then
|
if vim.fn.has("nvim-0.10") == 1 then
|
||||||
opt.smoothscroll = true
|
opt.smoothscroll = true
|
||||||
end
|
opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
|
||||||
|
opt.foldmethod = "expr"
|
||||||
-- Folding
|
opt.foldtext = ""
|
||||||
opt.foldlevel = 99
|
else
|
||||||
|
opt.foldmethod = "indent"
|
||||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
|
||||||
opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]]
|
|
||||||
opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
|
opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
|
||||||
end
|
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
|
-- Fix markdown indentation settings
|
||||||
vim.g.markdown_recommended_style = 0
|
vim.g.markdown_recommended_style = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue