[change] new setting

pull/94/head
smith.hu 2023-09-23 10:25:18 +08:00
parent cd1bd5a5c2
commit 2ee662eecf
3 changed files with 106 additions and 49 deletions

View File

@ -1,3 +1,21 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
-- autocmds.lua
local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
-- Remove whitespace on save
--autocmd('BufWritePre', {
-- pattern = '',
-- command = ":%s/\\s\\+$//e"
--})
-- Don't auto commenting new lines
autocmd('BufEnter', {
pattern = '',
command = 'set fo-=c fo-=r fo-=o'
})

View File

@ -2,54 +2,92 @@
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options hereby
local opt = vim.opt
-----------------------------------------------------------
-- General Neovim settings and configuration
-----------------------------------------------------------
opt.autowrite = false -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect"
opt.conceallevel = 3 -- Hide * markup for bold and italic
opt.confirm = true -- Confirm to save changes before exiting modified buffer
opt.cursorline = true -- Enable highlighting of the current line
-- Default options are not included
-- See: https://neovim.io/doc/user/vim_diff.html
-- [2] Defaults - *nvim-defaults*
local g = vim.g -- Global variables
local opt = vim.opt -- Set options (global/buffer/windows-scoped)
-----------------------------------------------------------
-- General
-----------------------------------------------------------
opt.mouse = 'a' -- Enable mouse support
opt.clipboard = 'unnamedplus' -- Copy/paste to system clipboard
opt.swapfile = false -- Don't use swapfile
opt.completeopt = 'menuone,noinsert,noselect' -- Autocomplete options
-----------------------------------------------------------
-- Neovim UI
-----------------------------------------------------------
--opt.number = true -- Show line number
--opt.showmatch = true -- Highlight matching parenthesis
--opt.foldmethod = 'marker' -- Enable folding (default 'foldmarker')
--opt.colorcolumn = '80' -- Line lenght marker at 80 columns
--opt.splitright = true -- Vertical split to the right
--opt.splitbelow = true -- Horizontal split to the bottom
--opt.ignorecase = true -- Ignore case letters when search
--opt.smartcase = true -- Ignore lowercase for the whole pattern
--opt.linebreak = true -- Wrap on word boundary
--opt.termguicolors = true -- Enable 24-bit RGB colors
--opt.laststatus=3 -- Set global statusline
-----------------------------------------------------------
-- Tabs, indent
-----------------------------------------------------------
opt.expandtab = true -- Use spaces instead of tabs
opt.formatoptions = "jcroqlnt" -- tcqj
opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep"
opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute
opt.laststatus = 0
opt.list = true -- Show some invisible characters (tabs...
opt.mouse = "a" -- Enable mouse mode
opt.number = true -- Print line number
opt.pumblend = 10 -- Popup blend
opt.pumheight = 10 -- Maximum number of entries in a popup
opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 4 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append({ W = true, I = true, c = true })
opt.showmode = false -- Dont show mode since we have a statusline
opt.sidescrolloff = 8 -- Columns of context
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
opt.smartcase = true -- Don't ignore case with capitals
opt.smartindent = true -- Insert indents automatically
opt.spelllang = { "en" }
opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support
opt.timeoutlen = 300
opt.undofile = true
opt.undolevels = 10000
opt.updatetime = 200 -- Save swap file and trigger CursorHold
opt.wildmode = "longest:full,full" -- Command-line completion mode
opt.winminwidth = 5 -- Minimum window width
opt.wrap = false -- Disable line wrap
opt.shiftwidth = 4 -- Shift 4 spaces when tab
opt.tabstop = 4 -- 1 tab == 4 spaces
opt.smartindent = true -- Autoindent new lines
if vim.fn.has("nvim-0.9.0") == 1 then
opt.splitkeep = "screen"
opt.shortmess:append({ C = true })
-----------------------------------------------------------
-- Memory, CPU
-----------------------------------------------------------
opt.hidden = true -- Enable background buffers
opt.history = 100 -- Remember N lines in history
opt.lazyredraw = true -- Faster scrolling
opt.synmaxcol = 240 -- Max column for syntax highlight
opt.updatetime = 250 -- ms to wait for trigger an event
-----------------------------------------------------------
-- Startup
-----------------------------------------------------------
-- Disable nvim intro
opt.shortmess:append "sI"
-- -- Disable builtin plugins
local disabled_built_ins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
}
for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1
end
-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0

View File

@ -2,12 +2,13 @@ return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
{ "catppuccin/nvim" },
{ "folke/tokyonight.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "catppuccin",
colorscheme = "habamax",
},
},
}