Merge pull request #1 from js0ny/reorg

Reorganize the dotfiles repo
This commit is contained in:
js0ny 2024-12-01 07:43:14 +00:00 committed by GitHub
commit 7d220c3873
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
169 changed files with 1651 additions and 3862 deletions

View file

@ -1,6 +0,0 @@
{
"line-length": false,
"no-inline-html": false,
"no-alt-text": false,
"ul-style": { "style": "dash" }
}

View file

@ -1,4 +0,0 @@
# ~/.npmrc
# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc
# ln -s $DOTFILES/.npmrc ~/.npmrc
# registry=https://registry.npmmirror.com

View file

@ -1,15 +0,0 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}

View file

@ -1,22 +0,0 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
},
opts = {
workspaces = {
{
name = "Obsidian",
path = "~/Obsidian",
},
},
-- see below for full list of options 👇
},
}

View file

@ -1,8 +0,0 @@
# Colemak *LazyVim*
- Replace the default `hjkl` movement keys with `hnei`
- `j->e`, `k->n`, `h->h`, `l->i`
```sh
ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim
```

View file

@ -1,8 +0,0 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
if (vim.g.vscode) then
print("VSCode detected, skipping lazy loading")
require("vscode.code")
else
require("config.lazy")
-- require("config.lazy")
end

View file

@ -1,8 +0,0 @@
{
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
"nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
"nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
"nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }
}

View file

@ -1,10 +0,0 @@
{
"extras": [
"lazyvim.plugins.extras.ai.copilot",
"lazyvim.plugins.extras.ai.copilot-chat"
],
"news": {
"NEWS.md": "7429"
},
"version": 7
}

View file

@ -1,3 +0,0 @@
-- 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

View file

