78 lines
2.3 KiB
Lua
78 lines
2.3 KiB
Lua
-- 文件编码
|
||
vim.g.encoding = "UTF-8"
|
||
vim.o.fileencoding = "utf-8"
|
||
-- 高亮所在行
|
||
vim.wo.cursorline = true
|
||
-- 显示左侧图标指示列
|
||
vim.wo.signcolumn = "yes"
|
||
-- 右侧参考线,超过表示代码太长了,考虑换行
|
||
vim.wo.colorcolumn = "120"
|
||
-- 缩进2个空格等于一个Tab
|
||
vim.opt.tabstop = 4
|
||
vim.opt.shiftwidth = 4
|
||
vim.opt.expandtab = true
|
||
vim.opt.autoindent = true
|
||
-- 新行对齐当前行
|
||
vim.o.autoindent = true
|
||
vim.bo.autoindent = true
|
||
vim.o.smartindent = true
|
||
-- 搜索大小写不敏感,除非包含大写
|
||
vim.o.ignorecase = true
|
||
vim.o.smartcase = true
|
||
-- 搜索不要高亮
|
||
vim.o.hlsearch = false
|
||
-- 边输入边搜索
|
||
vim.o.incsearch = true
|
||
-- 命令行高为2,提供足够的显示空间
|
||
vim.o.cmdheight = 1
|
||
-- 当文件被外部程序修改时,自动加载
|
||
vim.o.autoread = true
|
||
vim.bo.autoread = true
|
||
-- 禁止折行
|
||
vim.wo.wrap = true
|
||
-- 光标在行首尾时<Left><Right>可以跳到下一行
|
||
vim.o.whichwrap = "<,>,[,]"
|
||
-- 允许隐藏被修改过的buffer
|
||
vim.o.hidden = true
|
||
-- 鼠标支持
|
||
vim.o.mouse = "a"
|
||
-- smaller updatetime
|
||
vim.o.updatetime = 3000
|
||
-- 设置 timeoutlen 为等待键盘快捷键连击时间500毫秒,可根据需要设置
|
||
-- 遇到问题详见:https://github.com/nshen/learn-neovim-lua/issues/1
|
||
vim.o.timeoutlen = 1000
|
||
-- split window 从下边和右边出现
|
||
vim.o.splitbelow = true
|
||
vim.o.splitright = true
|
||
-- 自动补全不自动选中
|
||
vim.g.completeopt = "menu,menuone,noselect,noinsert"
|
||
-- 是否显示不可见字符
|
||
vim.o.list = false
|
||
-- 不可见字符的显示,这里只把空格显示为一个点
|
||
vim.o.listchars = "space:·,tab:··"
|
||
-- 补全增强
|
||
vim.o.wildmenu = true
|
||
-- Dont' pass messages to |ins-completin menu|
|
||
vim.o.shortmess = vim.o.shortmess .. "c"
|
||
-- 补全最多显示10行
|
||
vim.o.pumheight = 20
|
||
-- 配置剪切板
|
||
vim.opt.clipboard = "unnamedplus"
|
||
vim.opt.backup = false
|
||
vim.opt.swapfile = false
|
||
vim.opt.writebackup = false
|
||
vim.opt.undofile = true
|
||
-- 换行符号
|
||
vim.opt.list = true
|
||
vim.opt.listchars:append "space:⋅"
|
||
vim.opt.listchars:append "eol:↴"
|
||
-- 文件树配置
|
||
vim.g.loaded_netrw = 1
|
||
vim.g.loaded_netrwPlugin = 1
|
||
-- 开启 Folding
|
||
vim.wo.foldmethod = "expr"
|
||
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
|
||
-- 默认不要折叠
|
||
-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file
|
||
vim.wo.foldlevel = 99
|