Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

How to Enable Autocomplete for Custom Functions in Fish Shell

Автор: vlogize

Загружено: 2025-09-15

Просмотров: 11

Описание:

Discover how to implement a custom function in Fish Shell that mimics ZSH behavior, helping you achieve efficient directory navigation with autocomplete support.
---
This video is based on the question https://stackoverflow.com/q/62604692/ asked by the user 'caarlos0' ( https://stackoverflow.com/u/405013/ ) and on the answer https://stackoverflow.com/a/62604989/ provided by the user 'ridiculous_fish' ( https://stackoverflow.com/u/1441328/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: autocomplete files on fish shell custom function

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
How to Enable Autocomplete for Custom Functions in Fish Shell

Migrating from one shell to another can often lead to unexpected challenges, especially when it comes to custom functions and autocompletion. For those transitioning from Zsh to Fish Shell, one common hurdle is implementing a specific command function that behaves similarly in both environments. In this guide, we will explore how to create a custom command in Fish, specifically a c function that allows you to navigate directories under the $PROJECTS environment variable seamlessly, complete with autocomplete functionality.

Understanding the Problem

In Zsh, defining a function for directory navigation is straightforward. You can create a custom command (like c) that changes your current directory to a subdirectory under your $PROJECTS path. It utilizes the autocomplete features that Zsh natively supports.

Here’s what you might have in Zsh:

[[See Video to Reveal this Text or Code Snippet]]

[[See Video to Reveal this Text or Code Snippet]]

However, upon transitioning to Fish Shell, functions need to be structured a bit differently, and achieving the same autocomplete behavior can be tricky. As mentioned, the typical approach you might take in Fish involves setting something like this:

[[See Video to Reveal this Text or Code Snippet]]

While this setup compiles, it unfortunately won't provide the same depth of completion beyond the first folder.

Crafting a Solution

To achieve robust autocomplete functionality in Fish Shell for your custom c function, we need to change the way completion works. Here’s a step-by-step breakdown of an effective solution:

Step 1: Create a Custom Completion Function

Define a new function that will fetch the current command line arguments.

Change the directory to $PROJECTS temporarily to allow for completion as though you are using cd.

Here’s how you can achieve that:

[[See Video to Reveal this Text or Code Snippet]]

Step 2: Set Up the Completion for the Command

Finally, you will need to register the completion function with your custom command. This can be done with the following command:

[[See Video to Reveal this Text or Code Snippet]]

Full Implementation

By integrating the new function and completion setup into your Fish configuration, your final code will look like this:

[[See Video to Reveal this Text or Code Snippet]]

Conclusion

With this setup, you can enjoy a seamless experience when navigating directories in the Fish Shell, replicating the efficiency and functionality you previously enjoyed on Zsh. Custom functions can dramatically improve your productivity, and a well-implemented autocomplete feature can save you a great deal of time and effort.

Happy shell scripting, and welcome to the world of Fish Shell!

How to Enable Autocomplete for Custom Functions in Fish Shell

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Декораторы Python — наглядное объяснение

Декораторы Python — наглядное объяснение

Никогда не устанавливайте локально

Никогда не устанавливайте локально

Анатомия масштабируемого проекта Python (FastAPI)

Анатомия масштабируемого проекта Python (FastAPI)

What's so great about the Fish Shell?... I'll tell you...

What's so great about the Fish Shell?... I'll tell you...

Запись Потоков Данных в Базу Данных в Реальном Времени | Fetch Data | Объекты в Программировании

Запись Потоков Данных в Базу Данных в Реальном Времени | Fetch Data | Объекты в Программировании

ОБЫЧНЫЙ VPN УМЕР: Чем обходить блокировки в 2026

ОБЫЧНЫЙ VPN УМЕР: Чем обходить блокировки в 2026

Священная ВОЙНА редакторов кода - Vim против Emacs

Священная ВОЙНА редакторов кода - Vim против Emacs

⚡Борт КАДЫРОВА ЗАСЕКЛИ на ВЫЛЕТЕ из Москвы! Родственники В ТРАУРЕ. Вот, что ОТКОПАЛИ В СЕТИ – НАКИ

⚡Борт КАДЫРОВА ЗАСЕКЛИ на ВЫЛЕТЕ из Москвы! Родственники В ТРАУРЕ. Вот, что ОТКОПАЛИ В СЕТИ – НАКИ

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

🎧🇩🇪 200 МИНУТ! Пойми НЕМЕЦКИЙ на слух. Немецкие ФРАЗЫ которые помогут заговорить. Разговорные фразы

🎧🇩🇪 200 МИНУТ! Пойми НЕМЕЦКИЙ на слух. Немецкие ФРАЗЫ которые помогут заговорить. Разговорные фразы

Автоматическая смена IP каждые 5 секунд – 100% АНОНИМНОСТЬ | Новый Метод

Автоматическая смена IP каждые 5 секунд – 100% АНОНИМНОСТЬ | Новый Метод

Для Чего РЕАЛЬНО Нужен был ГОРБ Boeing 747?

Для Чего РЕАЛЬНО Нужен был ГОРБ Boeing 747?

КАК УСТРОЕН TCP/IP?

КАК УСТРОЕН TCP/IP?

hacked by 2 characters

hacked by 2 characters

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

Самая быстрая передача файлов МЕЖДУ ВСЕМИ ТИПАМИ УСТРОЙСТВ 🚀

Самая быстрая передача файлов МЕЖДУ ВСЕМИ ТИПАМИ УСТРОЙСТВ 🚀

Двойной VPN через сервер в РФ с помощью HAProxy / IT Freedom Project

Двойной VPN через сервер в РФ с помощью HAProxy / IT Freedom Project

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

OSINT для новичков: найдите всё о юзернейме и фото с Sherlock и Google Dorks!

OSINT для новичков: найдите всё о юзернейме и фото с Sherlock и Google Dorks!

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com