-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.lua
More file actions
103 lines (93 loc) · 5.17 KB
/
Copy pathoptions.lua
File metadata and controls
103 lines (93 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---@type table<string, any>
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 2, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
fileencodings = "utf-8,gb18030,gbk,gb2312,utf-16le,utf-16be", -- the encoding written to a file
encoding = "utf-8", -- set encdoing
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
mousemoveevent = true, -- enable mouse move event
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
updatetime = 300, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by :qanother program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = false, -- do not highlight the current line with native support
cursorcolumn = false, -- do not highlight the current column with native support
number = true, -- set numbered lines
relativenumber = true, -- set relative numbered lines
numberwidth = 2, -- set number column width to 2 {default 4}
incsearch = true, -- enable incremental search
laststatus = 2, -- always display statusline
listchars = "tab:» ,nbsp:", -- show tabs with special icon
background = "dark", -- dark background
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = true, -- display lines as one long line
linebreak = true, -- companion to wrap, don't split words
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor
sidescrolloff = 8, -- minimal number of screen columns either side of cursor if wrap is `false`
whichwrap = "bs<>[]hl", -- which "horizontal" keys are allowed to travel to prev/next line
foldcolumn = "auto:9", -- The width of a colum on the side of the window to indicate folds
foldlevel = 99, -- The higher the more folder regions are open
foldlevelstart = 99, -- Avoid auto fold
foldenable = true, -- Default not fold any thing
fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]], -- Set for foldcolumn
sessionoptions = "blank,buffers,curdir,folds,globals,help,tabpages,winsize,winpos,terminal,localoptions", -- Session save options
textwidth = 512, -- Default text width
spellfile = vim.fn.stdpath "config" .. "/spell/en.utf-8.add", -- Spell file
title = true, -- Always print title
display = "lastline", -- show partial wrapped lines instead of filling them with @
titlestring = "Neovim @ [cwd: " .. vim.fn.getcwd() .. "]", -- Default print current directory
-- jumpoptions = "stack", -- make jump stack
}
local old_isfname = vim.o.isfname
if require("util.os").is_windows() then
-- NOTE: Make spellfile could contain ":"
vim.o.isfname = vim.o.isfname .. ",:"
end
for k, v in pairs(options) do
vim.opt[k] = v
end
if require("util.os").is_windows() then
-- NOTE: Restore it
-- vim.o.isfname = old_isfname
end
-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess'
-- Options that use :append/:remove must stay outside the table
vim.opt.shortmess:append "c" -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append "-" -- hyphenated words recognized by searches
vim.opt.fillchars:append "lastline:…" -- show … instead of @@@ for truncated lines
vim.opt.formatoptions:remove { "c", "r", "o" } -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
vim.opt.runtimepath:remove "/usr/share/vim/vimfiles" -- separate vim plugins from neovim in case vim still in use
vim.opt.sessionoptions = options.sessionoptions
vim.loader.enable() -- Enables the experimental Lua module loader
-- client related configure
if require("util.client").is_neovide() then
require("user.neovide").setup()
elseif require("util.client").is_goneovim() then
require("user.goneovim").setup()
end
-- other options
vim.g.rust_recommended_style = 0
-- wo related options
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- clipboard related configuration
if require("util.client").is_ssh() then
vim.g.clipboard = "osc52"
end