- Aug
- 197
- 5
I'm forced to split my time between various Linux distros, macOS, and Windows, and of those three I probably don't have to tell you which OS positively sucks for command-line functionality. TCC is the closest thing to getting me where I'm at so easily with the first two in that list, and today I found a helpful way to leverage the wonderful fzf tool I so rely upon in them via TCC in Windows as well. Consider the following couple aliases:
Those two bits of gobbledygook pipe the output of a fairly standard
Maybe there's an easier way to feed Neovim multiple files. I know it was easy to use Vim command line switches to interpret everything piped into it as a list of files to open or commands or all manner of other things. But I guess I'm still new enough to Neovim that I haven't found an analog for that yet. Still, I was pretty happy with the results of this as it makes it easy to fast-fuzzy-search all files under the current folder (or in my config folder) and open them quickly in Neovim. So I thought I'd share this little tip. Have fun!
fnvim=fzf --multi --preview-window=right --preview="cat {}" | awk -e "BEGIN {ORS=\" \"} {print \"\x22\"$0\"\x22\"}" | for %f in (@con:) nvim %f
fnvimc=fzf --multi --preview-window=right --preview="cat {}" --walker-root=%localappdata%\nvim\lua\ | awk -e "BEGIN {ORS=\" \"} {print \"\x22\"$0\"\x22\"}" | for %f in (@con:) nvim %f
Those two bits of gobbledygook pipe the output of a fairly standard
fzf
command, the first working in the current folder and the second in my Neovim Lua configuration folder, into an admittedly ugly AWK script whose whole purpose is to take potentially multiple lines of output and turn them into a single line of multiple quote-delimited file names, and then the lovely @con;
option for a for statement makes it easily possible to feed that result into a Neovim argument. Maybe there's an easier way to feed Neovim multiple files. I know it was easy to use Vim command line switches to interpret everything piped into it as a list of files to open or commands or all manner of other things. But I guess I'm still new enough to Neovim that I haven't found an analog for that yet. Still, I was pretty happy with the results of this as it makes it easy to fast-fuzzy-search all files under the current folder (or in my config folder) and open them quickly in Neovim. So I thought I'd share this little tip. Have fun!