@ -1,146 +0,0 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
vim.g.mapleader = " "
-- ================= GENERAL KEYBINDS =================
-- SAVE/QUIT {{{
vim.keymap.set("n", "Q", "<cmd>q<CR>", { desc = "Q to quit" })
vim.keymap.set("n", "<C-s>", "<cmd>w<CR>", { desc = "S to write file" })
--}}}
-- NVIM CONFIG SHORTCUTS {{{
-- stylua: ignore
vim.keymap.set("n", "<leader>rc", "<cmd>e $HOME/.config/nvim/lua/config/options.lua<CR>", { desc = "Open nvim options.lua" })
vim.keymap.set("n", "<leader>rp", "<cmd>e $HOME/.config/nvim/lua/plugins/.<CR>", { desc = "lazy plugins dir" })
--}}}
-- UNDO
vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" })
-- INSERT
vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" })
vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" })
-- YANK TO SYSTEM CLIPBOARD
vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" })
-- SEARCH {{{
vim.keymap.set("n", "<LEADER><CR>", "<CMD>nohlsearch<CR>", { desc = "clear search highlight" })
--}}}
-- SPACE TO TAB{{{
vim.keymap.set("n", "<LEADER>tt", "<CMD>%s/ /\t/g<CR>", { desc = "space to tab" })
vim.keymap.set("v", "<LEADER>tt", "<CMD>s/ /\t/g<CR>", { desc = "space to tab" })
--}}}
-- MISC {{{
vim.keymap.set("n", "<LEADER>o", "za", { desc = "folding" })
vim.keymap.set("i", "<C-y>", "<ESC>A {}<ESC>i<CR><ESC>ko", { desc = "insert a pair of {} and goto next line" })
--}}}
-- ================= CURSOR MOVEMENT ===================== {{{
-- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS)
-- ^
-- e
-- < h i >
-- n
-- v
--
vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" })
vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" })
vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" })
vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" })
vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" })
vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" })
vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" })
vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" })
vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" })
vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" })
vim.keymap.set("n", "\v", "v$h", { desc = "???" })
-- FASTER IN-LINE NAVIGATION
-- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD'
vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" })
-- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR
vim.keymap.set({ "n", "v" }, "<C-e>", "5<C-y>", { desc = "Move viewport ⇧" })
vim.keymap.set({ "n", "v" }, "<C-n>", "5<C-e>", { desc = "Move viewport ⇩" })
-- INSERT MODE CURSOR MOVEMENT
vim.keymap.set("i", "<C-a>", "<ESC>A")
-- COMMAND MODE CURSOR MOVEMENT
vim.keymap.set("c", "<C-a>", "<Home>")
vim.keymap.set("c", "<C-e>", "<End>")
vim.keymap.set("c", "<C-p>", "<Up>")
vim.keymap.set("c", "<C-n>", "<Down>")
vim.keymap.set("c", "<C-b>", "<Left>")
vim.keymap.set("c", "<C-f>", "<Right>")
vim.keymap.set("c", "<M-b>", "<S-Left>")
vim.keymap.set("c", "<M-w>", "<S-Right>")
--}}}
-- ================= SPLIT MANAGMENT ===================== {{{
vim.keymap.set("n", "<C-w>E", "<CMD>set nosplitbelow<CR><CMD>split<CR><CMD>set splitbelow<CR>", { desc = "Split ⇧" })
vim.keymap.set("n", "<C-w>N", "<CMD>set splitbelow<CR><CMD>split<CR>", { desc = "Split ⇩" })
vim.keymap.set("n", "<C-w>H", "<CMD>set nosplitright<CR><CMD>vsplit<CR><CMD>set splitright<CR>", { desc = "Split ⇦" })
vim.keymap.set("n", "<C-w>I", "<CMD>set splitright<CR><CMD>vsplit<CR>", { desc = "Split ⇨" })
vim.keymap.set({ "n", "t" }, "<C-w>e", "<C-w>k", { desc = "Move cursor to split ⇧" })
vim.keymap.set({ "n", "t" }, "<C-w>n", "<C-w>j", { desc = "Move cursor to split ⇩" })
vim.keymap.set({ "n", "t" }, "<C-w>h", "<C-w>h", { desc = "Move cursor to split ⇦" })
vim.keymap.set({ "n", "t" }, "<C-w>i", "<C-w>l", { desc = "Move cursor to split ⇨" })
vim.keymap.set({ "n", "t" }, "<C-e>", "<C-k>", { desc = "Move cursor to split ⇧" })
vim.keymap.set({ "n", "t" }, "<C-n>", "<C-j>", { desc = "Move cursor to split ⇩" })
vim.keymap.set({ "n", "t" }, "<C-h>", "<C-h>", { desc = "Move cursor to split ⇦" })
vim.keymap.set({ "n", "t" }, "<C-i>", "<C-l>", { desc = "Move cursor to split ⇨" })
vim.keymap.set("n", "<up>", "<CMD>res -5<CR>", { desc = "Resize split 0,-5" })
vim.keymap.set("n", "<down>", "<CMD>res +5<CR>", { desc = "Resize split 0,+5" })
vim.keymap.set("n", "<left>", "<CMD>vertical resize +5<CR>", { desc = "Resize split +5,0" })
vim.keymap.set("n", "<right>", "<CMD>vertical resize -5<CR>", { desc = "Resize split -5,0" })
vim.keymap.set("n", "<C-w>H", "<C-w>t<C-w>K", { desc = "Make splits [H]orizontal" })
vim.keymap.set("n", "<C-w>V", "<C-w>t<C-w>H", { desc = "Make splits [V]ertical" })
vim.keymap.set("n", "<C-w>ri", "<C-w>b<C-w>K", { desc = "Rotate splits 90" })
vim.keymap.set("n", "<C-w>rh", "<C-w>b<C-w>H", { desc = "Rotate splits -90" })
vim.keymap.set("n", "<LEADER>q", "<C-w>j<CMD>q<CR>", { desc = "Close Split ⇩ (Below)" })
--}}}
-- TAB MANAGEMENT {{{
vim.keymap.set("n", "<TAB><TAB>", "<CMD>tabe<CR>", { desc = "New [Tab]" })
vim.keymap.set("n", "<TAB>h", "<CMD>-tabnext<CR>", { desc = "Select Tab ⇦" })
vim.keymap.set("n", "<TAB>i", "<CMD>+tabnext<CR>", { desc = "Select Tab ⇨" })
vim.keymap.set("n", "<TAB>H", "<CMD>-tabmove<CR>", { desc = "Tab move ⇦" })
vim.keymap.set("n", "<TAB>I", "<CMD>+tabmove<CR>", { desc = "Tab move ⇨" })
-- NOTE: Doesn't seem to work:
-- vim.keymap.set("n", "<TAB>c", "<CMD>tab split<CR>", { desc = "New Tab from [C]urrent" })
-- vim.keymap.set('n', '<LEADER>dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'})
--vim.keymap.del("n", "<C-w>j")
--vim.keymap.del("n", "<C-w>k")
--vim.keymap.del("n", "<C-w>l")
-- }}}
-- =================== TERM BEHAVIORS ====================
vim.keymap.set("t", "<C-n>", "<C-\\><C-n>", { desc = "escape terminal, allowing excmds" })
vim.keymap.set("t", "<C-o>", "<C-\\><C-n><C-o>", { desc = "close terminal" })
--vim: set fdm=marker fdl=0
-- buffers
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
vim.keymap.set("n", "<S-i>", "<cmd>bnext<cr>", { desc = "Next Buffer" })

View file

@ -1,53 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -1,3 +0,0 @@
-- 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

View file

