From 9d3fedc35dd8a585a25e460864dbb91f004adb14 Mon Sep 17 00:00:00 2001 From: rayanramoul Date: Thu, 13 Jun 2024 21:54:19 +0200 Subject: [PATCH] feat: add lazygit --- dotfiles/.config/alacritty/alacritty.toml | 8 +-- dotfiles/.config/nvim/lazy-lock.json | 86 ++++++++++++----------- dotfiles/.config/nvim/lua/ray/lazy.lua | 40 ++++++++++- dotfiles/.oh-my-zsh | 2 +- dotfiles/.zshrc | 33 +-------- dotfiles/scripts/executioner.sh | 36 ++++++++++ dotfiles/scripts/tmux-sessionizer.sh | 28 ++++++++ 7 files changed, 154 insertions(+), 79 deletions(-) create mode 100644 dotfiles/scripts/executioner.sh create mode 100755 dotfiles/scripts/tmux-sessionizer.sh diff --git a/dotfiles/.config/alacritty/alacritty.toml b/dotfiles/.config/alacritty/alacritty.toml index bd2b49c..f986dee 100644 --- a/dotfiles/.config/alacritty/alacritty.toml +++ b/dotfiles/.config/alacritty/alacritty.toml @@ -38,19 +38,19 @@ color = '#db4b4b' size = 18 [font.bold] -family = "FiraCode Nerd Font" +family = "JetBrainsMono NF" style = "Bold" [font.bold_italic] -family = "FiraCode Nerd Font" +family = "JetBrainsMono NF" style = "Bold Italic" [font.italic] -family = "FiraCode Nerd Font" +family = "JetBrainsMono NF" style = "Regular Italic" [font.normal] -family = "FiraCode Nerd Font" +family = "JetBrainsMono NF" style = "Regular" [font.offset] diff --git a/dotfiles/.config/nvim/lazy-lock.json b/dotfiles/.config/nvim/lazy-lock.json index b2760ae..ee6f1aa 100644 --- a/dotfiles/.config/nvim/lazy-lock.json +++ b/dotfiles/.config/nvim/lazy-lock.json @@ -1,61 +1,65 @@ { - "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, - "auto-session": { "branch": "main", "commit": "9e0a169b6fce8791278abbd110717b921afe634d" }, - "bufferline.nvim": { "branch": "main", "commit": "f4b4b980ce88d546aeb69d11463187c8f716a1a1" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "auto-session": { "branch": "main", "commit": "af2219b9fa99c1d7ac409bd9eac094c459d3f52d" }, + "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "a6965ac128eba75537ec2bc5ddd5d5e357062bdc" }, - "copilot.vim": { "branch": "release", "commit": "1e135c5303bc60598f6314a2276f31dc91aa34dd" }, - "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, - "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, - "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" }, - "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, - "git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" }, - "git-conflict.nvim": { "branch": "main", "commit": "4c8e252b87d54d944c1e56bfb477f78b6fdaf661" }, - "gitsigns.nvim": { "branch": "main", "commit": "035da036e68e509ed158414416c827d022d914bd" }, + "conform.nvim": { "branch": "master", "commit": "797d1f622a23d4a21bb58218bdf5999a9beac4ef" }, + "copilot.vim": { "branch": "release", "commit": "88d08cf54f623341adde4b18362bffc95174dcd5" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "e3714c8049b2243e792492c4149e4cc395c68eb9" }, + "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, + "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, + "git-blame.nvim": { "branch": "master", "commit": "408d5487d908dfe5d48e5645d8b27ddcc16b11e0" }, + "git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" }, + "gitsigns.nvim": { "branch": "main", "commit": "47c8e3e571376b24de62408fd0c9d12f0a9fc0a3" }, "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, - "highlight-undo.nvim": { "branch": "main", "commit": "50a6884a8476be04ecce8f1c4ed692c5000ef0a1" }, - "hlargs.nvim": { "branch": "main", "commit": "0f2dbf02ff948e8fc8ebe07b215f3174a12bbe3c" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, - "leap.nvim": { "branch": "main", "commit": "626be4c4ec040aeaf6466c9aae17ee0ab09f1a5b" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "b93f040edd57888cd6a1e7d9dee47dddc4463f8f" }, + "highlight-undo.nvim": { "branch": "main", "commit": "1ea1c79372d7d93c88fd97543880927b7635e3d2" }, + "hlargs.nvim": { "branch": "main", "commit": "30fe1b3de2b7614f061be4fc9c71984a2b87e50a" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" }, + "lazygit.nvim": { "branch": "main", "commit": "ad3e1ea592f9d13e86e0d4e850224d9d78069508" }, + "leap.nvim": { "branch": "main", "commit": "24935d06c7e06bf8929feb24a3525cd128fc0cc4" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, "lsp_lines.nvim": { "branch": "main", "commit": "3b57922d2d79762e6baedaf9d66d8ba71f822816" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, - "lspsaga.nvim": { "branch": "main", "commit": "f20985499cd8ff0fbbfe8e7c770428ef764fc3be" }, + "lspsaga.nvim": { "branch": "main", "commit": "6f920cfabddb9b7de5a3a4d0b7cd4f0774ae23e2" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "b129892f783740e6cf741f2ea09fa5dd512aa584" }, - "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, - "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, + "neodev.nvim": { "branch": "main", "commit": "02893eeb9d6e8503817bd52385e111cba9a90500" }, + "noice.nvim": { "branch": "main", "commit": "f65b6b7ab87796f93ea8f8a92d5a64dc53d912d1" }, + "nui.nvim": { "branch": "main", "commit": "322978c734866996274467de084a95e4f9b5e0b1" }, + "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, + "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-conda": { "branch": "main", "commit": "7e63124d98f48a3bb255eaa71d1602db610b9047" }, - "nvim-lint": { "branch": "master", "commit": "f098232d70cebe90e27404928c9bc19ca7a5a7b5" }, - "nvim-lspconfig": { "branch": "master", "commit": "ed8b8a15acc441aec669f97d75f2c1f2ac8c8aa5" }, - "nvim-puppeteer": { "branch": "main", "commit": "ea340595967919222f3ba5c6c6def0787a336c82" }, + "nvim-lint": { "branch": "master", "commit": "941fa1220a61797a51f3af9ec6b7d74c8c7367ce" }, + "nvim-lspconfig": { "branch": "master", "commit": "37f362ef42d1a604d332e8d3d7d47593852b4313" }, + "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, + "nvim-puppeteer": { "branch": "main", "commit": "b51baeae3b9bff483eea4cd3c47cc4c0cf85aecd" }, "nvim-toc": { "branch": "main", "commit": "afc27debc800129c50c5b870846ce1a5c9ce4479" }, - "nvim-tree.lua": { "branch": "master", "commit": "ae8e46e8fabb32fa3ae5319383ea2c8763f14caa" }, - "nvim-treesitter": { "branch": "master", "commit": "28aebb7308a3b3070d38d7041f692469b7f37e6c" }, - "nvim-web-devicons": { "branch": "master", "commit": "beb6367ab8496c9e43f22e0252735fdadae1872d" }, - "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, + "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, + "nvim-treesitter": { "branch": "master", "commit": "8dd40c7609c04d7bad7eb21d71f78c3fa4dc1c2c" }, + "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "refactoring.nvim": { "branch": "master", "commit": "d2786877c91aa409c824f27b4ce8a9f560dda60a" }, - "rose-pine": { "branch": "main", "commit": "17b466e79479758b332a3cac12544a3ad2be6241" }, + "rose-pine": { "branch": "main", "commit": "8c4660cfe697621bcc61d37b3651ffed94fe7fed" }, "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, "telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, - "tmux.nvim": { "branch": "main", "commit": "63e9c5e054099dd30af306bd8ceaa2f1086e1b07" }, - "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "tokyodark": { "branch": "master", "commit": "ba538ab69e8a4e3ebac127734b7deff9e7462463" }, - "tokyonight.nvim": { "branch": "main", "commit": "67afeaf7fd6ebba000633e89f63c31694057edde" }, + "tmux.nvim": { "branch": "main", "commit": "3787752613777b96111ba02e24cbcfdcc6ebd57a" }, + "todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" }, + "tokyodark": { "branch": "master", "commit": "14bc1b3e596878a10647af7c82de7736300f3322" }, + "tokyonight.nvim": { "branch": "main", "commit": "81c867c5f638597a82c82094dcb90ed42444dabc" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, - "vim-fugitive": { "branch": "master", "commit": "dac8e5c2d85926df92672bf2afb4fc48656d96c7" }, - "vim-tmux-navigator": { "branch": "master", "commit": "a26954a585b02a2ac02f87145e204f8798a7cbc2" }, + "vim-fugitive": { "branch": "master", "commit": "64d6cafb9dcbacce18c26d7daf617ebb96b273f3" }, + "vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } \ No newline at end of file diff --git a/dotfiles/.config/nvim/lua/ray/lazy.lua b/dotfiles/.config/nvim/lua/ray/lazy.lua index 82a1da2..d54869d 100644 --- a/dotfiles/.config/nvim/lua/ray/lazy.lua +++ b/dotfiles/.config/nvim/lua/ray/lazy.lua @@ -1,5 +1,5 @@ return { - { 'nvim-telescope/telescope.nvim', tag = '0.1.3', dependencies = { 'nvim-lua/plenary.nvim' } }, { 'rose-pine/neovim', name = 'rose-pine' }, { + { 'nvim-telescope/telescope.nvim', tag = '0.1.3', dependencies = { 'nvim-lua/plenary.nvim' } }, { 'rose-pine/neovim', name = 'rose-pine' }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() @@ -30,7 +30,7 @@ return { }, -- lazy.nvim -- { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - { "tiagovla/tokyodark.nvim", name = "tokyodark", priority = 1000 }, + { "tiagovla/tokyodark.nvim", name = "tokyodark", priority = 1000 }, { 'rose-pine/neovim', name = 'rose-pine' }, { "folke/tokyonight.nvim", @@ -39,7 +39,7 @@ return { opts = {}, }, { 'nvim-tree/nvim-tree.lua' }, - { 'akinsho/bufferline.nvim', version = "*", dependencies = 'nvim-tree/nvim-web-devicons' }, + { 'akinsho/bufferline.nvim', version = "*", dependencies = 'nvim-tree/nvim-web-devicons' }, { 'ThePrimeagen/harpoon' }, { "ThePrimeagen/refactoring.nvim", @@ -229,4 +229,38 @@ return { build = "make install_jsregexp" }, { "rafamadriz/friendly-snippets", }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "gg", "LazyGit", desc = "LazyGit" } + } + }, + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + } + } } diff --git a/dotfiles/.oh-my-zsh b/dotfiles/.oh-my-zsh index fb91ca2..a599c6a 160000 --- a/dotfiles/.oh-my-zsh +++ b/dotfiles/.oh-my-zsh @@ -1 +1 @@ -Subproject commit fb91ca27a2d65b834e98a3986cfee73ad82ea412 +Subproject commit a599c6a4d1f47e7156b581b7ab2eea03213dba00 diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index 53e178e..35f8652 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -106,39 +106,12 @@ alias ls="lsd" # replace rm with trash-cli alias rm="trash-put" -bindkey -s ^e 'selected_entry=$(find $HOME/Downloads $HOME/Documents -maxdepth 8 -type f -o -type d | fzf); [ -n "$selected_entry" ] && { [ -d "$selected_entry" ] && cd "$selected_entry" || vim "$selected_entry"; }\n' +bindkey -s ^e 'selected_entry=$(find $HOME/Downloads $HOME/Documents -maxdepth 8 -type f -o -type d | fzf --preview "bat --style=numbers --color=always --line-range=:500 {}" --preview-window=right:60%); [ -n "$selected_entry" ] && { [ -d "$selected_entry" ] && cd "$selected_entry" || vim "$selected_entry"; }\n' +# now Ctrl + e will execute ~/scripts/tmux_sessionizer.sh +bindkey -s ^f 'tmux-sessionizer\n' -# Define the tmux-sessionizer function -tmux-sessionizer() { - if [[ $# -eq 1 ]]; then - selected=$1 - else - # Use find with exclusion - selected=$(find $HOME/Downloads $HOME/RayTerm $HOME/Documents -mindepth 1 -maxdepth 9 -type d | fzf) - fi - - if [[ -z $selected ]]; then - exit 0 - fi - - selected_name=$(basename "$selected" | tr . _) - tmux_running=$(pgrep tmux) - if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then - tmux new-session -s $selected_name -c $selected - exit 0 - fi - - if ! tmux has-session -t=$selected_name 2> /dev/null; then - tmux new-session -ds $selected_name -c $selected - fi - - tmux switch-client -t $selected_name -} -zle -N tmux-sessionizer -# Bind Ctrl+F to tmux-sessionizer function -bindkey '^f' tmux-sessionizer # FZF THEME diff --git a/dotfiles/scripts/executioner.sh b/dotfiles/scripts/executioner.sh new file mode 100644 index 0000000..97510ea --- /dev/null +++ b/dotfiles/scripts/executioner.sh @@ -0,0 +1,36 @@ +#/bin/bash +# Change to the root of the project directory +cd "$(git rev-parse --show-toplevel 2>/dev/null || echo ".")" + +# Function to run bash, python scripts based on existence +run_project() { + if [ -f "run.sh" ] || [ -f "start.sh" ]; then + bash run.sh || bash start.sh + elif [ -f "main.py" ] || [ -f "run.py" ] || [ -f "app.py" ] || [ -f "start.py" ]; then + python main.py || python run.py || python app.py || python start.py + + else + echo "No recognized run script found in the project directory." + fi + # Keep the tmux pane open after the command has finished +} + +run_tests() { + if [ -f "test.sh" ]; then + bash test.sh + # check if there is a tests folder if so pytest it + elif [ -d "tests" ]; then + pytest tests + else + echo "No recognized test script found in the project directory." + fi + # Keep the tmux pane open after the command has finished +} +# check for presence of -t flag +if [ "$1" == "-t" ]; then + run_tests +else + run_project +fi + +read -n 1 -s -r -p "Press any key to exit." diff --git a/dotfiles/scripts/tmux-sessionizer.sh b/dotfiles/scripts/tmux-sessionizer.sh new file mode 100755 index 0000000..ddb79f3 --- /dev/null +++ b/dotfiles/scripts/tmux-sessionizer.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + + +if [[ $# -eq 1 ]]; then + selected=$1 +else + # Use find with exclusion + selected=$(find $HOME/Downloads $HOME/RayTerm $HOME/Documents -mindepth 1 -maxdepth 9 -type d | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t=$selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +tmux switch-client -t $selected_name +