This commit is contained in:
subcrip 2024-07-29 18:06:36 +08:00
parent 6a6a24b560
commit c42dd6b9bf
Signed by: subcrip
SSH Key Fingerprint: SHA256:dFPFi68d8C87YkFkEBU4TkcrYRySWpekRR1hbnDWUCw
9 changed files with 433 additions and 341 deletions

4
.zshrc
View File

@ -115,11 +115,13 @@ source $ZSH/oh-my-zsh.sh
alias python="python3" alias python="python3"
alias pip3="python3 -m pip" alias pip3="python3 -m pip"
alias pip="python -m pip" alias pip="python -m pip"
alias comp="cd ~/RustIsBestLang/src/bin && nvim" alias comp="cd ~/CompetitiveProgramming/src/bin && nvim"
alias upgrade="yay --noconfirm --overwrite '*' && nix-channel --update && home-manager switch && brew upgrade && flatpak update -y && rustup update && pipx upgrade-all"
alias backup="git add . && git commit -S -m 'backup' && git push" alias backup="git add . && git commit -S -m 'backup' && git push"
export LD_LIBRARY_PATH=/home/user/.local/lib/mojo:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/home/user/.local/lib/mojo:$LD_LIBRARY_PATH
export PATH=/home/user/.modular/pkg/packages.modular.com_mojo/bin/:/home/user/.npm-packages/bin:/home/user/.cabal/bin:/home/user/.ghcup/bin:/home/linuxbrew/.linuxbrew/bin:/home/user/.cargo/bin:/home/user/.local/bin:/usr/local/cuda/bin:$PATH export PATH=/home/user/.modular/pkg/packages.modular.com_mojo/bin/:/home/user/.npm-packages/bin:/home/user/.cabal/bin:/home/user/.ghcup/bin:/home/linuxbrew/.linuxbrew/bin:/home/user/.cargo/bin:/home/user/.local/bin:/usr/local/cuda/bin:$PATH
export PAGER=less export PAGER=less
export EDITOR=nvim
me () { me () {
md "$@" && cd "$@" md "$@" && cd "$@"

View File

@ -27,3 +27,6 @@ cp $HOME/.config/home-manager . -r
# NPM # NPM
cp $HOME/.npmrc . cp $HOME/.npmrc .
# LF
cp $HOME/.config/lf . -r

View File

@ -23,19 +23,41 @@
# The home.packages option allows you to install Nix packages into your # The home.packages option allows you to install Nix packages into your
# environment. # environment.
home.packages = [ home.packages = [
pkgs.mtr # Install contour through Flatpak instead.
# pkgs.contour
# Editor
pkgs.neovim pkgs.neovim
pkgs.htop
pkgs.python312
pkgs.pyright
pkgs.nodejs_22
pkgs.pipx
pkgs.fx
pkgs.gdb
pkgs.lua-language-server pkgs.lua-language-server
pkgs.cmake-language-server
pkgs.helix
pkgs.zed-editor
# Tools
pkgs.btop
pkgs.fx
pkgs.mtr
pkgs.htop
pkgs.gdb
# Python
(pkgs.python312.withPackages (ps: with ps; [
]))
pkgs.pyright
pkgs.pipx
# Node
pkgs.nodejs_22
# Waybar
pkgs.waybar pkgs.waybar
pkgs.waybar-mpris pkgs.waybar-mpris
pkgs.zed-editor
# Misc
pkgs.lf # Terminal file manager
# pkgs.smassh # Typing test
pkgs.you-get # YouTube video downloader
pkgs.asciinema # Record terminal sessions
# # It is sometimes useful to fine-tune packages, for example, by applying # # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the # # overrides. You can do that directly here, just don't forget the
@ -88,12 +110,4 @@
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
programs.helix = {
enable = true;
};
programs.btop = {
enable = true;
};
} }

4
lf/lfrc Normal file
View File

@ -0,0 +1,4 @@
set icons
set number
set relativenumber
set hidden

View File

@ -23,19 +23,19 @@
"eslint.nvim": { "branch": "main", "commit": "158f2289907d377018752fcfe0d61b746dc11767" }, "eslint.nvim": { "branch": "main", "commit": "158f2289907d377018752fcfe0d61b746dc11767" },
"feline.nvim": { "branch": "master", "commit": "3587f57480b88e8009df7b36dc84e9c7ff8f2c49" }, "feline.nvim": { "branch": "master", "commit": "3587f57480b88e8009df7b36dc84e9c7ff8f2c49" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"fzf-lua": { "branch": "main", "commit": "fb058bd718aabe9a5abb3e9df3d5c1023d06cdae" }, "fzf-lua": { "branch": "main", "commit": "769b6636af07ea4587e6c06067d8fe9fb0629390" },
"git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" }, "git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" },
"gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" }, "gitsigns.nvim": { "branch": "main", "commit": "f074844b60f9e151970fbcdbeb8a2cd52b6ef25a" },
"goto-preview": { "branch": "main", "commit": "1519ea3512828c944eed5b2bbb66a8f8deb92447" }, "goto-preview": { "branch": "main", "commit": "1519ea3512828c944eed5b2bbb66a8f8deb92447" },
"haskell-vim": { "branch": "master", "commit": "f35d02204b4813d1dbe8b0e98cc39701a4b8e15e" }, "haskell-vim": { "branch": "master", "commit": "f35d02204b4813d1dbe8b0e98cc39701a4b8e15e" },
"heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" }, "heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" },
"hlargs.nvim": { "branch": "main", "commit": "cc0d9ee75e5ffba730393049119361b9e3a5b1b6" }, "hlargs.nvim": { "branch": "main", "commit": "cc0d9ee75e5ffba730393049119361b9e3a5b1b6" },
"hop.nvim": { "branch": "master", "commit": "036462a345792279c58f2f6445756efab706f04a" }, "hop.nvim": { "branch": "master", "commit": "036462a345792279c58f2f6445756efab706f04a" },
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
"lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lazydev.nvim": { "branch": "main", "commit": "02f1055a777264d4b65896051ec28d0f322f7932" }, "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"leetcode.nvim": { "branch": "master", "commit": "02fb2c855658ad6b60e43671f6b040c812181a1d" }, "leetcode.nvim": { "branch": "master", "commit": "02fb2c855658ad6b60e43671f6b040c812181a1d" },
"legendary.nvim": { "branch": "master", "commit": "0705f207ba79ee3c687fc77c451faeeb4828d5ad" }, "legendary.nvim": { "branch": "master", "commit": "543bbbba4e7b54222362f312e1d2e3dac1eaae75" },
"listish.nvim": { "branch": "master", "commit": "3bc4bb02036f3802c6428c6232633d3192ac3604" }, "listish.nvim": { "branch": "master", "commit": "3bc4bb02036f3802c6428c6232633d3192ac3604" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" }, "lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lspkind.nvim": { "branch": "master", "commit": "67ec67c68f05ca41dab0d426c9e7c94ad86085f9" }, "lspkind.nvim": { "branch": "master", "commit": "67ec67c68f05ca41dab0d426c9e7c94ad86085f9" },
@ -43,35 +43,35 @@
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"markdown-toc.nvim": { "branch": "main", "commit": "75eabbdcb921f402b2e5b476e1a797a1004cdeaa" }, "markdown-toc.nvim": { "branch": "main", "commit": "75eabbdcb921f402b2e5b476e1a797a1004cdeaa" },
"marks.nvim": { "branch": "master", "commit": "74e8d01b2a2131b6e46354cffc553aa7f81bcf5b" }, "marks.nvim": { "branch": "master", "commit": "74e8d01b2a2131b6e46354cffc553aa7f81bcf5b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"melange-nvim": { "branch": "master", "commit": "800490ee87ce3e1b4afe751ff81f2864cb01937d" }, "melange-nvim": { "branch": "master", "commit": "800490ee87ce3e1b4afe751ff81f2864cb01937d" },
"mini.nvim": { "branch": "main", "commit": "23669ab7abc2cd10f9a5166de07400bb34eaecda" }, "mini.nvim": { "branch": "main", "commit": "e24ec1fcf885990fec1a993fe8304a033fd1806d" },
"modicator.nvim": { "branch": "main", "commit": "d1d327fd4bdfc3af4cfdf83b85c2eaefa71de7a8" }, "modicator.nvim": { "branch": "main", "commit": "d1d327fd4bdfc3af4cfdf83b85c2eaefa71de7a8" },
"neogit": { "branch": "master", "commit": "af1d8d88f426a4da63c913f3b81a37350dbe8d02" }, "neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" },
"none-ls.nvim": { "branch": "main", "commit": "2cde745aadc2c36f6860a77a556494870675771a" }, "none-ls.nvim": { "branch": "main", "commit": "a8594ef3dabb484adabc0ebbf5800be1b807c9e7" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-colorizer.lua": { "branch": "master", "commit": "08bd34bf0ed79723f62764c7f9ca70516d461d0d" }, "nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-lspconfig": { "branch": "master", "commit": "e26da408cf955afa8e9ddbadd510e84ea8976cd7" }, "nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-neoclip.lua": { "branch": "main", "commit": "709c97fabec9da7d04f7d2f5e207423af8c02871" }, "nvim-neoclip.lua": { "branch": "main", "commit": "709c97fabec9da7d04f7d2f5e207423af8c02871" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-numbertoggle": { "branch": "main", "commit": "c5827153f8a955886f1b38eaea6998c067d2992f" }, "nvim-numbertoggle": { "branch": "main", "commit": "c5827153f8a955886f1b38eaea6998c067d2992f" },
"nvim-origami": { "branch": "main", "commit": "5d6b63bab5406e439937b04fc4ead201ba8dc88f" }, "nvim-origami": { "branch": "main", "commit": "5d6b63bab5406e439937b04fc4ead201ba8dc88f" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "4e387dd47833c1bb8c8df6c3a7cab0d4c55583f3" }, "nvim-treesitter": { "branch": "master", "commit": "2b4881286ad73c9ece7e5e4da130b2e4726c09fc" },
"nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" }, "nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, "nvim-web-devicons": { "branch": "master", "commit": "a2af6aa13a2ad3ad361d562a319a91bcd68c43a4" },
"oil.nvim": { "branch": "master", "commit": "9e5eb2fcd1dfee2ff30c89273ffff179e42034b9" }, "oil.nvim": { "branch": "master", "commit": "71c972fbd218723a3c15afcb70421f67340f5a6d" },
"outline.nvim": { "branch": "main", "commit": "2175b6da5b7b5be9de14fd3f54383a17f5e4609c" }, "outline.nvim": { "branch": "main", "commit": "2175b6da5b7b5be9de14fd3f54383a17f5e4609c" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"prettier.nvim": { "branch": "main", "commit": "d98e732cb73690b07c00c839c924be1d1d9ac5c2" }, "prettier.nvim": { "branch": "main", "commit": "d98e732cb73690b07c00c839c924be1d1d9ac5c2" },
"render-markdown": { "branch": "main", "commit": "5e4e33102b784353998c83d57dbacea4db71d55b" }, "render-markdown": { "branch": "main", "commit": "b75f681d675e21b5a09909997e9fffa6313c946e" },
"search.nvim": { "branch": "main", "commit": "27191f6c10a13c8018136b2490342d35960ed0ab" }, "search.nvim": { "branch": "main", "commit": "27191f6c10a13c8018136b2490342d35960ed0ab" },
"sg.nvim": { "branch": "master", "commit": "8bdd4d19da2268072708d5fe18fda9c23e16509d" }, "sg.nvim": { "branch": "master", "commit": "8bdd4d19da2268072708d5fe18fda9c23e16509d" },
"smart-open.nvim": { "branch": "0.2.x", "commit": "87626ee8748b9bba22093adec7bb58c63e7214f0" }, "smart-open.nvim": { "branch": "0.2.x", "commit": "87626ee8748b9bba22093adec7bb58c63e7214f0" },
@ -84,9 +84,9 @@
"telescope-undo.nvim": { "branch": "main", "commit": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" }, "telescope-undo.nvim": { "branch": "main", "commit": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" },
"todo-comments.nvim": { "branch": "main", "commit": "96fee098a90e7c09c9811aa7df71d773ba8b9b53" }, "todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
"trouble.nvim": { "branch": "main", "commit": "ad8ef38666834e9e438f84bd446657445bc2a71e" }, "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"twilight.nvim": { "branch": "main", "commit": "38dc017474ef05605ca14a2577e01e09f0db7133" }, "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"vim-cursorword": { "branch": "master", "commit": "34852083276c1fd9ff4cccaf052111e7d5a2472e" }, "vim-cursorword": { "branch": "master", "commit": "34852083276c1fd9ff4cccaf052111e7d5a2472e" },
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
"vim-markdown": { "branch": "master", "commit": "a657e697376909c41475a686eeef7fc7a4972d94" }, "vim-markdown": { "branch": "master", "commit": "a657e697376909c41475a686eeef7fc7a4972d94" },
@ -94,6 +94,6 @@
"vim-prosession": { "branch": "master", "commit": "4b8323d4e9b74afe9132a34b2d7ea6cfa9461550" }, "vim-prosession": { "branch": "master", "commit": "4b8323d4e9b74afe9132a34b2d7ea6cfa9461550" },
"vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" }, "vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" },
"vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }, "vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" },
"vim-wakatime": { "branch": "master", "commit": "d72aac70fcee172413f89621b65b5383bd845e4b" }, "vim-wakatime": { "branch": "master", "commit": "53bba6bb8342de9cbdafc82142a9b5e82008d858" },
"which-key.nvim": { "branch": "main", "commit": "6e61b0904e9c038b6c511c43591ae2d811b4975e" } "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
} }

