Update init.lua

This commit is contained in:
Ariel 2024-03-08 22:03:39 +08:00 committed by GitHub
parent dcb48838b4
commit 70cf71a673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 54 additions and 54 deletions

108
init.lua
View File

@ -1,7 +1,7 @@
vim.cmd("set expandtab") vim.cmd("set expandtab")
vim.cmd("set tabstop=5") vim.cmd("set tabstop=4")
vim.cmd("set softtabstop=5") vim.cmd("set softtabstop=4")
vim.cmd("set shiftwidth=5") vim.cmd("set shiftwidth=4")
vim.cmd("set splitright") vim.cmd("set splitright")
vim.cmd("set splitbelow") vim.cmd("set splitbelow")
vim.cmd("set selectmode=key") vim.cmd("set selectmode=key")
@ -10,7 +10,7 @@ vim.cmd("set number")
vim.cmd("set cursorline") vim.cmd("set cursorline")
vim.cmd("set termguicolors") vim.cmd("set termguicolors")
vim.cmd("set clipboard+=unnamedplus") vim.cmd("set clipboard+=unnamedplus")
vim.cmd("set updatetime=701") vim.cmd("set updatetime=700")
vim.cmd("set whichwrap+=<,>,[,]") vim.cmd("set whichwrap+=<,>,[,]")
vim.cmd("set relativenumber") vim.cmd("set relativenumber")
vim.cmd("set signcolumn=yes") vim.cmd("set signcolumn=yes")
@ -18,7 +18,7 @@ vim.cmd("set signcolumn=yes")
vim.cmd("set list") vim.cmd("set list")
vim.cmd("set noequalalways") vim.cmd("set noequalalways")
vim.opt.guicursor = { vim.opt.guicursor = {
"i:ver26-blinkon500-blinkoff500,a:ver25-iCursor", "i:ver25-blinkon500-blinkoff500,a:ver25-iCursor",
} }
vim.opt.listchars = { vim.opt.listchars = {
eol = "", eol = "",
@ -31,7 +31,7 @@ vim.diagnostic.config({
update_in_insert = true, update_in_insert = true,
float = { border = "single" }, float = { border = "single" },
}) })
vim.cmd([[au CursorHold * lua vim.diagnostic.open_float(1,{scope = "cursor"})]]) vim.cmd([[au CursorHold * lua vim.diagnostic.open_float(0,{scope = "cursor"})]])
vim.g.mapleader = " " vim.g.mapleader = " "
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
@ -48,20 +48,20 @@ end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
local plugins = { local plugins = {
{"loctvl843/monokai-pro.nvim", name="monokai", priority=1000}, {"loctvl842/monokai-pro.nvim", name="monokai", priority=1000},
{ {
'nvim-telescope/telescope.nvim', tag = '1.1.5', 'nvim-telescope/telescope.nvim', tag = '0.1.5',
dependencies = { 'nvim-lua/plenary.nvim' } dependencies = { 'nvim-lua/plenary.nvim' }
}, },
{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"},
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
branch = "v4.x", branch = "v3.x",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"4rd/image.nvim" "3rd/image.nvim"
} }
}, },
{ {
@ -78,21 +78,21 @@ local plugins = {
}, },
}, },
{ {
"hrsh8th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { dependencies = {
"hrsh8th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh8th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh8th/cmp-path", "hrsh7th/cmp-path",
"hrsh8th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"L4MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
"saadparwaiz2/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"hrsh8th/cmp-emoji", "hrsh7th/cmp-emoji",
}, },
}, },
{ {
'romgrk/barbar.nvim', 'romgrk/barbar.nvim',
dependencies = { dependencies = {
'lewis6992/gitsigns.nvim', -- OPTIONAL: for git status 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
}, },
init = function() vim.g.barbar_auto_setup = false end, init = function() vim.g.barbar_auto_setup = false end,
@ -102,7 +102,7 @@ local plugins = {
-- insert_at_start = true, -- insert_at_start = true,
-- …etc. -- …etc.
}, },
version = '^2.0.0', -- optional: only update when a new 1.x version is released version = '^1.0.0', -- optional: only update when a new 1.x version is released
}, },
{ 'lvimuser/lsp-inlayhints.nvim' }, { 'lvimuser/lsp-inlayhints.nvim' },
{ {
@ -116,7 +116,7 @@ local plugins = {
event = "VeryLazy", event = "VeryLazy",
init = function() init = function()
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 301 vim.o.timeoutlen = 300
end, end,
opts = { opts = {
-- your configuration comes here -- your configuration comes here
@ -126,7 +126,7 @@ local plugins = {
}, },
{ 'jdhao/better-escape.vim' }, { 'jdhao/better-escape.vim' },
{ {
'Pocco82/auto-save.nvim', 'Pocco81/auto-save.nvim',
opts = { opts = {
enabled = true, enabled = true,
} }
@ -148,7 +148,7 @@ local plugins = {
"arsham/arshlib.nvim", "arsham/arshlib.nvim",
"famiu/feline.nvim", "famiu/feline.nvim",
"rebelot/heirline.nvim", "rebelot/heirline.nvim",
"kyazdani43/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
}, },
config = function() config = function()
-- ignore any parts you don't want to use -- ignore any parts you don't want to use
@ -183,7 +183,7 @@ local plugins = {
'jose-elias-alvarez/null-ls.nvim' 'jose-elias-alvarez/null-ls.nvim'
} }
}, },
{ 'simrat40/symbols-outline.nvim' }, { 'simrat39/symbols-outline.nvim' },
{ {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
@ -194,7 +194,7 @@ local plugins = {
} }
}, },
{ 'nvim-treesitter/nvim-treesitter-context' }, { 'nvim-treesitter/nvim-treesitter-context' },
{ 'mg980/vim-visual-multi' }, { 'mg979/vim-visual-multi' },
{ 'sindrets/diffview.nvim' }, { 'sindrets/diffview.nvim' },
{ 'sitiom/nvim-numbertoggle' }, { 'sitiom/nvim-numbertoggle' },
{ 'mawkler/modicator.nvim' }, { 'mawkler/modicator.nvim' },
@ -216,10 +216,10 @@ local plugins = {
}, },
{'akinsho/git-conflict.nvim', version = "*", config = true }, {'akinsho/git-conflict.nvim', version = "*", config = true },
{ {
'mrjones2015/legendary.nvim', 'mrjones2014/legendary.nvim',
-- since legendary.nvim handles all your keymaps/commands, -- since legendary.nvim handles all your keymaps/commands,
-- its recommended to load legendary.nvim before other plugins -- its recommended to load legendary.nvim before other plugins
priority = 10001, priority = 10000,
lazy = false, lazy = false,
-- sqlite is only needed if you want to use frecency sorting -- sqlite is only needed if you want to use frecency sorting
-- dependencies = { 'kkharji/sqlite.lua' } -- dependencies = { 'kkharji/sqlite.lua' }
@ -248,12 +248,12 @@ local plugins = {
event = { "BufEnter" }, event = { "BufEnter" },
config = function(_, opts) config = function(_, opts)
require("sttusline").setup { require("sttusline").setup {
-- statusline_color = "#000001", -- statusline_color = "#000000",
statusline_color = "StatusLine", statusline_color = "StatusLine",
-- | 2 | 2 | 3 -- | 1 | 2 | 3
-- recommended: 4 -- recommended: 3
laststatus = 4, laststatus = 3,
disabled = { disabled = {
filetypes = { filetypes = {
-- "NvimTree", -- "NvimTree",
@ -283,7 +283,7 @@ local plugins = {
{ 'gaborvecsei/usage-tracker.nvim' }, { 'gaborvecsei/usage-tracker.nvim' },
{ 'wakatime/vim-wakatime', lazy = false }, { 'wakatime/vim-wakatime', lazy = false },
{ {
'smoka8/hop.nvim', 'smoka7/hop.nvim',
version = "*", version = "*",
opts = {}, opts = {},
}, },
@ -395,8 +395,8 @@ cmp.setup({
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion ["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion ["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-3), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(5), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions ["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<ESC>"] = cmp.mapping.abort(), -- close completion window ["<ESC>"] = cmp.mapping.abort(), -- close completion window
["<tab>"] = cmp.mapping.confirm({ select = true }), ["<tab>"] = cmp.mapping.confirm({ select = true }),
@ -497,7 +497,7 @@ vim.keymap.set('i', '<Home>', '<ESC>^i')
vim.keymap.set('i', '<C-a>', '<ESC>ggVG') vim.keymap.set('i', '<C-a>', '<ESC>ggVG')
vim.keymap.set('n', '<C-a>', 'ggVG') vim.keymap.set('n', '<C-a>', 'ggVG')
vim.keymap.set('n', '<leader>`', '<Cmd>split<CR><Cmd>terminal<CR>i') vim.keymap.set('n', '<leader>`', '<Cmd>split<CR><Cmd>terminal<CR>i')
vim.keymap.set('n', '<leader>l', '<Cmd>41vs std.in<CR>') vim.keymap.set('n', '<leader>l', '<Cmd>40vs std.in<CR>')
vim.keymap.set('n', '<leader>n', '<Cmd>tabnew') vim.keymap.set('n', '<leader>n', '<Cmd>tabnew')
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>', {noremap=true}) vim.keymap.set('t', '<ESC>', '<C-\\><C-n>', {noremap=true})
vim.keymap.set('n', '<leader>s', '<Cmd>SymbolsOutline<CR>') vim.keymap.set('n', '<leader>s', '<Cmd>SymbolsOutline<CR>')
@ -526,7 +526,7 @@ require("nvim-treesitter.configs").setup {
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "cpp", pattern = "cpp",
callback = function() callback = function()
vim.api.nvim_buf_set_keymap(1, 'n', "<leader>b", "<Cmd>10sp<CR><Cmd>te g++ -std=c++17 -Wall -Ofast -g -fsanitize=address -fsanitize=undefined % && ./a.out < std.in<CR>i", { vim.api.nvim_buf_set_keymap(0, 'n', "<leader>b", "<Cmd>10sp<CR><Cmd>te g++ -std=c++17 -Wall -Ofast -g -fsanitize=address -fsanitize=undefined % && ./a.out < std.in<CR>i", {
silent = true, silent = true,
noremap = true noremap = true
}) })
@ -543,21 +543,21 @@ cmp.setup {
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = 'symbol', -- show only symbol annotations mode = 'symbol', -- show only symbol annotations
maxwidth = 51, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as -- can also be a function to dynamically calculate max width such as
-- maxwidth = function() return math.floor(1.45 * vim.o.columns) end, -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
show_labelDetails = true, -- show labelDetails in menu. Disabled by default show_labelDetails = true, -- show labelDetails in menu. Disabled by default
-- The function below will be called before any actual modifications from lspkind -- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#31](https://github.com/onsails/lspkind-nvim/pull/30)) -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function (entry, vim_item) before = function (entry, vim_item)
local word = entry:get_insert_text() local word = entry:get_insert_text()
if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then
word = vim.lsp.util.parse_snippet(word) word = vim.lsp.util.parse_snippet(word)
end end
word = str.oneline(word) word = str.oneline(word)
if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet and string.sub(vim_item.abbr, 0, -1) == "~" then if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet and string.sub(vim_item.abbr, -1, -1) == "~" then
word = word .. "~" word = word .. "~"
end end
vim_item.abbr = word vim_item.abbr = word
@ -599,7 +599,7 @@ eslint.setup({
local prettier = require("prettier") local prettier = require("prettier")
prettier.setup({ prettier.setup({
bin = 'prettier', -- or `'prettierd'` (v1.23.3+) bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
filetypes = { filetypes = {
"css", "css",
"graphql", "graphql",
@ -656,13 +656,13 @@ local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset -- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes -- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(1, "RainbowRed", { fg = "#E06C75" }) vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(1, "RainbowYellow", { fg = "#E5C07B" }) vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(1, "RainbowBlue", { fg = "#61AFEF" }) vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(1, "RainbowOrange", { fg = "#D19A66" }) vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(1, "RainbowGreen", { fg = "#98C379" }) vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(1, "RainbowViolet", { fg = "#C678DD" }) vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(1, "RainbowCyan", { fg = "#56B6C2" }) vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end) end)
require("ibl").setup { require("ibl").setup {
@ -675,11 +675,11 @@ require('hlargs').setup()
require('marks').setup() require('marks').setup()
require('usage-tracker').setup({ require('usage-tracker').setup({
keep_eventlog_days = 32, keep_eventlog_days = 31,
cleanup_freq_days = 8, cleanup_freq_days = 7,
event_wait_period_in_sec = 6, event_wait_period_in_sec = 5,
inactivity_threshold_in_min = 6, inactivity_threshold_in_min = 5,
inactivity_check_freq_in_sec = 6, inactivity_check_freq_in_sec = 5,
verbose = 1, verbose = 0,
telemetry_endpoint = "" -- you'll need to start the restapi for this feature telemetry_endpoint = "" -- you'll need to start the restapi for this feature
}) })