@ -1,54 +0,0 @@
return {
"catppuccin/nvim",
lazy = true,
name = "catppuccin",
opts = {
integrations = {
aerial = true,
alpha = true,
cmp = true,
dashboard = true,
flash = true,
grug_far = true,
gitsigns = true,
headlines = true,
illuminate = true,
indent_blankline = { enabled = true },
leap = true,
lsp_trouble = true,
mason = true,
markdown = true,
mini = true,
native_lsp = {
enabled = true,
underlines = {
errors = { "undercurl" },
hints = { "undercurl" },
warnings = { "undercurl" },
information = { "undercurl" },
},
},
navic = { enabled = true, custom_bg = "lualine" },
neotest = true,
neotree = true,
noice = true,
notify = true,
semantic_tokens = true,
telescope = true,
treesitter = true,
treesitter_context = true,
which_key = true,
},
},
specs = {
{
"akinsho/bufferline.nvim",
optional = true,
opts = function(_, opts)
if (vim.g.colors_name or ""):find("catppuccin") then
opts.highlights = require("catppuccin.groups.integrations.bufferline").get()
end
end,
},
},
}

View file

@ -1,13 +0,0 @@
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "catppuccin",
},
},
}

View file

@ -1,65 +0,0 @@
return {
"nvimdev/dashboard-nvim",
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
opts = function()
local logo = [[
Z
Z
z
z
]]
-- logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
-- this is taken care of by lualine
-- enabling this messes up the actual laststatus setting after loading a file
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = "", key = "r" },
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = "", key = "g" },
{ action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- open dashboard after closing lazy
if vim.o.filetype == "lazy" then
vim.api.nvim_create_autocmd("WinClosed", {
pattern = tostring(vim.api.nvim_get_current_win()),
once = true,
callback = function()
vim.schedule(function()
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
end)
end,
})
end
return opts
end,
}

View file

@ -1,197 +0,0 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").lsp.on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, {
function()
return "😄"
end,
})
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
}

View file

@ -1,4 +0,0 @@
return {
"NoahTheDuke/vim-just",
ft = { "just" },
}

View file

@ -1,126 +0,0 @@
return {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
init = function()
vim.g.lualine_laststatus = vim.o.laststatus
if vim.fn.argc(-1) > 0 then
-- set an empty statusline till lualine loads
vim.o.statusline = " "
else
-- hide the statusline on the starter page
vim.o.laststatus = 0
end
end,
opts = function()
-- PERF: we don't need this lualine require madness 🤷
local lualine_require = require("lualine_require")
lualine_require.require = require
local icons = LazyVim.config.icons
vim.o.laststatus = vim.g.lualine_laststatus
local opts = {
options = {
theme = "auto",
globalstatus = vim.o.laststatus == 3,
disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard", "NvimTree_1" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
LazyVim.lualine.root_dir(),
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ LazyVim.lualine.pretty_path() },
},
lualine_x = {
-- stylua: ignore
{
function() return require("noice").api.status.command.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
color = function() return LazyVim.ui.fg("Statement") end,
},
-- stylua: ignore
{
function() return require("noice").api.status.mode.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
color = function() return LazyVim.ui.fg("Constant") end,
},
-- stylua: ignore
{
function() return "" .. require("dap").status() end,
cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end,
color = function() return LazyVim.ui.fg("Debug") end,
},
-- stylua: ignore
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
color = function() return LazyVim.ui.fg("Special") end,
},
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
},
},
lualine_y = {
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {
function()
return "" .. os.date("%R")
end,
},
},
extensions = { "neo-tree", "lazy" },
}
-- do not add trouble symbols if aerial is enabled
-- And allow it to be overriden for some buffer types (see autocmds)
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
local trouble = require("trouble")
local symbols = trouble.statusline({
mode = "symbols",
groups = {},
title = false,
filter = { range = true },
format = "{kind_icon}{symbol.name:Normal}",
hl_group = "lualine_c_normal",
})
table.insert(opts.sections.lualine_c, {
symbols and symbols.get,
cond = function()
return vim.b.trouble_lualine ~= false and symbols.has()
end,
})
end
return opts
end,
}

View file

@ -1,138 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
keys = {
{
"<leader>fe",
function()
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
end,
desc = "Explorer NeoTree (Root Dir)",
},
{
"<leader>fE",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
end,
desc = "Explorer NeoTree (cwd)",
},
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
{
"<leader>ge",
function()
require("neo-tree.command").execute({ source = "git_status", toggle = true })
end,
desc = "Git Explorer",
},
{
"<leader>be",
function()
require("neo-tree.command").execute({ source = "buffers", toggle = true })
end,
desc = "Buffer Explorer",
},
},
deactivate = function()
vim.cmd([[Neotree close]])
end,
init = function()
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
-- because `cwd` is not set up properly.
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
desc = "Start Neo-tree with directory",
once = true,
callback = function()
if package.loaded["neo-tree"] then
return
else
local stats = vim.uv.fs_stat(vim.fn.argv(0))
if stats and stats.type == "directory" then
require("neo-tree")
end
end
end,
})
end,
opts = {
sources = { "filesystem", "buffers", "git_status" },
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
filesystem = {
hide_dotfiles = false,
hide_hidden = false,
bind_to_cwd = false,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
hide_by_name = {
".git",
"node_modules",
"requirements.txt",
"desktop.ini",
},
never_show = {
".DS_Store",
},
},
window = {
mappings = {
-- MARKED
["i"] = "open",
-- MARKED
["e"] = "noop",
["h"] = "close_node",
["<space>"] = "none",
["Y"] = {
function(state)
local node = state.tree:get_node()
local path = node:get_id()
vim.fn.setreg("+", path, "c")
end,
desc = "Copy Path to Clipboard",
},
["O"] = {
function(state)
require("lazy.util").open(state.tree:get_node().path, { system = true })
end,
desc = "Open with System Application",
},
["P"] = { "toggle_preview", config = { use_float = false } },
},
},
default_component_configs = {
indent = {
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
git_status = {
symbols = {
unstaged = "󰄱",
staged = "󰱒",
},
},
},
},
config = function(_, opts)
local function on_move(data)
LazyVim.lsp.on_rename(data.source, data.destination)
end
local events = require("neo-tree.events")
opts.event_handlers = opts.event_handlers or {}
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
require("neo-tree").setup(opts)
vim.api.nvim_create_autocmd("TermClose", {
pattern = "*lazygit",
callback = function()
if package.loaded["neo-tree.sources.git_status"] then
require("neo-tree.sources.git_status").refresh()
end
end,
})
end,
}

