Published: 30.04.2021 | Edited: 09.05.2021 | Tags: 100daystooffload,vim
Global search for vim and fzf
This post is a continuation of both my previous post about vim mnemonics and an another my post about Syncting(ing) the entire phone. I have found the combined result of both setups loosely described in those posts to be an unexpected symbiosis that works very well for editing my markdown files, especially quick phone notes, todo lists and shopping lists. The setup allows me to very quickly edit my notes or lists on the phone using Markor editor, synced it into my laptop via Syncthing and then edited there via vim and synced back to the phone automatically.
The setup is also decentralized but also a little harder to initiate, while at the same time very convenient once up and running, utilizing only the tools I use daily. The phone allows to quickly write some notes on the go or follow the lists easily, while the laptop on the other hand allows for some more complex text editing and the actual writing is much faster, especially when the fully-fledged physical keyboard is aided with vim.
Even though everything is working nicely and I am satisfied with the overall workflow, there are some improvements I have found to be increasing my productivity here even more.
Global home FZF search
I know, I currently use kitty as my terminal emulator and it supports some pretty extreme keyboard-fu, it has a somewhat steep learning curve. I have already noticed it should be able to select some terminal output only with the use of the keyboard, so I can copy the text without touching the mouse, but frankly, I have no idea how to do that.
What's more, most of the time I do not even want to copy another program's output, usually I just need to yank something from one file in vim into other file, while the files are located on some very different locations in my home folder. Since the files from the phone created by Markor and synced in via Syncthing are usually especially deep in the folder structure, I definitely like to use fuzzy finder to open these files. But the standard way fzf works is to only search in the current folder.
The way around this is to start the vim in the home folder, or use some built-in vim commands to change directory, but there is also another way. Make sure to follow the vim setup described in the post from the top - it's just two lines, but it is important, especially the alias. Next place these three lines into your
export FZF_DEFAULT_COMMAND="find ~" export FZF_CTRL_T_COMMAND="find ~" export FZF_ALT_C_COMMAND="find ~"
With these three lines on top of previous two, every of the four shortcuts of CTRL+T, ALT+C,
gf, with the last one either in terminal or as a key sequence in vim normal mode would search the whole home folder. This setup however brings up some new unpleasant problems. More fixes and more problems coming, stay tuned.
This is a 51th post of #100daystooffload.