chore: add configs

Signed-off-by: d0zingcat <iamtangli42@gmail.com>
This commit is contained in:
2025-05-09 15:16:20 +08:00
parent 5f16b96c55
commit f5ab6eee24
9 changed files with 237 additions and 51 deletions

View File

@@ -41,6 +41,7 @@ bind l select-pane -R
# rename session/window
bind n command-prompt 'rename-window %%'
bind N command-prompt 'rename-session %%'
bind S command-prompt -p "New Session:" "new-session -A -s '%%'"
# switch window
bind-key , previous-window # <

View File

@@ -1,52 +1,3 @@
if vim.fn.has('nvim') == 0 then
return
end
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.o.termguicolors = true
vim.g.mapleader = ' ' -- Make sure to set `mapleader` before lazy so your mappings are correct
vim.g.maplocalleader = '\\' -- Same for `maplocalleader`
vim.o.encoding = 'utf-8'
vim.o.fileencoding = 'utf-8'
vim.o.fencs = 'utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936'
vim.o.hidden = true
vim.o.wildmenu = true
vim.o.hlsearch = true
vim.o.incsearch = true
vim.o.matchtime = 1
vim.o.showmatch = true
vim.o.updatetime = 100
vim.o.ignorecase = true
vim.o.smarttab = true
vim.o.expandtab = true
vim.o.laststatus = 2
vim.o.showcmd = true
vim.o.ruler = true
vim.o.history = 300
vim.o.backup = false
vim.o.swapfile = false
vim.o.foldenable = false
vim.o.autoread = true
vim.o.autowrite = true
vim.o.mouse = 'a'
vim.o.number = true
vim.o.cursorline = true
vim.o.relativenumber = true
vim.o.cursorcolumn = true
vim.o.signcolumn = 'auto:1'
-- vim.o.cmdheight = 0
vim.opt.list = true
vim.opt.listchars:append('eol:↴')
vim.opt.fillchars:append { diff = '' }
vim.o.textwidth = 120
vim.o.smartindent = true
vim.o.autoindent = true
vim.o.cindent = true
vim.o.shiftwidth = 4
vim.o.softtabstop = 4
vim.o.tabstop = 4

View File

@@ -30,5 +30,6 @@
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
"vim-wakatime": { "branch": "master", "commit": "e46d7c4f98ee0f40782008dd60cb2a79c377fb1d" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View File

@@ -6,3 +6,159 @@
--
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
vim.cmd('filetype plugin indent on')
-- Create a group for our autocommands
local augroup = vim.api.nvim_create_augroup("CustomSettings", { clear = true })
-- FileType autocommands
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
group = augroup,
callback = function()
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.softtabstop = 4
vim.opt_local.textwidth = 120
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "go",
group = augroup,
callback = function()
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.softtabstop = 4
vim.opt_local.textwidth = 120
vim.opt_local.expandtab = false
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "json", "jsonnet" },
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.expandtab = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "yaml",
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 0
vim.opt_local.expandtab = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "gotmpl",
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 0
vim.opt_local.expandtab = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "php",
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 120
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "html", "htmldjango", "xhtml", "haml" },
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 0
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "ruby",
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 120
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "less", "sass", "scss", "css" },
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 120
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "javascript", "javascript.jsx", "javascriptreact", "typescript", "typescriptreact" },
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.expandtab = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "NvimTree",
group = augroup,
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.textwidth = 0
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "make",
group = augroup,
callback = function()
vim.opt_local.expandtab = false
vim.opt_local.shiftwidth = 8
vim.opt_local.softtabstop = 0
end,
})
-- File pattern autocommands
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = "*.proto",
group = augroup,
command = "setfiletype proto",
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "proto",
group = augroup,
callback = function()
vim.opt_local.shiftwidth = 2
vim.opt_local.expandtab = true
end,
})

View File

@@ -1,3 +1,55 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local opt = vim.opt
local o = vim.o
local g = vim.g
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
o.termguicolors = true
g.mapleader = ' ' -- Make sure to set `mapleader` before lazy so your mappings are correct
g.maplocalleader = '\\' -- Same for `maplocalleader`
o.encoding = 'utf-8'
o.fileencoding = 'utf-8'
o.fencs = 'utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936'
o.hidden = true
o.wildmenu = true
o.hlsearch = true
o.incsearch = true
o.matchtime = 1
o.showmatch = true
o.updatetime = 100
o.ignorecase = true
o.smarttab = true
o.expandtab = true
o.laststatus = 2
o.showcmd = true
o.ruler = true
o.history = 300
o.backup = false
o.swapfile = false
o.foldenable = false
o.autoread = true
o.autowrite = true
o.mouse = 'a'
o.number = true
o.cursorline = true
o.relativenumber = true
o.cursorcolumn = true
o.signcolumn = 'auto:1'
-- o.cmdheight = 0
opt.list = true
opt.listchars:append('eol:↴')
opt.fillchars:append { diff = '' }
o.textwidth = 120
o.smartindent = true
o.autoindent = true
o.cindent = true
o.shiftwidth = 4
o.softtabstop = 4
o.tabstop = 4

View File

@@ -0,0 +1,3 @@
return {
-- disable the plugins
}

18
nvim/lua/plugins/lsp.lua Normal file
View File

@@ -0,0 +1,18 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"bash-language-server",
"shfmt",
"shellcheck",
"emmet-ls",
"eslint_d",
"pyright",
"html-lsp",
"prettier",
"autopep8",
"stylua",
"gopls",
},
},
}

View File

@@ -0,0 +1,4 @@
return {
"wakatime/vim-wakatime",
event = "InsertEnter",
}

View File

@@ -1,10 +1,10 @@
local wezterm = require("wezterm")
return {
default_cwd = wezterm.home_dir .. "/work",
default_cwd = wezterm.home_dir .. "/Workbench",
font_size = 14,
font = wezterm.font_with_fallback({
"Maple Mono NF CN",
"JetBrainsMono Nerd Font",
"Maple Mono NF CN",
}),
colors = {
tab_bar = {