feat: add base config
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
{{- $email := promptStringOnce . "email" "Git Email address" -}}
|
||||
{{- $email := get . "email" -}}
|
||||
{{- if not $email -}}
|
||||
{{- $input1 = promptStringOnce . "email" "Your email address" -}}
|
||||
{{- $input2 = promptStringOnce . "email" "Confirm your email address" -}}
|
||||
{{- if ne $input1 $input2 -}}
|
||||
{{- fail "Error: email is mismatch, Please reinit chezmoi" -}}
|
||||
{{- end -}}
|
||||
{{- $email = $input1 -}}
|
||||
{{- end -}}
|
||||
|
||||
[data]
|
||||
email = {{ $email | quote }}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
[user]
|
||||
name = tqcq
|
||||
email = {{ .noreply_email | quote }}
|
||||
name = tqcq
|
||||
email = {{ .email | quote }}
|
||||
[init]
|
||||
defaultBranch = master
|
||||
defaultBranch = master
|
||||
[core]
|
||||
compression = 9
|
||||
looseCompression = 9
|
||||
editor = nvim
|
||||
eol = lf
|
||||
pager = delta
|
||||
hooksPath = .git/hooks
|
||||
compression = 9
|
||||
looseCompression = 9
|
||||
editor = nvim
|
||||
eol = lf
|
||||
pager = delta
|
||||
hooksPath = .git/hooks
|
||||
[pack]
|
||||
compression = 9
|
||||
compression = 9
|
||||
[pull]
|
||||
rebase = true
|
||||
rebase = true
|
||||
[lfs]
|
||||
locksverify = false
|
||||
locksverify = false
|
||||
[credential]
|
||||
helper = store
|
||||
helper = store
|
||||
[gpg]
|
||||
program = /usr/sbin/gpg
|
||||
program = /usr/sbin/gpg
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
diffFilter = delta --color-only
|
||||
[delta]
|
||||
navigate = true
|
||||
navigate = true
|
||||
dark = true
|
||||
line-numbers = true
|
||||
side-by-side = true
|
||||
[merge]
|
||||
conflictStyle = zdiff3
|
||||
conflictStyle = zdiff3
|
||||
[color]
|
||||
ui = auto
|
||||
ui = auto
|
||||
[filter "lfs"]
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
|
||||
1719
dot_p10k.zsh
Normal file
1719
dot_p10k.zsh
Normal file
File diff suppressed because it is too large
Load Diff
107
dot_zshrc.tmpl
Normal file
107
dot_zshrc.tmpl
Normal file
@@ -0,0 +1,107 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your Oh My Zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time Oh My Zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="powerlevel10k/powerlevel10k"
|
||||
|
||||
# Set list of themes to pick from when loading at random
|
||||
# Setting this variable when ZSH_THEME=random will cause zsh to load
|
||||
# a theme from this variable instead of looking in $ZSH/themes/
|
||||
# If set to an empty array, this variable will have no effect.
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
# HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment one of the following lines to change the auto-update behavior
|
||||
# zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# zstyle ':omz:update' frequency 13
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# You can also set it to another string to have that shown instead of the default red dots.
|
||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# You can set one of the optional three formats:
|
||||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# or set a custom format using the strftime function format specifications,
|
||||
# see 'man strftime' for details.
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='nvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch $(uname -m)"
|
||||
|
||||
# Set personal aliases, overriding those provided by Oh My Zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
|
||||
# users are encouraged to define aliases within a top-level file in
|
||||
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
|
||||
# - $ZSH_CUSTOM/aliases.zsh
|
||||
# - $ZSH_CUSTOM/macos.zsh
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
20
private_dot_config/nvim/init.lua
Normal file
20
private_dot_config/nvim/init.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
require("config.options")
|
||||
require("config.keymaps")
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("plugins")
|
||||
23
private_dot_config/nvim/lazy-lock.json
Normal file
23
private_dot_config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "40dcec5555f960b0a04340d76eabdf4efe78599d" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "2163c54bb6cfec53e3e555665ada945b8c8331b9" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "a0db8bf7d6488b1dcd9cb5b0dfd6684a1e14f769" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
|
||||
}
|
||||
14
private_dot_config/nvim/lua/config/options.lua
Normal file
14
private_dot_config/nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local opt = vim.opt
|
||||
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.cursorline = true
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
43
private_dot_config/nvim/lua/plugins/cmp.lua
Normal file
43
private_dot_config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
}
|
||||
19
private_dot_config/nvim/lua/plugins/colorscheme.lua
Normal file
19
private_dot_config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("tokyonight").setup({
|
||||
style = "moon",
|
||||
transparent = true,
|
||||
styles = {
|
||||
comments = { italic = true },
|
||||
keywords = { italic = true },
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[colorscheme tokyonight]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
62
private_dot_config/nvim/lua/plugins/conform.lua
Normal file
62
private_dot_config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
cpp = { "clang-format" },
|
||||
c = { "clang-format" },
|
||||
go = { "goimports", "gofmt" },
|
||||
json = { "prettier" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
formatters = {
|
||||
["clang-format"] = {
|
||||
prepend_args = function(self, ctx)
|
||||
local local_config =
|
||||
vim.fs.find({ ".clang-format", "_clang-format" }, { path = ctx.dirname, upward = true })[1]
|
||||
if not local_config then
|
||||
return { "--style=file:" .. vim.fn.expand("~/.clang-format") }
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
stylua = {
|
||||
prepend_args = function(self, ctx)
|
||||
local local_config =
|
||||
vim.fs.find({ "stylua.toml", ".stylua.toml" }, { path = ctx.dirname, upward = true })[1]
|
||||
if not local_config then
|
||||
return { "--config-path", vim.fn.expand("~/.config/stylua/stylua.toml") }
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
prettier = {
|
||||
prepend_args = function(self, ctx)
|
||||
local local_config =
|
||||
vim.fs.find({ ".prettierrc", ".prettierrc.json" }, { path = ctx.dirname, upward = true })[1]
|
||||
if not local_config then
|
||||
return { "--config", vim.fn.expand("~/.prettierrc") }
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>gf", function()
|
||||
require("conform").format({
|
||||
lsp_fallback = true,
|
||||
timeout_ms = 500,
|
||||
})
|
||||
end, { silent = true })
|
||||
end,
|
||||
}
|
||||
48
private_dot_config/nvim/lua/plugins/gitsigns.lua
Normal file
48
private_dot_config/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "┆" },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map("n", "]h", function()
|
||||
if vim.wo.diff then
|
||||
return "]h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, silent = true })
|
||||
|
||||
map("n", "[h", function()
|
||||
if vim.wo.diff then
|
||||
return "[h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, silent = true })
|
||||
|
||||
map("n", "<leader>ph", gs.preview_hunk, { silent = true })
|
||||
map("n", "<leader>tb", gs.toggle_current_line_blame, { silent = true })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
112
private_dot_config/nvim/lua/plugins/lspconfig.lua
Normal file
112
private_dot_config/nvim/lua/plugins/lspconfig.lua
Normal file
@@ -0,0 +1,112 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"williamboman/mason.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "always" },
|
||||
})
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, silent = true }
|
||||
local telescope_builtin = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gd", telescope_builtin.lsp_definitions, opts)
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gi", telescope_builtin.lsp_implementations, opts)
|
||||
vim.keymap.set("n", "gr", telescope_builtin.lsp_references, opts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>D", telescope_builtin.lsp_type_definitions, opts)
|
||||
vim.keymap.set("n", "<leader>sh", vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set("n", "<leader>ls", telescope_builtin.lsp_document_symbols, opts)
|
||||
vim.keymap.set("n", "<leader>lw", telescope_builtin.lsp_workspace_symbols, opts)
|
||||
vim.keymap.set("n", "<leader>ld", telescope_builtin.diagnostics, opts)
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.keymap.set("n", "<leader>fm", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, opts)
|
||||
end
|
||||
|
||||
if client.name == "clangd" then
|
||||
vim.keymap.set("n", "<leader>l", "<cmd>ClangdSwitchSourceHeader<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local handlers = {
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end,
|
||||
|
||||
["clangd"] = function()
|
||||
lspconfig.clangd.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--header-insertion=iwyu",
|
||||
"--completion-style=detailed",
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
["gopls"] = function()
|
||||
lspconfig.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
analyses = { unusedparams = true, shadow = true },
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
["lua_ls"] = function()
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
require("mason-lspconfig").setup({ handlers = handlers })
|
||||
end,
|
||||
}
|
||||
16
private_dot_config/nvim/lua/plugins/mason.lua
Normal file
16
private_dot_config/nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "clangd", "gopls", "lua_ls" },
|
||||
})
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = { "stylua", "clang-format", "goimports" },
|
||||
})
|
||||
end,
|
||||
}
|
||||
30
private_dot_config/nvim/lua/plugins/nvim-tree.lua
Normal file
30
private_dot_config/nvim/lua/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
width = 30,
|
||||
relativenumber = true,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = { "^.git$" },
|
||||
exclude = {"%.gitea", "%.github"},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true })
|
||||
vim.keymap.set("n", "<leader>fj", ":NvimTreeFindFile<CR>", { silent = true })
|
||||
end,
|
||||
}
|
||||
36
private_dot_config/nvim/lua/plugins/telescope.lua
Normal file
36
private_dot_config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
path_display = { "truncate" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { silent = true })
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { silent = true })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { silent = true })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { silent = true })
|
||||
end,
|
||||
}
|
||||
27
private_dot_config/nvim/lua/plugins/treesitter.lua
Normal file
27
private_dot_config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter").setup({})
|
||||
require("nvim-treesitter")
|
||||
.install({
|
||||
"c",
|
||||
"cpp",
|
||||
"go",
|
||||
"lua",
|
||||
"yaml",
|
||||
"hcl",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"json",
|
||||
"bash",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
})
|
||||
:wait(5 * 60 * 1000)
|
||||
-- vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
-- vim.wo[0][0].foldmethod = "expr"
|
||||
end,
|
||||
}
|
||||
23
run_once_before-99-install-neovim.sh.tmpl
Normal file
23
run_once_before-99-install-neovim.sh.tmpl
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
{{- if eq .chezmoi.os "linux" }}
|
||||
{{- if eq .chezmoi.arch "amd64" }}
|
||||
NVIM_URL="https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz"
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
echo "Unsupported os: {{ .chezmoi.os }}"
|
||||
exit 1
|
||||
{{- end }}
|
||||
|
||||
curl -fsSL "$NVIM_URL" | sudo tar -C /usr/local --strip-components=1 -xzf -
|
||||
|
||||
sudo ln -sf /usr/local/bin/nvim /usr/local/bin/vim
|
||||
sudo ln -sf /usr/local/bin/nvim /usr/local/bin/vi
|
||||
|
||||
if command -v update-alternatives >/dev/null 2>&1; then
|
||||
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/nvim 60
|
||||
sudo update-alternatives --install /usr/bin/vim vim /usr/local/bin/nvim 60
|
||||
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 60
|
||||
fi
|
||||
50
run_once_before_00-install-deps.sh.tmpl
Normal file
50
run_once_before_00-install-deps.sh.tmpl
Normal file
@@ -0,0 +1,50 @@
|
||||
{{ if eq .chezmoi.os "linux" -}}
|
||||
#!/bin/bash
|
||||
{{ if eq .chezmoi.osRelease.id "ubuntu" -}}
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
wget curl rsync \
|
||||
htop \
|
||||
zip unzip \
|
||||
tmux \
|
||||
fzf ripgrep fd-find \
|
||||
jq \
|
||||
git git-lfs git-delta \
|
||||
python3-venv \
|
||||
sqlite3 \
|
||||
make ninja-build gcc g++ binutils valgrind \
|
||||
zsh \
|
||||
termshark sngrep
|
||||
{{ end }}
|
||||
|
||||
if [ ! -d $HOME/.oh-my-zsh ]; then
|
||||
sudo chsh $USER -s /bin/zsh
|
||||
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s -- --unattended
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
||||
fi
|
||||
|
||||
if ! type -p tree-sitter > /dev/null; then
|
||||
curl -fsSL https://github.com/tree-sitter/tree-sitter/releases/download/v0.26.6/tree-sitter-linux-x64.gz -o /dev/shm/tree-sitter.gz
|
||||
gzip -d /dev/shm/tree-sitter.gz
|
||||
cp -fv /dev/shm/tree-sitter /usr/local/bin/tree-sitter
|
||||
chmod a+rx /usr/local/bin/tree-sitter
|
||||
[ -f /dev/shm/tree-sitter ] && rm /dev/shm/tree-sitter
|
||||
fi
|
||||
|
||||
if ! type -p "n" > /dev/null; then
|
||||
# Install n, node, npm
|
||||
sudo curl -fsSL https://raw.githubusercontent.com/tj/n/f52d2172f12cd76f0efe9524690723f52ab74f40/bin/n -o /usr/local/bin/n
|
||||
sudo chmod a+rx /usr/local/bin/n
|
||||
sudo n 24.10.0
|
||||
fi
|
||||
|
||||
if ! type -p "rustup" > /dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
fi
|
||||
|
||||
if ! type -p go > /dev/null; then
|
||||
curl -fsSL https://go.dev/dl/go1.26.1.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
|
||||
fi
|
||||
|
||||
{{ end -}}
|
||||
@@ -1,34 +0,0 @@
|
||||
{{ if eq .chezmoi.os "linux" -}}
|
||||
#!/bin/bash
|
||||
{{ if eq .chezmoi.osRelease.id "ubuntu" -}}
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
wget \
|
||||
curl \
|
||||
htop \
|
||||
python3-venv \
|
||||
zip unzip \
|
||||
rsync \
|
||||
tmux \
|
||||
fzf ripgrep \
|
||||
jq \
|
||||
lazygit \
|
||||
git git-lfs git-delta \
|
||||
sqlite3
|
||||
{{ end }}
|
||||
|
||||
if ! type -p "n" > /dev/null; then
|
||||
# Install n, node, npm
|
||||
curl -fsSL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | sudo bash -s 24
|
||||
sudo n install 24
|
||||
fi
|
||||
|
||||
if ! type -p "rustup" > /dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo sh
|
||||
fi
|
||||
|
||||
if ! type -p go > /dev/null; then
|
||||
curl -fsSL https://go.dev/dl/go1.26.1.linux-amd64.tar.gz | tar -C /usr/local -xzf -
|
||||
fi
|
||||
|
||||
{{ end -}}
|
||||
Reference in New Issue
Block a user