feat(git): alias s for unstage files

This commit is contained in:
thek4n 2024-05-22 09:16:14 +03:00
parent ee2b3481cf
commit 8064f04385
2 changed files with 117 additions and 112 deletions

View File

@ -45,6 +45,7 @@
[alias] [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" 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 d = diff
di = diff di = diff
ds = diff --staged ds = diff --staged

View File

@ -1,117 +1,121 @@
return { return {
'nvim-telescope/telescope.nvim', {
enabled = vim.fn.executable "fzf" == 1, 'nvim-telescope/telescope.nvim',
dependencies = { enabled = vim.fn.executable("fzf") == 1,
'nvim-lua/plenary.nvim', dependencies = {
{ {
'nvim-telescope/telescope-fzf-native.nvim', 'nvim-lua/plenary.nvim',
enabled = vim.fn.executable "make" == 1,
build = "make"
}
},
keys = {
{ '<Leader>fb', '<cmd>Telescope buffers<CR>' },
{ '<Leader>ff', '<cmd>Telescope find_files<CR>' },
{ '<Leader>fg', '<cmd>Telescope live_grep<CR>' },
{ '<Leader>fc', '<cmd>Telescope git_commits<CR>' },
{ '<Leader>fd', '<cmd>Telescope diagnostics<CR>' },
},
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.load_extension("fzf")
telescope.setup({
pickers = {
find_files = {
hidden = true,
},
}, },
defaults = { {
mappings = { 'nvim-telescope/telescope-fzf-native.nvim',
i = { enabled = vim.fn.executable("make") == 1,
["<C-j>"] = actions.move_selection_next, build = "make"
["<C-k>"] = actions.move_selection_previous, },
["<C-n>"] = actions.preview_scrolling_down, },
["<C-p>"] = actions.preview_scrolling_up, keys = {
["<C-a>"] = actions.toggle_all, { '<Leader>fb', '<cmd>Telescope buffers<CR>' },
["?"] = actions.which_key, { '<Leader>ff', '<cmd>Telescope find_files<CR>' },
["jf"] = { "<esc>", type = "command" }, { '<Leader>fg', '<cmd>Telescope live_grep<CR>' },
{ '<Leader>fc', '<cmd>Telescope git_commits<CR>' },
{ '<Leader>fd', '<cmd>Telescope diagnostics<CR>' },
},
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 = "", defaults = {
path_display = { "truncate" }, mappings = {
file_ignore_patterns = { i = {
".git/", ["<C-j>"] = actions.move_selection_next,
".svn/", ["<C-k>"] = actions.move_selection_previous,
"%.o", ["<C-n>"] = actions.preview_scrolling_down,
"%.a", ["<C-p>"] = actions.preview_scrolling_up,
"%.so", ["<C-a>"] = actions.toggle_all,
"a.out", ["?"] = actions.which_key,
"venv/", ["jf"] = { "<esc>", type = "command" },
"CMakeFiles/", },
"cmake_install.cmake", n = {
"CMakeCache.txt", ["jf"] = actions.close,
"target/", ["?"] = actions.which_key,
".pytest_cache/", }
"vendor/*", },
"%.lock", selection_caret = "",
"%.db", path_display = { "truncate" },
"%.sqlite3", file_ignore_patterns = {
"%.sqlite", ".git/",
"%.ipynb", ".svn/",
"%.svg", "%.o",
"%.burp", "%.a",
"%.mp4", "%.so",
"%.png", "a.out",
"%.jpeg", "venv/",
"%.jpg", "CMakeFiles/",
"%.gif", "cmake_install.cmake",
"%.mkv", "CMakeCache.txt",
"%.otf", "target/",
"%.ttf", ".pytest_cache/",
"%.webp", "vendor/*",
"%.bin", "%.lock",
".dart_tool/", "%.db",
".gradle/", "%.sqlite3",
".idea/", "%.sqlite",
".settings/", "%.ipynb",
".vscode/", "%.svg",
"pycache/", "%.burp",
"build/", "%.mp4",
"env/", "%.png",
"gradle/", "%.jpeg",
"node_modules/", "%.jpg",
"%.pdb", "%.gif",
"%.dll", "%.mkv",
"%.class", "%.otf",
"%.exe", "%.ttf",
"%.cache", "%.webp",
"%.ico", "%.bin",
"%.pdf", ".dart_tool/",
"%.dylib", ".gradle/",
"%.jar", ".idea/",
"%.docx", ".settings/",
"%.met", ".vscode/",
"smalljre_*/*", "pycache/",
".vale/", "build/",
"%.rar", "env/",
"%.zip", "gradle/",
"%.7z", "node_modules/",
"%.tar", "%.pdb",
"%.xz", "%.dll",
"%.gz", "%.class",
"%.bz2", "%.exe",
"%.epub", "%.cache",
"%.flac", "%.ico",
"%.tar.gz", "%.pdf",
}, "%.dylib",
} "%.jar",
}) "%.docx",
end "%.met",
"smalljre_*/*",
".vale/",
"%.rar",
"%.zip",
"%.7z",
"%.tar",
"%.xz",
"%.gz",
"%.bz2",
"%.epub",
"%.flac",
"%.tar.gz",
},
}
})
end
}
} }