I struggled a long time ago with vim when playing with multiple projects at the same time or playing with a code base with conflicting folders related to multiple languages used at the same time.
As an example, a typical rails code base will have a lot of ruby code and a bunch of javascript/typescript code ( stimulus, react ... ).
As an example, we can have a ruby service for invoicing for example
.../services/fetch_invoice_service.rb
and a typescript service used to fetch something from the API
.../javascript/src/services/fetchDataService.ts
On vim, using fzf I found my self using the Gfilescommande to find the desired file typing for example:
servicefetch
The Fzf will show ruby and javascript files on the same list.
Sometimes is really annoying when you're working on a big codebase.
Also, when you are working on multiple project on the same time with vim, usually you find your self having multiple vim instances.
We can fix this with Vim tabs
Vim tab to rescue
You can create a new tab on vim using the command: :tabnew
Navigation between tabs is done by:
-
gtcycling between tabs -
{tab number}gt: switch to a specific tab.
Setting a working directory by tab:
To make your search for files really fast, you can set a working directory by tab.
:tcd [path to your folder]
Calling :Gfiles will use this path as a root directory
Rails workflow
I found my self for a rails app using three tabs:



Top comments (0)