From 8064f04385d048948a3be7dd97556dcfadbef758 Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 22 May 2024 09:16:14 +0300 Subject: [PATCH] feat(git): alias s for unstage files --- home/user/.config/git/config | 1 + .../.config/nvim/lua/plugins/telescope.lua | 228 +++++++++--------- 2 files changed, 117 insertions(+), 112 deletions(-) diff --git a/home/user/.config/git/config b/home/user/.config/git/config index 49ef521..391f5e3 100644 --- a/home/user/.config/git/config +++ b/home/user/.config/git/config @@ -45,6 +45,7 @@ [alias] a = "!git ls-files --exclude-standard -m --others -t | fzf -m --bind load:last --preview 'git diff --color=always {2}' | cut -d' ' -f2 | xargs git add" + s = "!git diff --name-only --cached | fzf -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs git restore --staged" d = diff di = diff ds = diff --staged diff --git a/home/user/.config/nvim/lua/plugins/telescope.lua b/home/user/.config/nvim/lua/plugins/telescope.lua index 1bac0ca..d143172 100644 --- a/home/user/.config/nvim/lua/plugins/telescope.lua +++ b/home/user/.config/nvim/lua/plugins/telescope.lua @@ -1,117 +1,121 @@ return { - 'nvim-telescope/telescope.nvim', - enabled = vim.fn.executable "fzf" == 1, - dependencies = { - 'nvim-lua/plenary.nvim', - { - 'nvim-telescope/telescope-fzf-native.nvim', - enabled = vim.fn.executable "make" == 1, - build = "make" - } - }, - keys = { - { 'fb', 'Telescope buffers' }, - { 'ff', 'Telescope find_files' }, - { 'fg', 'Telescope live_grep' }, - { 'fc', 'Telescope git_commits' }, - { 'fd', 'Telescope diagnostics' }, - }, - config = function() - local telescope = require("telescope") - local actions = require("telescope.actions") - - telescope.load_extension("fzf") - - telescope.setup({ - pickers = { - find_files = { - hidden = true, - }, + { + 'nvim-telescope/telescope.nvim', + enabled = vim.fn.executable("fzf") == 1, + dependencies = { + { + 'nvim-lua/plenary.nvim', }, - defaults = { - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.preview_scrolling_down, - [""] = actions.preview_scrolling_up, - [""] = actions.toggle_all, - ["?"] = actions.which_key, - ["jf"] = { "", type = "command" }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + enabled = vim.fn.executable("make") == 1, + build = "make" + }, + }, + keys = { + { 'fb', 'Telescope buffers' }, + { 'ff', 'Telescope find_files' }, + { 'fg', 'Telescope live_grep' }, + { 'fc', 'Telescope git_commits' }, + { 'fd', 'Telescope diagnostics' }, + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + + telescope.load_extension("fzf") + + telescope.setup({ + pickers = { + find_files = { + hidden = true, }, - n = { - ["jf"] = actions.close, - ["?"] = actions.which_key, - } }, - selection_caret = " ", - path_display = { "truncate" }, - file_ignore_patterns = { - ".git/", - ".svn/", - "%.o", - "%.a", - "%.so", - "a.out", - "venv/", - "CMakeFiles/", - "cmake_install.cmake", - "CMakeCache.txt", - "target/", - ".pytest_cache/", - "vendor/*", - "%.lock", - "%.db", - "%.sqlite3", - "%.sqlite", - "%.ipynb", - "%.svg", - "%.burp", - "%.mp4", - "%.png", - "%.jpeg", - "%.jpg", - "%.gif", - "%.mkv", - "%.otf", - "%.ttf", - "%.webp", - "%.bin", - ".dart_tool/", - ".gradle/", - ".idea/", - ".settings/", - ".vscode/", - "pycache/", - "build/", - "env/", - "gradle/", - "node_modules/", - "%.pdb", - "%.dll", - "%.class", - "%.exe", - "%.cache", - "%.ico", - "%.pdf", - "%.dylib", - "%.jar", - "%.docx", - "%.met", - "smalljre_*/*", - ".vale/", - "%.rar", - "%.zip", - "%.7z", - "%.tar", - "%.xz", - "%.gz", - "%.bz2", - "%.epub", - "%.flac", - "%.tar.gz", - }, - } - }) - end + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.toggle_all, + ["?"] = actions.which_key, + ["jf"] = { "", type = "command" }, + }, + n = { + ["jf"] = actions.close, + ["?"] = actions.which_key, + } + }, + selection_caret = " ", + path_display = { "truncate" }, + file_ignore_patterns = { + ".git/", + ".svn/", + "%.o", + "%.a", + "%.so", + "a.out", + "venv/", + "CMakeFiles/", + "cmake_install.cmake", + "CMakeCache.txt", + "target/", + ".pytest_cache/", + "vendor/*", + "%.lock", + "%.db", + "%.sqlite3", + "%.sqlite", + "%.ipynb", + "%.svg", + "%.burp", + "%.mp4", + "%.png", + "%.jpeg", + "%.jpg", + "%.gif", + "%.mkv", + "%.otf", + "%.ttf", + "%.webp", + "%.bin", + ".dart_tool/", + ".gradle/", + ".idea/", + ".settings/", + ".vscode/", + "pycache/", + "build/", + "env/", + "gradle/", + "node_modules/", + "%.pdb", + "%.dll", + "%.class", + "%.exe", + "%.cache", + "%.ico", + "%.pdf", + "%.dylib", + "%.jar", + "%.docx", + "%.met", + "smalljre_*/*", + ".vale/", + "%.rar", + "%.zip", + "%.7z", + "%.tar", + "%.xz", + "%.gz", + "%.bz2", + "%.epub", + "%.flac", + "%.tar.gz", + }, + } + }) + end + } } \ No newline at end of file