View File

@ -46,14 +46,14 @@ vim.filetype.add({
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
@ -92,9 +92,9 @@ local plugins = {
-- 'folke/neodev.nvim', -- 'folke/neodev.nvim',
}, },
config = function(_, servers) config = function(_, servers)
for server, opts in pairs(servers) do for server, opts in pairs(servers) do
require('lspconfig')[server].setup(opts) require('lspconfig')[server].setup(opts)
end end
end, end,
}, },
{ {
@ -119,10 +119,10 @@ local plugins = {
}, },
init = function() vim.g.barbar_auto_setup = false end, init = function() vim.g.barbar_auto_setup = false end,
opts = { opts = {
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
animation = false, animation = false,
-- insert_at_start = true, -- insert_at_start = true,
-- …etc. -- …etc.
}, },
version = '^1.0.0', -- optional: only update when a new 1.x version is released version = '^1.0.0', -- optional: only update when a new 1.x version is released
}, },
@ -166,31 +166,31 @@ local plugins = {
}, },
}, },
{ {
"arielherself/arshamiser.nvim", -- status bar "arielherself/arshamiser.nvim", -- status bar
branch = "dev", branch = "dev",
dependencies = { dependencies = {
"arsham/arshlib.nvim", "arsham/arshlib.nvim",
"famiu/feline.nvim", "famiu/feline.nvim",
"rebelot/heirline.nvim", "rebelot/heirline.nvim",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
"nanotee/sqls.nvim", "nanotee/sqls.nvim",
"arsham/listish.nvim", "arsham/listish.nvim",
}, },
config = function() config = function()
require('gitsigns').setup() require('gitsigns').setup()
-- ignore any parts you don't want to use -- ignore any parts you don't want to use
vim.cmd.colorscheme("arshamiser_dark") vim.cmd.colorscheme("arshamiser_dark")
-- require("arshamiser.feliniser") -- require("arshamiser.feliniser")
-- or: -- or:
require("arshamiser.heirliniser") require("arshamiser.heirliniser")
_G.custom_foldtext = require("arshamiser.folding").foldtext _G.custom_foldtext = require("arshamiser.folding").foldtext
vim.opt.foldtext = "v:lua.custom_foldtext()" vim.opt.foldtext = "v:lua.custom_foldtext()"
-- if you want to draw a tabline: -- if you want to draw a tabline:
-- vim.api.nvim_set_option("tabline", [[%{%v:lua.require("arshamiser.tabline").draw()%}]]) -- vim.api.nvim_set_option("tabline", [[%{%v:lua.require("arshamiser.tabline").draw()%}]])
end, end,
}, },
{ {
'numToStr/Comment.nvim', -- `gc` for commenting 'numToStr/Comment.nvim', -- `gc` for commenting
@ -238,20 +238,20 @@ local plugins = {
'mawkler/modicator.nvim' -- highlight current line number 'mawkler/modicator.nvim' -- highlight current line number
}, },
{ {
"ecthelionvi/NeoColumn.nvim", -- highlight overflow columns? "ecthelionvi/NeoColumn.nvim", -- highlight overflow columns?
opts = {} opts = {}
}, },
{ {
"utilyre/barbecue.nvim", -- LSP winbar "utilyre/barbecue.nvim", -- LSP winbar
name = "barbecue", name = "barbecue",
version = "*", version = "*",
dependencies = { dependencies = {
"SmiteshP/nvim-navic", "SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons", -- optional dependency "nvim-tree/nvim-web-devicons", -- optional dependency
}, },
opts = { opts = {
-- configurations go here -- configurations go here
}, },
}, },
{ {
'akinsho/git-conflict.nvim', -- `GitConflictChooseOurs` 'akinsho/git-conflict.nvim', -- `GitConflictChooseOurs`
@ -259,25 +259,25 @@ local plugins = {
config = true, config = true,
}, },
{ {
'mrjones2014/legendary.nvim', 'mrjones2014/legendary.nvim',
-- since legendary.nvim handles all your keymaps/commands, -- since legendary.nvim handles all your keymaps/commands,
-- its recommended to load legendary.nvim before other plugins -- its recommended to load legendary.nvim before other plugins
priority = 10000, priority = 10000,
lazy = false, lazy = false,
-- sqlite is only needed if you want to use frecency sorting -- sqlite is only needed if you want to use frecency sorting
-- dependencies = { 'kkharji/sqlite.lua' } -- dependencies = { 'kkharji/sqlite.lua' }
}, },
{ {
'stevearc/dressing.nvim', -- better UI 'stevearc/dressing.nvim', -- better UI
opts = {}, opts = {},
}, },
{ {
"folke/twilight.nvim", -- Focus on parts that's being edited "folke/twilight.nvim", -- Focus on parts that's being edited
opts = { opts = {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
} }
}, },
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
{ 'arielherself/vim-cursorword' }, { 'arielherself/vim-cursorword' },
@ -302,26 +302,26 @@ local plugins = {
end end
}, },
{ {
"folke/trouble.nvim", -- TroubleToggle "folke/trouble.nvim", -- TroubleToggle
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
opts = { opts = {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
}, },
}, },
{ "arielherself/melange-nvim" }, { "arielherself/melange-nvim" },
{ 'hrsh7th/vim-vsnip' }, { 'hrsh7th/vim-vsnip' },
{ {
"NeogitOrg/neogit", -- <C-g> "NeogitOrg/neogit", -- <C-g>
dependencies = { dependencies = {
"sindrets/diffview.nvim", -- optional - Diff integration "sindrets/diffview.nvim", -- optional - Diff integration
-- Only one of these is needed, not both. -- Only one of these is needed, not both.
"nvim-telescope/telescope.nvim", -- optional "nvim-telescope/telescope.nvim", -- optional
"ibhagwan/fzf-lua", -- optional "ibhagwan/fzf-lua", -- optional
}, },
config = true config = true
}, },
-- { 'Exafunction/codeium.vim' }, -- { 'Exafunction/codeium.vim' },
{ {
@ -339,34 +339,34 @@ local plugins = {
}, },
{ 'debugloop/telescope-undo.nvim' }, { 'debugloop/telescope-undo.nvim' },
{ {
"folke/lazydev.nvim", -- Autocompletion when editing Neovim configs or developing plugins "folke/lazydev.nvim", -- Autocompletion when editing Neovim configs or developing plugins
ft = "lua", -- only load on lua files ft = "lua", -- only load on lua files
opts = { opts = {
library = { library = {
-- lazypath .. "/luvit-meta/library", -- see below -- lazypath .. "/luvit-meta/library", -- see below
-- You can also add plugins you always want to have loaded. -- You can also add plugins you always want to have loaded.
-- Useful if the plugin has globals or types you want to use -- Useful if the plugin has globals or types you want to use
-- vim.env.LAZY .. "/LazyVim", -- see below -- vim.env.LAZY .. "/LazyVim", -- see below
},
}, },
},
}, },
{ "Bilal2453/luvit-meta", lazy = true }, { "Bilal2453/luvit-meta", lazy = true },
{ {
"AckslD/nvim-neoclip.lua", -- `<leader>p` "AckslD/nvim-neoclip.lua", -- `<leader>p`
}, },
{ {
"danielfalk/smart-open.nvim", -- sort file search results by frequency "danielfalk/smart-open.nvim", -- sort file search results by frequency
branch = "0.2.x", branch = "0.2.x",
config = function() config = function()
require("telescope").load_extension("smart_open") require("telescope").load_extension("smart_open")
end, end,
dependencies = { dependencies = {
"kkharji/sqlite.lua", "kkharji/sqlite.lua",
-- Only required if using match_algorithm fzf -- Only required if using match_algorithm fzf
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
-- Optional. If installed, native fzy will be used when match_algorithm is fzy -- Optional. If installed, native fzy will be used when match_algorithm is fzy
{ "nvim-telescope/telescope-fzy-native.nvim" }, { "nvim-telescope/telescope-fzy-native.nvim" },
}, },
}, },
{ {
"chrisgrieser/nvim-origami", -- Fold keymap "chrisgrieser/nvim-origami", -- Fold keymap
@ -408,25 +408,25 @@ local plugins = {
end, end,
}, },
{ {
'stevearc/oil.nvim', 'stevearc/oil.nvim',
opts = {}, opts = {},
-- Optional dependencies -- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
}, },
{ {
"aznhe21/actions-preview.nvim", "aznhe21/actions-preview.nvim",
config = function() config = function()
vim.keymap.set({ "v", "n" }, "<leader>a", require("actions-preview").code_actions) vim.keymap.set({ "v", "n" }, "<leader>a", require("actions-preview").code_actions)
end, end,
}, },
{ "neovimhaskell/haskell-vim" }, { "neovimhaskell/haskell-vim" },
{ {
"hedyhli/markdown-toc.nvim", "hedyhli/markdown-toc.nvim",
ft = "markdown", -- Lazy load on markdown filetype ft = "markdown", -- Lazy load on markdown filetype
cmd = { "Mtoc" }, -- Or, lazy load on "Mtoc" command cmd = { "Mtoc" }, -- Or, lazy load on "Mtoc" command
opts = { opts = {
-- Your configuration here (optional) -- Your configuration here (optional)
}, },
}, },
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
@ -540,31 +540,33 @@ config.setup({
-- import nvim-cmp plugin safely -- import nvim-cmp plugin safely
local cmp_status, cmp = pcall(require, "cmp") local cmp_status, cmp = pcall(require, "cmp")
if not cmp_status then if not cmp_status then
return return
end end
-- import luasnip plugin safely -- import luasnip plugin safely
local luasnip_status, luasnip = pcall(require, "luasnip") local luasnip_status, luasnip = pcall(require, "luasnip")
if not luasnip_status then if not luasnip_status then
return return
end end
vim.opt.completeopt = "menu,menuone,noselect" vim.opt.completeopt = "menu,menuone,noselect"
local has_words_before = function() local has_words_before = function()
unpack = unpack or table.unpack unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local is_empty_line = function()
unpack = unpack or table.unpack
local line, _ = unpack(vim.api.nvim_win_get_cursor(0))
return vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:match("%S") == nil
end end
local feedkey = function(key, mode) local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end end
local ELLIPSIS_CHAR = ''
local MAX_LABEL_WIDTH = 20
local MIN_LABEL_WIDTH = 20
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -574,7 +576,11 @@ cmp.setup {
mapping = { mapping = {
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.confirm({ select = true }) if not is_empty_line() then
cmp.confirm({ select = true })
else
fallback()
end
elseif luasnip_status and luasnip.expand_or_jumpable() then elseif luasnip_status and luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
@ -636,14 +642,14 @@ lspconfig.tsserver.setup {
} }
lspconfig.rust_analyzer.setup { lspconfig.rust_analyzer.setup {
capabilities = capabilities, capabilities = capabilities,
-- Server-specific settings. See `:help lspconfig-setup` -- Server-specific settings. See `:help lspconfig-setup`
settings = { settings = {
['rust-analyzer'] = { ['rust-analyzer'] = {
checkOnSave = { checkOnSave = {
command = 'clippy', command = 'clippy',
} }
},
}, },
},
} }
lspconfig.hls.setup {} lspconfig.hls.setup {}
lspconfig.lua_ls.setup { lspconfig.lua_ls.setup {
@ -660,7 +666,7 @@ lspconfig.mojo.setup {}
capabilities.workspace = { capabilities.workspace = {
didChangeWatchedFiles = { didChangeWatchedFiles = {
dynamicRegistration = true, dynamicRegistration = true,
}, },
} }
require("lspconfig").markdown_oxide.setup({ require("lspconfig").markdown_oxide.setup({
@ -688,29 +694,29 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys -- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}), group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev) callback = function(ev)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings. -- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf } local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts) vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function() vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts) end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts) vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
end, end,
}) })
require("lsp_signature").setup({ require("lsp_signature").setup({
@ -767,24 +773,24 @@ vim.api.nvim_create_user_command('SearchInCurrentFile', function()
end, {}) end, {})
vim.api.nvim_create_user_command('PopupSaveas', function() vim.api.nvim_create_user_command('PopupSaveas', function()
vim.ui.input({ prompt = 'Save As: ' }, function(input) vim.ui.input({ prompt = 'Save As: ' }, function(input)
if input ~= nil then if input ~= nil then
if vim.fn.filereadable(input) == 1 then if vim.fn.filereadable(input) == 1 then
local choice = vim.fn.input('File exists. Overwrite? ([y]/n): ') local choice = vim.fn.input('File exists. Overwrite? ([y]/n): ')
if choice ~= 'n' then if choice ~= 'n' then
vim.cmd('saveas! ' .. input) vim.cmd('saveas! ' .. input)
print('File overwritten: ' .. input) print('File overwritten: ' .. input)
else
print('Cancelled')
end
else
vim.cmd('saveas ' .. input)
print('File saved as: ' .. input)
end
else else
print('Cancelled') print('Save As cancelled')
end end
else end)
vim.cmd('saveas ' .. input)
print('File saved as: ' .. input)
end
else
print('Save As cancelled')
end
end)
end, {}) end, {})
require("nvim-treesitter.configs").setup { require("nvim-treesitter.configs").setup {
@ -803,88 +809,88 @@ require("nvim-treesitter.configs").setup {
}, },
textobjects = { textobjects = {
select = { select = {
enable = true, enable = true,
lookahead = false, lookahead = false,
keymaps = { keymaps = {
-- You can use the capture groups defined in textobjects.scm -- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer", ["af"] = "@function.outer",
["if"] = "@function.inner", ["if"] = "@function.inner",
["ac"] = "@class.outer", ["ac"] = "@class.outer",
-- You can optionally set descriptions to the mappings (used in the desc parameter of -- You can optionally set descriptions to the mappings (used in the desc parameter of
-- nvim_buf_set_keymap) which plugins like which-key display -- nvim_buf_set_keymap) which plugins like which-key display
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
-- You can also use captures from other query groups like `locals.scm` -- You can also use captures from other query groups like `locals.scm`
["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
}, },
-- You can choose the select mode (default is charwise 'v') -- You can choose the select mode (default is charwise 'v')
-- --
-- Can also be a function which gets passed a table with the keys -- Can also be a function which gets passed a table with the keys
-- * query_string: eg '@function.inner' -- * query_string: eg '@function.inner'
-- * method: eg 'v' or 'o' -- * method: eg 'v' or 'o'
-- and should return the mode ('v', 'V', or '<c-v>') or a table -- and should return the mode ('v', 'V', or '<c-v>') or a table
-- mapping query_strings to modes. -- mapping query_strings to modes.
selection_modes = { selection_modes = {
['@parameter.outer'] = 'v', -- charwise ['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise ['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise ['@class.outer'] = '<c-v>', -- blockwise
}, },
-- If you set this to `true` (default is `false`) then any textobject is -- If you set this to `true` (default is `false`) then any textobject is
-- extended to include preceding or succeeding whitespace. Succeeding -- extended to include preceding or succeeding whitespace. Succeeding
-- whitespace has priority in order to act similarly to eg the built-in -- whitespace has priority in order to act similarly to eg the built-in
-- `ap`. -- `ap`.
-- --
-- Can also be a function which gets passed a table with the keys -- Can also be a function which gets passed a table with the keys
-- * query_string: eg '@function.inner' -- * query_string: eg '@function.inner'
-- * selection_mode: eg 'v' -- * selection_mode: eg 'v'
-- and should return true or false -- and should return true or false
include_surrounding_whitespace = false, include_surrounding_whitespace = false,
}, },
swap = { swap = {
enable = true, enable = true,
swap_next = { swap_next = {
["]]"] = "@parameter.inner", ["]]"] = "@parameter.inner",
}, },
swap_previous = { swap_previous = {
["[["] = "@parameter.inner", ["[["] = "@parameter.inner",
}, },
}, },
move = { move = {
enable = true, enable = true,
set_jumps = true, -- whether to set jumps in the jumplist set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = { goto_next_start = {
["]m"] = "@function.outer", ["]m"] = "@function.outer",
["]c"] = { query = "@class.outer", desc = "Next class start" }, ["]c"] = { query = "@class.outer", desc = "Next class start" },
-- --
-- You can use regex matching (i.e. lua pattern) and/or pass a list in a "query" key to group multiple queires. -- You can use regex matching (i.e. lua pattern) and/or pass a list in a "query" key to group multiple queires.
["]o"] = "@loop.*", ["]o"] = "@loop.*",
-- ["]o"] = { query = { "@loop.inner", "@loop.outer" } } -- ["]o"] = { query = { "@loop.inner", "@loop.outer" } }
-- --
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path. -- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
}, },
goto_next_end = { goto_next_end = {
["]M"] = "@function.outer", ["]M"] = "@function.outer",
["]C"] = "@class.outer", ["]C"] = "@class.outer",
}, },
goto_previous_start = { goto_previous_start = {
["[m"] = "@function.outer", ["[m"] = "@function.outer",
["[c"] = "@class.outer", ["[c"] = "@class.outer",
}, },
goto_previous_end = { goto_previous_end = {
["[M"] = "@function.outer", ["[M"] = "@function.outer",
["[C"] = "@class.outer", ["[C"] = "@class.outer",
}, },
-- Below will go to either the start or the end, whichever is closer. -- Below will go to either the start or the end, whichever is closer.
-- Use if you want more granular movements -- Use if you want more granular movements
-- Make it even more gradual by adding multiple queries and regex. -- Make it even more gradual by adding multiple queries and regex.
goto_next = { goto_next = {
["]d"] = "@conditional.outer", ["]d"] = "@conditional.outer",
}, },
goto_previous = { goto_previous = {
["[d"] = "@conditional.outer", ["[d"] = "@conditional.outer",
} }
}, },
}, },
endwise = { enable = true, }, endwise = { enable = true, },
@ -921,8 +927,8 @@ cmp.setup {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = 'symbol_text', -- show only symbol annotations mode = 'symbol_text', -- show only symbol annotations
maxwidth = 30, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 30, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as -- can also be a function to dynamically calculate max width such as
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
ellipsis_char = '', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) ellipsis_char = '', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
show_labelDetails = true, -- show labelDetails in menu. Disabled by default show_labelDetails = true, -- show labelDetails in menu. Disabled by default
@ -955,44 +961,44 @@ local eslint = require("eslint")
null_ls.setup() null_ls.setup()
eslint.setup({ eslint.setup({
bin = 'eslint', -- or `eslint_d` bin = 'eslint', -- or `eslint_d`
code_actions = { code_actions = {
enable = true, enable = true,
apply_on_save = { apply_on_save = {
enable = true, enable = true,
types = { "directive", "problem", "suggestion", "layout" }, types = { "directive", "problem", "suggestion", "layout" },
},
disable_rule_comment = {
enable = true,
location = "separate_line", -- or `same_line`
},
}, },
disable_rule_comment = { diagnostics = {
enable = true, enable = true,
location = "separate_line", -- or `same_line` report_unused_disable_directives = false,
run_on = "type", -- or `save`
}, },
},
diagnostics = {
enable = true,
report_unused_disable_directives = false,
run_on = "type", -- or `save`
},
}) })
local prettier = require("prettier") local prettier = require("prettier")
prettier.setup({ prettier.setup({
bin = 'prettier', -- or `'prettierd'` (v0.23.3+) bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
filetypes = { filetypes = {
"css", "css",
"graphql", "graphql",
"html", "html",
"javascript", "javascript",
"javascriptreact", "javascriptreact",
"json", "json",
"less", "less",
"markdown", "markdown",
"scss", "scss",
"typescript", "typescript",
"typescriptreact", "typescriptreact",
"yaml", "yaml",
"vue", "vue",
}, },
}) })
require("outline").setup() require("outline").setup()
@ -1000,7 +1006,7 @@ require("outline").setup()
require("todo-comments").setup() require("todo-comments").setup()
lspconfig.volar.setup{ lspconfig.volar.setup{
filetypes = {'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json'} filetypes = {'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json'}
} }
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
@ -1090,24 +1096,24 @@ vim.api.nvim_create_autocmd("LspAttach", {
require('neoclip').setup {} require('neoclip').setup {}
require("oil").setup{ require("oil").setup{
columns = { columns = {
"icon", "icon",
"permissions", "permissions",
"size", "size",
"mtime", "mtime",
}, },
win_options = { win_options = {
signcolumn = "yes", signcolumn = "yes",
}, },
view_options = { view_options = {
show_hidden = true, show_hidden = true,
}, },
constrain_cursor = "editable", constrain_cursor = "editable",
keymaps = { keymaps = {
["<C-v>"] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" }, ["<C-v>"] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" },
["<C-x>"] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" }, ["<C-x>"] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" },
["<C-t>"] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, ["<C-t>"] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" },
}, },
} }
-- refresh codelens on TextChanged and InsertLeave as well -- refresh codelens on TextChanged and InsertLeave as well

View File

@ -288,3 +288,15 @@ ls.add_snippets(nil, {
} }
}) })
local lca = require('snippets.lca')
ls.add_snippets(nil, {
cpp = {
snip({
trig = 'lca',
namr = 'lca',
dscr = 'LCA',
},{
text(lines(lca))
})
}
})

50
nvim/lua/snippets/lca.lua Normal file
View File

@ -0,0 +1,50 @@
return [=[
struct LCA {
vector<int> depth;
vector<vector<int>> pa;
LCA(const vector<vector<int>>& g, int root = 1) {
int n = g.size() - 1;
int m = 32 - __builtin_clz(n);
depth.resize(n + 1);
pa.resize(n + 1, vector<int>(m, -1));
function<void(int, int)> dfs = [&](int x, int fa) {
pa[x][0] = fa;
for (int y: g[x]) {
if (y != fa) {
depth[y] = depth[x] + 1;
dfs(y, x);
}
}
};
dfs(root, 0);
for (int i = 0; i < m - 1; i++)
for (int x = 1; x <= n; x++)
if (int p = pa[x][i]; p != -1)
pa[x][i + 1] = pa[p][i];
}
int get_kth_ancestor(int node, int k) {
for (; k; k &= k - 1)
node = pa[node][__builtin_ctz(k)];
return node;
}
int query(int x, int y) {
if (depth[x] > depth[y])
swap(x, y);
y = get_kth_ancestor(y, depth[y] - depth[x]);
if (y == x)
return x;
for (int i = pa[x].size() - 1; i >= 0; i--) {
int px = pa[x][i], py = pa[y][i];
if (px != py) {
x = px;
y = py;
}
}
return pa[x][0];
}
};
]=]

View File

@ -187,7 +187,7 @@
}, },
"custom/waybar-mpris": { "custom/waybar-mpris": {
"return-type": "json", "return-type": "json",
"exec": "waybar-mpris --position --autofocus --order 'SYMBOL:TITLE:ARTIST:POSITION'", "exec": "waybar-mpris --position --autofocus --order 'SYMBOL:POSITION:TITLE:ARTIST'",
"on-click": "waybar-mpris --send toggle", "on-click": "waybar-mpris --send toggle",
// This option will switch between players on right click. // This option will switch between players on right click.
"on-click-right": "waybar-mpris --send player-next", "on-click-right": "waybar-mpris --send player-next",
@ -198,6 +198,7 @@
// "on-scroll-up": "waybar-mpris --send next", // "on-scroll-up": "waybar-mpris --send next",
// "on-scroll-down": "waybar-mpris --send prev", // "on-scroll-down": "waybar-mpris --send prev",
"escape": true, "escape": true,
"max-length": 50,
}, },
"custom/clock": { "custom/clock": {
"exec": "LC_TIME=en_US.UTF8 date +'%-m-%-d[%a] %H:%M'", "exec": "LC_TIME=en_US.UTF8 date +'%-m-%-d[%a] %H:%M'",