View file

@ -1,11 +0,0 @@
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup({})
end,
}

View file

@ -1,22 +0,0 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
},
opts = {
workspaces = {
{
name = "Obsidian",
path = "/mnt/c/Users/citoy/Obsidian",
},
},
-- see below for full list of options 👇
},
}

View file

@ -1,3 +0,0 @@
return {
{ 'wakatime/vim-wakatime', lazy = false },
}

View file

@ -1,3 +0,0 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120

10
.gitattributes vendored Normal file
View file

@ -0,0 +1,10 @@
# $DOTFILES/.gitattributes
# Date: 2024-11-30
# Author: contact@js0ny.net
skhdrc linguist-language=Shell
yabairc linguist-language=Shell
sketchybarrc linguist-language=Shell
*.vimrc linguist-language=VimL
vsvimrc linguist-language=VimL
vimrc linguist-language=VimL
ideavimrc linguist-language=VimL

36
.gitignore vendored
View file

@ -15,25 +15,18 @@ test.*
# Utils
xdg-ninja/
# IPython config cache
.config/ipython/profile_default/db
.config/ipython/profile_default/log
.config/ipython/profile_default/pid
.config/ipython/profile_default/security
.config/ipython/profile_default/history.sqlite
# nvim config cache
.config/nvim/tt.*
.config/nvim/.tests
.config/nvim/doc/tags
.config/nvim/debug
.config/nvim/.repro
.config/nvim/foo.*
.config/nvim/*.log
.config/nvim/data
.config/nvim/lazy-lock.json
.config/nvim/lazyvim.json
.config/nvim/lua/plugins/obsidian.lua
tools/nvim/tt.*
tools/nvim/.tests
tools/nvim/doc/tags
tools/nvim/debug
tools/nvim/.repro
tools/nvim/foo.*
tools/nvim/*.log
tools/nvim/data
tools/nvim/lazy-lock.json
tools/nvim/lazyvim.json
tools/nvim/lua/plugins/obsidian.lua
# Undone
# Windows PowerToys
@ -41,12 +34,11 @@ PowerToys/
# Just Script
Justfile
# Nushell
.config/nushell/
# VSCode Neovim
vscode/
.vscode/
tools/nushell/
# OS generated files
.DS_Store
.venv/
platforms/win/komorebi/applications.json

29
.vscode/dotfiles.code-snippets vendored Normal file
View file

@ -0,0 +1,29 @@
{
// Place your .dotfiles 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Dotfiles": {
"scope": "",
"prefix": "init",
"body": [
"$LINE_COMMENT \\$DOTFILES/$RELATIVE_FILEPATH",
"$LINE_COMMENT Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
"$LINE_COMMENT Author: contact@js0ny.net",
"$LINE_COMMENT $0",
]
}
}

31
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,31 @@
{
"material-icon-theme.files.associations": {
"ideavimrc": "vim",
"vsvimrc": "vim",
"vimrc": "vim",
"haskeline": "haskell",
"inputrc": "console",
"npmrc": "npm",
"lesskey": "less",
"config.kdl": "json",
"pip.conf": "python-misc",
"*.kdl": "json",
"gitconfig": "git",
"nvim/init.lua": "vim",
"markdownlint.json": "markdownlint",
"wslconfig": "settings",
"skhdrc": "console"
},
"material-icon-theme.folders.associations": {
"bootstrap": "admin",
"ipython": "jupyter",
"zsh": "command",
"starship": "ui",
"nvim": "config",
"wsl": "linux"
},
"files.associations": {
"ideavimrc": "Vimscript",
".wslconfig": "properties",
},
}

View file

@ -1,8 +1,7 @@
#! /bin/sh
# This script is used to setup a new mac
# In a new mac (Sequoia)
# Enter the following command in the terminal
#! curl -fsSL https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/setup/mac_setup.sh | sh # Do not use this command
#! /bin/zsh
# $DOTFILES/bootstrap/macOS.zsh
# Run this script to set up macOS
# 运行此脚本以设置 macOS
echo "Running the setup script"
@ -11,6 +10,9 @@ echo "[INFO] Installing Xcode Command Line Tools"
echo "[ACTION] Request Human Takeover"
xcode-select --install
# Press any key to continue (if Xcode Command Line Tools are installed)
read -n 1 -s -r -p "Press any key to continue when xcode CLI tools are installed"
# System Preferences
# Installation Sources
echo "[INFO] Setting Installation Sources"

View file

@ -0,0 +1,40 @@
#! /bin/bash
# $DOTFILES/bootstrap/set_symblink_unix.bash
# Date: 2024-12-01
# Author: contact@js0ny.net
# Set symbolic links for Unix-like systems
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython
# Not support XDG_CONFIG_HOME but same directory
mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow
# mkdir -p $WAKATIME_HOME
# mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view
mkdir -p $HOME/Obsidian
# $DOTFILES/common
ln -sf $DOTFILES/common/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
ln -sf $DOTFILES/common/gitconfig $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/common/obsidian.vimrc $HOME/Obsidian/.obsidian.vimrc
ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
ln -sf $DOTFILES/common/vimrc $XDG_CONFIG_HOME/vim/vimrc
ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl
# $DOTFILES/tools
ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython
ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim
ln -sf $DOTFILES/tools/yazi/config/keymap.toml ~/.config/yazi/keymap.toml
ln -sf $DOTFILES/tools/yazi/config/yazi.toml ~/.config/yazi/yazi.toml
if [ $(uname) = "Darwin"]; then
mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar
ln -sf $DOTFILES/platforms/mac/karabiner/karabiner.json ~/.config/karabiner/karabiner.json
ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc
ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc
fi

View file

@ -0,0 +1,38 @@
# $DOTFILES\bootstrap\set_symlink_win.ps1
# Date: 2024-12-01
# Author: contact@js0ny.net
# Set symlinks for dotfiles on Windows
# 在 Windows 上设置 dotfiles 的符号链接
$DOTFILES = Join-Path $env:UserProfile ".dotfiles"
$BASE_COMMON = Join-Path $DOTFILES "common"
$BASE_TOOLS = Join-Path $DOTFILES "tools"
$BASE_WIN = Join-Path $DOTFILES "platforms" "win"
$linkDots = @{
"$BASE_WIN\wslconfig" = "$env:UserProfile\.wslconfig"
"$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml"
"$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc"
"$BASE_WIN\komorebi" = "$env:KOMOREBI_CONFIG_HOME"
"$BASE_COMMON\condarc.yaml" = "$env:XDG_CONFIG_HOME\conda\.condarc"
"$BASE_COMMON\gitconfig" = "$env:UserProfile\.gitconfig"
"$BASE_COMMON\glow.yaml" = "$env:AppData\glow\glow.yml"
"$BASE_COMMON\haskeline" = "$env:UserProfile\.haskeline"
"$BASE_COMMON\ideavimrc" = "$env:XDG_CONFIG_HOME\ideavim\ideavimrc"
"$BASE_COMMON\lesskey" = "$env:LessKeyIn"
"$BASE_COMMON\npmrc" = "$env:NPM_CONFIG_USERCONFIG"
"$BASE_COMMON\NuGet.Config" = "$env:AppData\NuGet\NuGet.Config"
"$BASE_COMMON\obsidian.vimrc" = "$env:UserProfile\Obsidian\.obsidian.vimrc"
"$BASE_COMMON\pip.conf" = "$env:AppData\pip\pip.ini"
"$BASE_COMMON\vim.noxdg.vimrc" = "$env:Vim\_vimrc"
"$BASE_TOOLS\ipython" = "$env:IPYTHONDIR"
"$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim"
}
# TODO: Auto create directories
foreach ($target in $linkDots.Keys) {
$path = $linkDots[$target]
New-Item -ItemType SymbolicLink -Target $target -Path $path -Force
}
New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force

View file

@ -1,48 +0,0 @@
# $XDG_CONFIG_HOME/zsh/.zshrc
# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc
### Variables ###
export DOTFILES="$HOME/.dotfiles"
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
for file in $DOTFILES/zsh/*.zsh; do
source $file
done
export ARCHFLAGS="-arch arm64"
### Navigation ###
# Absolute navigation
alias doku="cd ~/doku && ls"
alias docs="cd ~/Documents"
alias dt="cd ~/Desktop"
alias down="cd ~/Downloads"
alias one="cd ~/OneDrive"
alias gdrive="cd ~/Google\ Drive"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# >>> juliaup initialize >>>
# !! Contents within this block are managed by juliaup !!
path=('$HOME/.juliaup/bin' $path)
export PATH
# <<< juliaup initialize <<<
# macOS #
alias xclip="pbcopy"
alias clip="pbcopy"

@ -1 +0,0 @@
Subproject commit 4c28f11f451facef809b380502874a48ba964ddb

View file

@ -1,33 +0,0 @@
# pip
alias pip=pip3
alias python=python3
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# npm
npm config set registry https://registry.npmmirror.com
# Homebrew
# 手动设置
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。
# 如果需要使用 Homebrew 的开发命令 (如 `brew cat <formula>`),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。
# 请按需执行如下两行命令:
brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像
brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git
brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git
brew update
# 或使用下面的几行命令自动设置
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
for tap in core cask{,-fonts,-versions} command-not-found services; do
brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git"
done
brew update

View file

@ -1,7 +0,0 @@
# pip
Set-Alias pip pip3
Set-Alias python python3
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# npm
npm config set registry https://registry.npmmirror.com

View file

@ -1,22 +0,0 @@
# pip
alias pip=pip3
alias python=python3
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# npm
npm config set registry https://registry.npmmirror.com
# Linuxbrew
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。
# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat <formula>`),则仍然需要设置 homebrew/core 镜像。
# 请按需执行如下命令:
brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像
brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git
brew update

View file

@ -1,15 +0,0 @@
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

View file

@ -1,5 +0,0 @@
echo "Making Backup of /etc/apt/sources.list..."
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "Adding Ubuntu Repositories..."
sudo cp ./tuna_ubuntu.list /etc/apt/sources.list

0
platforms/mac/readme.md Normal file
View file

102
platforms/mac/sketchybarrc Executable file
View file

@ -0,0 +1,102 @@
# $DOTFILES/platforms/mac/sketchybarrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# TODO: Reorganize this file
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
# For a (much) more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar.
# These are only some of the options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000
##### Changing Defaults #####
# We now change some default values, which are applied to all further items.
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
default=(
padding_left=5
padding_right=5
icon.font="CaskaydiaCove Nerd Font:Bold:17.0"
label.font="CaskaydiaCove Nerd Font:Bold:14.0"
icon.color=0xffffffff
label.color=0xffffffff
icon.padding_left=4
icon.padding_right=4
label.padding_left=4
label.padding_right=4
)
sketchybar --default "${default[@]}"
##### Adding Mission Control Space Indicators #####
# Let's add some mission control spaces:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces.
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid="$(($i+1))"
space=(
space="$sid"
icon="${SPACE_ICONS[i]}"
icon.padding_left=7
icon.padding_right=7
background.color=0x40ffffff
background.corner_radius=5
background.height=25
label.drawing=off
script="$PLUGIN_DIR/space.sh"
click_script="yabai -m space --focus $sid"
)
sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar, where
# only the properties deviating from the current defaults need to be set
sketchybar --add item chevron left \
--set chevron icon= label.drawing=off \
--add item front_app left \
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock center \
--set clock update_freq=10 icon=script="$PLUGIN_DIR/clock.sh" \
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
--subscribe volume volume_change \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
--subscribe battery system_woke power_source_change \
--add item apple_music right
sketchybar --add item music right
sketchybar --set music \
script="$PLUGIN_DIR/music.sh" \
update_freq=5 \
label.color=0xffd7ba7d \
background.corner_radius=5
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update

36
platforms/mac/skhdrc Normal file
View file

@ -0,0 +1,36 @@
# $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Location: $XDG_CONFIG_HOME/skhd/skhdrc
# Linking:
# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# Navigation
cmd - h : yabai -m window --focus west
cmd - n : yabai -m window --focus south
cmd - e : yabai -m window --focus north
cmd - i : yabai -m window --focus east
# Moving windows
shift + cmd - h : yabai -m window --warp west
shift + cmd - n : yabai -m window --warp south
shift + cmd - e : yabai -m window --warp north
shift + cmd - i : yabai -m window --warp east
shift + alt - h : \
yabai -m window --resize left:-20:0 ; \
yabai -m window --resize right:-20:0
shift + alt - n : \
yabai -m window --resize bottom:0:20 ; \
yabai -m window --resize top:0:20
shift + alt - e : \
yabai -m window --resize top:0:-20 ; \
yabai -m window --resize bottom:0:-20
shift + alt - i : \
yabai -m window --resize right:20:0 ; \
yabai -m window --resize left:20:0

51
platforms/mac/yabairc Normal file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env sh
# $DOTFILES/platforms/mac/yabairc
# Date: 2024-11-30
# Author: contact@js0ny.net
# TODO: Reorganize this file
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition
#
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# sudo yabai --load-sa
#
# global settings
yabai -m config \
top_padding 40 \
external_bar off:40:0 \
menubar_opacity 1.0 \
mouse_follows_focus off \
focus_follows_mouse off \
display_arrangement_order default \
window_origin_display default \
window_placement second_child \
window_zoom_persist on \
window_shadow on \
window_animation_duration 0.0 \
window_animation_easing ease_out_circ \
window_opacity_duration 0.0 \
active_window_opacity 1.0 \
normal_window_opacity 0.70 \
window_opacity on \
insert_feedback_color 0xffd75f5f \
split_ratio 0.50 \
split_type auto \
auto_balance off \
bottom_padding 12 \
left_padding 12 \
right_padding 12 \
window_gap 06 \
layout bsp \
mouse_modifier fn \
mouse_action1 move \
mouse_action2 resize \
mouse_drop_action swap
echo "yabai configuration loaded.."

27
platforms/mac/zshrc Normal file
View file

@ -0,0 +1,27 @@
# $DOTFILES/platforms/mac/zshrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用macOS 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
# macOS #
alias xclip="pbcopy"
alias clip="pbcopy"
alias paste="pbpaste"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

View file

@ -0,0 +1,74 @@
# $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1
# Date: 2024-12-01
# Author: contact@js0ny.net
# PowerShell profile for Windows
### Load Configs ###
$DOTFILES = Join-Path $HOME ".dotfiles"
Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_}
### Aliases ###
# Toggle Theme #
# TODO: Change to `bat` script implementation
# function Set-SystemTheme {
# $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
# $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme"
# if ($currentMode.AppsUseLightTheme -eq 1) {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0
# Write-Host "已切换到深色模式"
# }
# else {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1
# Write-Host "已切换到浅色模式"
# }
# }
# Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`)
# Miscs #
### Misc ###
${function:qwen} = "ollama run qwen2.5:14b"
## Conda ##
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
(& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object{$_} | Invoke-Expression
}
#endregion
## Check Start Up ##
#$SystemlogFilePath = "$env:USERPROFILE\.PowerShellStartup.log"
## 检查日志文件是否存在
#if (-not (Test-Path $SystemlogFilePath)) {
# New-Item -Path $SystemlogFilePath -ItemType File -Force | Out-Null
#}
## 读取日志文件的最后一行(即上次启动日期)
#$__lastStartup = Get-Content -Path $SystemlogFilePath -Tail 1 -ErrorAction SilentlyContinue
#$_currentDate = (Get-Date).ToString("yyyy-MM-dd")
#if (-not ($__lastStartup -eq $_currentDate)) {
# Get-Date
# Update-ForexData &
# Write-Host "今天是第一次启动 PowerShell。"
# # 记录当前日期到日志文件
# $_currentDate | Out-File -FilePath $SystemlogFilePath -Append
#}
#Remove-Variable SystemlogFilePath
#Remove-Variable __lastStartup
#Remove-Variable _currentDate
# Set default applications
$Env:PAGER = "less"
$Env:EDITOR = "code --wait"
$Env:VISUAL = "code --wait"
$Env:FILE_MANAGER = "dopus.exe"
${function:wsl2} = {wsl.exe --distribution Ubuntu}
${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }

View file

@ -1,3 +1,4 @@
@REM Not working
@REM encoding: GBK
@echo off
set regPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
@ -5,8 +6,8 @@ for /f "usebackq tokens=2*" %%a in (`reg query %regPath% /v AppsUseLightTheme ^|
if "%currentMode%"=="0x1" (
reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 0 /f >nul
echo 已切换到深色模式
echo <EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫģʽ
) else (
reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 1 /f >nul
echo 已切换到浅色模式
echo <EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>dzɫģʽ
)

19
platforms/win/wslconfig Normal file
View file

@ -0,0 +1,19 @@
# $DOTFILES\platforms\win\wslconfig
# Date: 2024-12-01
# Author: contact@js0ny.net
# Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2)
# 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络)
# Location: ~/.wslconfig
# Linking: (PowerShell)
# New-Item -ItemType SymbolicLink -Path ~\.wslconfig -Target ~\.dotfiles\platforms\win\wslconfig
[wsl2]
# networkingMode=mirrored
# dnsTunneling=true
# firewall=true
# autoProxy=true
[experimental]
# requires dnsTunneling but are also OPTIONAL
bestEffortDnsParsing=true
hostAddressLoopback=true

View file

@ -1,3 +1,10 @@
# $DOTFILES/platforms/wsl/winterop.zsh
# Sourced by $DOTFILES/platforms/wsl/zshrc 在 $DOTFILES/platforms/wsl/zshrc 中被引用
# Defines the interop commands between WSL and Windows
export FILE_EXPLORER="dopus.exe" # Directory Opus
alias clip="clip.exe"
alias xclip="clip.exe"
alias paste='pwsh.exe -NoProfile -Command "Get-Clipboard"'
@ -13,3 +20,14 @@ alias diskpart="diskpart.exe"
alias winget="winget.exe"
alias pastew='pwsh.exe -NoProfile -Command "Get-Clipboard"'
alias ollama="ollama.exe"
# WSL open
open() {
local target=$1
if command -v "$FILE_EXPLORER" > /dev/null; then
"$FILE_EXPLORER" "$target"
else
command open "$target"
fi
}

32
platforms/wsl/zshrc Normal file
View file

@ -0,0 +1,32 @@
# $DOTFILES/platforms/wsl/zshrc
# Date: 2024-12-01
# Author: contact@js0ny.net
# Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用WSL 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
### Variables ###
export IS_WSL=true
export ARCHFLAGS="-arch x86_64"
source $DOTFILES/platforms/wsl/winterop.zsh
### Misc ###
export PATH=/opt/bin:$PATH
# Conda #
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
. "$HOME/miniconda3/etc/profile.d/conda.sh"
else
export PATH="$HOME/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

View file

@ -1,46 +0,0 @@
### VARIABLES ###
$EDITOR = "code"
# Shell Equivalents #
Set-Alias "touch" "New-Item"
${function:ll} = { Get-ChildItem -Force }
# Shell Configurations #
${function:shcfg} = { code $PROFILE }
Set-Alias "pwshcfg" "shcfg"
${function:reload} = { . $PROFILE }
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
# Editors #
Set-Alias "v" "nvim"
Set-Alias "c" "code"
Set-Alias "gvi" "neovide"
# File Creation #
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname }
function tc { param ( [string] $filename) New-Item $filename && code $filename }
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
### Dev ###
# .NET #
${function:csi} = { dotnet repl --default-kernel csharp}
${function:fsi} = { dotnet repl --default-kernel fsharp}
# Python & Conda #
Set-Alias "py" "python"
Set-Alias "ipy" "ipython"
${function:pyact} = { conda activate $args[0] }
${function:pydact} = { conda deactivate }
${function:pylsenvs} = { conda env list }
${function:pymkenv} = { conda create --name $args[0] }
${function:pyrmenv} = { conda remove --name $args[0] --all }
# Winget #
if ($isWindows) {
${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }
}

View file

@ -1,15 +0,0 @@
# ${function:~} = { Set-Location -Path ~ } cd is better
${function:...} = { Set-Location -Path ..\.. }
${function:....} = { Set-Location -Path ..\..\.. }
${function:.....} = { Set-Location -Path ..\..\..\.. }
${function:......} = { Set-Location -Path ..\..\..\..\.. }
# Absolute navigation
${function:docs} = { Set-Location -Path ~/Documents }
${function:down} = { Set-Location -Path ~/Downloads }
${function:dt} = { Set-Location -Path ~/Desktop }
${function:mytmp} = { Set-Location -Path ~/Temp }
${function:one} = { Set-Location -Path ~/OneDrive }
${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem }
Invoke-Expression (& { (zoxide init powershell | Out-String) })

41
scripts/update.zsh Normal file
View file

@ -0,0 +1,41 @@
#!/bin/zsh
# $DOTFILES/scripts/update.zsh
# call by `update` alias defined in tools/zsh/alias.zsh
# 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh
# Plugins #
# Auto `git pull` on $ZDOTDIR/plugins
for plugin in $ZDOTDIR/plugins/*; do
if [ -d "$plugin" ]; then
cd $plugin
git pull --quiet --no-edit
fi
done
# Update package managers #
# Homebrew, macOS
if command -v brew > /dev/null; then
brew update
brew upgrade
fi
# Arch
if command -v pacman > /dev/null; then
sudo pacman -Syu
fi
# Debian
if command -v apt > /dev/null; then
sudo apt update
sudo apt upgrade
fi
# Fedora
if command -v dnf > /dev/null; then
sudo dnf update
fi
# WSL
if command -v winget.exe > /dev/null; then
winget.exe upgrade
fi

View file

@ -1,19 +0,0 @@
# This file lists all the must-have libraries for installing a new computer
# For scripting use
# pip install -r requirements.txt
colorama
# Basic Mathemetics
numpy
matplotlib
# Data Analysis
pandas
# Image Processing
pillow
# Web Scraping
requests
beautifulsoup4
# Testing
pytest
mypy
# Healthy Neovim
pynvim

View file

@ -1,22 +0,0 @@
#! /bin/sh
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm
mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory
mkdir -p $WAKATIME_HOME
mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view
# $DOTFILES/.config
ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json
ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim
ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc
ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl
ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey
# $DOTFILES/vscode
ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc
# $DOTFILES root
ln -sf $DOTFILES/.haskeline ~/.haskeline

6
tools/ipython/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# IPython config cache
*/db/
*/log/
*/pid/
*/security/
*/history.sqlite

View file

@ -0,0 +1,11 @@
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy

View file

@ -0,0 +1,11 @@
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy

View file

@ -2,7 +2,7 @@ from IPython.core.magic import register_line_magic
@register_line_magic
def ps(cmd):
output = get_ipython().getoutput(f"powershell -Command {cmd}")
output = get_ipython().getoutput(f"pwsh -NoProfile -Command {cmd}")
# If no variable is assigned to the output, print it
if get_ipython().last_execution_result is None:
print("\n".join(output))

Some files were not shown because too many files have changed in this diff Show more