This commit is contained in:
Dave 2025-05-09 16:57:46 +03:00 committed by GitHub
commit 580e1d7c29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 52 additions and 0 deletions

View file

@ -567,6 +567,7 @@ keybinding:
findBaseCommitForFixup: <c-f>
confirmDiscard: x
ignoreFile: i
ignoreFileExtension: I
refreshFiles: r
stashAllChanges: s
viewStashOptions: S

View file

@ -144,6 +144,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | Edit | Open file in external editor. |
| `` o `` | Open file | Open file in default application. |
| `` i `` | Ignore or exclude file | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | Refresh files | |
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | View stash options | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -231,6 +231,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | 編集 | Open file in external editor. |
| `` o `` | ファイルを開く | Open file in default application. |
| `` i `` | ファイルをignore | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | ファイルをリフレッシュ | |
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | View stash options | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -385,6 +385,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | Edit | Open file in external editor. |
| `` o `` | 파일 닫기 | Open file in default application. |
| `` i `` | Ignore file | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | 파일 새로고침 | |
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | Stash 옵션 보기 | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -67,6 +67,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
| `` e `` | Edit | Open file in external editor. |
| `` o `` | Open bestand | Open file in default application. |
| `` i `` | Ignore or exclude file | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | Refresh bestanden | |
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | Bekijk stash opties | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -237,6 +237,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | Edytuj | Otwórz plik w zewnętrznym edytorze. |
| `` o `` | Otwórz plik | Otwórz plik w domyślnej aplikacji. |
| `` i `` | Ignoruj lub wyklucz plik | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | Odśwież pliki | |
| `` s `` | Schowaj | Schowaj wszystkie zmiany. Dla innych wariantów schowania, użyj klawisza wyświetlania opcji schowka. |
| `` S `` | Wyświetl opcje schowka | Wyświetl opcje schowka (np. schowaj wszystko, schowaj zatwierdzone, schowaj niezatwierdzone). |

View file

@ -69,6 +69,7 @@ Veja a documentação:
| `` e `` | Editar | Abrir arquivo no editor externo. |
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
| `` i `` | Ignore or exclude file | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | Atualizar arquivos | |
| `` s `` | Stash | Stash todas as alterações. Para outras variações de armazenamento, use a fixação de teclas de armazenamento. |
| `` S `` | Ver opções de stash | Ver opções de stash (por exemplo, trash all, stash staged, stash unsttued). |

View file

@ -378,6 +378,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | Edit | Open file in external editor. |
| `` o `` | Открыть файл | Open file in default application. |
| `` i `` | Игнорировать или исключить файл | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | Обновить файлы | |
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | Просмотреть параметры хранилища | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -205,6 +205,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | 编辑 | 使用外部编辑器打开文件 |
| `` o `` | 打开文件 | 使用默认程序打开该文件 |
| `` i `` | 忽略文件 | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | 刷新文件 | |
| `` s `` | 贮藏 | 贮藏所有变更.若要使用其他贮藏变体,请使用查看贮藏选项快捷键 |
| `` S `` | 查看贮藏选项 | 查看贮藏选项(例如:贮藏所有、贮藏已暂存变更、贮藏未暂存变更) |

View file

@ -337,6 +337,7 @@ Note that this disregards the selection, the new branch is always created either
| `` e `` | 編輯 | 使用外部編輯器開啟 |
| `` o `` | 開啟檔案 | 使用預設軟體開啟 |
| `` i `` | 忽略或排除檔案 | |
| `` I `` | Add extension to .gitignore | |
| `` r `` | 重新整理檔案 | |
| `` s `` | 收藏 | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
| `` S `` | 檢視收藏選項 | View stash options (e.g. stash all, stash staged, stash unstaged). |

View file

@ -456,6 +456,7 @@ type KeybindingFilesConfig struct {
FindBaseCommitForFixup string `yaml:"findBaseCommitForFixup"`
ConfirmDiscard string `yaml:"confirmDiscard"`
IgnoreFile string `yaml:"ignoreFile"`
IgnoreFileExtension string `yaml:"ignoreFileExtension"`
RefreshFiles string `yaml:"refreshFiles"`
StashAllChanges string `yaml:"stashAllChanges"`
ViewStashOptions string `yaml:"viewStashOptions"`
@ -930,6 +931,7 @@ func GetDefaultConfig() *UserConfig {
CommitChangesWithEditor: "C",
FindBaseCommitForFixup: "<c-f>",
IgnoreFile: "i",
IgnoreFileExtension: "I",
RefreshFiles: "r",
StashAllChanges: "s",
ViewStashOptions: "S",

View file

@ -110,6 +110,12 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
Description: self.c.Tr.Actions.IgnoreExcludeFile,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.IgnoreFileExtension),
Handler: self.withItem(self.ignoreExtension),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.IgnoreFileExtension,
},
{
Key: opts.GetKey(opts.Config.Files.RefreshFiles),
Handler: self.refresh,
@ -718,6 +724,24 @@ func (self *FilesController) ignore(node *filetree.FileNode) error {
return self.ignoreOrExcludeFile(node, self.c.Tr.IgnoreTracked, self.c.Tr.IgnoreTrackedPrompt, self.c.Tr.Actions.IgnoreExcludeFile, self.c.Git().WorkingTree.Ignore)
}
func (self *FilesController) ignoreExtension(node *filetree.FileNode) error {
if node.GetPath() == ".gitignore" {
return errors.New(self.c.Tr.Actions.IgnoreFileErr)
}
path := node.GetPath()
ext := filepath.Ext(path)
if ext == "" {
return fmt.Errorf("No file extension to ignore")
}
pattern := "*" + ext
return self.ignoreOrExcludeFile(node, self.c.Tr.IgnoreTracked, self.c.Tr.IgnoreTrackedPrompt, self.c.Tr.Actions.IgnoreExcludeFile, func(string) error {
return self.c.Git().WorkingTree.Ignore(pattern)
})
}
func (self *FilesController) exclude(node *filetree.FileNode) error {
if node.GetPath() == ".gitignore" {
return errors.New(self.c.Tr.Actions.ExcludeGitIgnoreErr)
@ -740,6 +764,16 @@ func (self *FilesController) ignoreOrExcludeMenu(node *filetree.FileNode) error
},
Key: 'i',
},
{
LabelColumns: []string{self.c.Tr.IgnoreFileExtension},
OnPress: func() error {
if err := self.ignoreExtension(node); err != nil {
return err
}
return nil
},
Key: 'I',
},
{
LabelColumns: []string{self.c.Tr.ExcludeFile},
OnPress: func() error {

View file

@ -272,6 +272,7 @@ type TranslationSet struct {
OpenFileTooltip string
OpenInEditor string
IgnoreFile string
IgnoreFileExtension string
ExcludeFile string
RefreshFiles string
FocusMainView string
@ -1351,6 +1352,7 @@ func EnglishTranslationSet() *TranslationSet {
OpenFileTooltip: "Open file in default application.",
OpenInEditor: "Open in editor",
IgnoreFile: `Add to .gitignore`,
IgnoreFileExtension: `Add extension to .gitignore`,
ExcludeFile: `Add to .git/info/exclude`,
RefreshFiles: `Refresh files`,
FocusMainView: "Focus main view",

View file

@ -1031,6 +1031,10 @@
"type": "string",
"default": "i"
},
"ignoreFileExtension": {
"type": "string",
"default": "I"
},
"refreshFiles": {
"type": "string",
"default": "r"