is0n / fm-nvim

🗂 Neovim plugin that lets you use your favorite terminal file managers (and fuzzy finders) from within Neovim.
GNU General Public License v3.0
271 stars 18 forks source link

LF icons not working #21

Closed piersolenski closed 2 years ago

piersolenski commented 2 years ago

Recently my LF icons stopped working with this plugin. They still work outside of vim. Do I need to add any specific configuration to get them working again? Thanks!

is0n commented 2 years ago

I'm not sure what could be causing this. I primarily use lf and icons work just fine for me. If you show me your config, I might be able to help out.

piersolenski commented 2 years ago

Icons:

#!/bin/bash

export LF_ICONS="\
tw=:\
st=:\
ow=:\
dt=:\
di=:\
fi=:\
ln=:\
or=:\
ex=:\
*.c=:\
*.cc=:\
*.clj=:\
*.coffee=:\
*.cpp=:\
*.css=:\
*.d=:\
*.dart=:\
*.erl=:\
*.exs=:\
*.fs=:\
*.go=:\
*.h=:\
*.hh=:\
*.hpp=:\
*.hs=:\
*.html=:\
*.java=:\
*.jl=:\
*.js=:\
*.json=:\
*.lua=:\
*.md=:\
*.php=:\
*.pl=:\
*.pro=:\
*.py=:\
*.rb=:\
*.rs=:\
*.scala=:\
*.ts=:\
*.vim=:\
*.cmd=:\
*.ps1=:\
*.sh=:\
*.bash=:\
*.zsh=:\
*.fish=:\
*.tar=:\
*.tgz=:\
*.arc=:\
*.arj=:\
*.taz=:\
*.lha=:\
*.lz4=:\
*.lzh=:\
*.lzma=:\
*.tlz=:\
*.txz=:\
*.tzo=:\
*.t7z=:\
*.zip=:\
*.z=:\
*.dz=:\
*.gz=:\
*.lrz=:\
*.lz=:\
*.lzo=:\
*.xz=:\
*.zst=:\
*.tzst=:\
*.bz2=:\
*.bz=:\
*.tbz=:\
*.tbz2=:\
*.tz=:\
*.deb=:\
*.rpm=:\
*.jar=:\
*.war=:\
*.ear=:\
*.sar=:\
*.rar=:\
*.alz=:\
*.ace=:\
*.zoo=:\
*.cpio=:\
*.7z=:\
*.rz=:\
*.cab=:\
*.wim=:\
*.swm=:\
*.dwm=:\
*.esd=:\
*.jpg=:\
*.jpeg=:\
*.mjpg=:\
*.mjpeg=:\
*.gif=:\
*.bmp=:\
*.pbm=:\
*.pgm=:\
*.ppm=:\
*.tga=:\
*.xbm=:\
*.xpm=:\
*.tif=:\
*.tiff=:\
*.png=:\
*.svg=:\
*.svgz=:\
*.mng=:\
*.pcx=:\
*.mov=:\
*.mpg=:\
*.mpeg=:\
*.m2v=:\
*.mkv=:\
*.webm=:\
*.ogm=:\
*.mp4=:\
*.m4v=:\
*.mp4v=:\
*.vob=:\
*.qt=:\
*.nuv=:\
*.wmv=:\
*.asf=:\
*.rm=:\
*.rmvb=:\
*.flc=:\
*.avi=:\
*.fli=:\
*.flv=:\
*.gl=:\
*.dl=:\
*.xcf=:\
*.xwd=:\
*.yuv=:\
*.cgm=:\
*.emf=:\
*.ogv=:\
*.ogx=:\
*.aac=:\
*.au=:\
*.flac=:\
*.m4a=:\
*.mid=:\
*.midi=:\
*.mka=:\
*.mp3=:\
*.mpc=:\
*.ogg=:\
*.ra=:\
*.wav=:\
*.oga=:\
*.opus=:\
*.spx=:\
*.xspf=:\
*.pdf=:\
*.nix=:\
"

Relevant parts from lfrc:

# interpreter for shell commands
set shell zsh
set icons

Relevant line from my which key setup:

["<leader>"] = { "getreg('%') !~ 'S' ? ':Lf<cr>' : ':Lf %<cr>'", "LF", expr = true },

Packer

        -- File managers
        use({
            "is0n/fm-nvim",
            config = function()
                require("fm-nvim").setup({ ui = { float = { height = 1, width = 1 } } })
            end,
        })

It works fine outside of neovim, so wondering if it's something to do with the environment or something 🤔

is0n commented 2 years ago
  1. What shell are you using?
  2. Where is the file containing export LF_ICONS and all of the icons sourced?
piersolenski commented 2 years ago

I'm using zsh for my shell.

I think I've narrowed down the issue... I recently added tmux bindings to open new windows with vim instances, such as:

bind-key D if-shell 'tmux select-window -t Dotfiles' '' 'new-window -n "Dotfiles" "cd $DOTFILES; nvim"'

For some reason, when I do this I lose the icons. If I echo the shell here it still results as /bin/zsh, so that part should be correct at least.

It doesn't really seem to matter where I export export LF_ICONS from, even if it's as low level as my .zshrc - they're still missing when opening new windows via tmux 🤔

is0n commented 2 years ago

Can't say for sure what's causing this but here are the relevant parts of my lf configuration.

~/.config/lf/lfrc:

# Settings
set previewer ~/.config/lf/preview
set cleaner ~/.config/lf/cleaner
set drawbox true
set icons true
set info "size"
# set hidden

~/.zshenv

export LF_ICONS="\
di=:\
fi=:\
ln=:\
or=:\
ex=:\
*.vimrc=:\
*.viminfo=:\
*.gitignore=:\
*.c=:\
*.cc=:\
*.clj=:\
*.coffee=:\
*.cpp=:\
*.css=:\
*.d=:\
*.dart=:\
*.erl=:\
*.exs=:\
*.fs=:\
*.go=:\
*.h=:\
*.hh=:\
*.hpp=:\
*.hs=:\
*.html=:\
*.java=:\
*.jl=:\
*.js=:\
*.json=:\
*.lua=:\
*.md=:\
*.php=:\
*.pl=:\
*.pro=:\
*.py=:\
*.rb=:\
*.rs=:\
*.scala=:\
*.ts=:\
*.vim=:\
*.cmd=:\
*.ps1=:\
*.sh=:\
*.bash=:\
*.zsh=:\
*.fish=:\
*.tar=:\
*.tgz=:\
*.arc=:\
*.arj=:\
*.taz=:\
*.lha=:\
*.lz4=:\
*.lzh=:\
*.lzma=:\
*.tlz=:\
*.txz=:\
*.tzo=:\
*.t7z=:\
*.zip=:\
*.z=:\
*.dz=:\
*.gz=:\
*.lrz=:\
*.lz=:\
*.lzo=:\
*.xz=:\
*.zst=:\
*.tzst=:\
*.bz2=:\
*.bz=:\
*.tbz=:\
*.tbz2=:\
*.tz=:\
*.deb=:\
*.rpm=:\
*.jar=:\
*.war=:\
*.ear=:\
*.sar=:\
*.rar=:\
*.alz=:\
*.ace=:\
*.zoo=:\
*.cpio=:\
*.7z=:\
*.rz=:\
*.cab=:\
*.wim=:\
*.swm=:\
*.dwm=:\
*.esd=:\
*.jpg=:\
*.jpeg=:\
*.mjpg=:\
*.mjpeg=:\
*.gif=:\
*.bmp=:\
*.pbm=:\
*.pgm=:\
*.ppm=:\
*.tga=:\
*.xbm=:\
*.xpm=:\
*.tif=:\
*.tiff=:\
*.png=:\
*.svg=:\
*.svgz=:\
*.mng=:\
*.pcx=:\
*.mov=:\
*.mpg=:\
*.mpeg=:\
*.m2v=:\
*.mkv=:\
*.webm=:\
*.ogm=:\
*.mp4=:\
*.m4v=:\
*.mp4v=:\
*.vob=:\
*.qt=:\
*.nuv=:\
*.wmv=:\
*.asf=:\
*.rm=:\
*.rmvb=:\
*.flc=:\
*.avi=:\
*.fli=:\
*.flv=:\
*.gl=:\
*.dl=:\
*.xcf=:\
*.xwd=:\
*.yuv=:\
*.cgm=:\
*.emf=:\
*.ogv=:\
*.ogx=:\
*.aac=:\
*.au=:\
*.flac=:\
*.m4a=:\
*.mid=:\
*.midi=:\
*.mka=:\
*.mp3=:\
*.mpc=:\
*.ogg=:\
*.ra=:\
*.wav=:\
*.oga=:\
*.opus=:\
*.spx=:\
*.xspf=:\
*.pdf=:\
*.nix=:\
*.yml=:\
*.yaml=:\
*.zshrc=:\
*.zshenv=:\
*.bashrc=:\
*.DS_Store=:\
bin/=:\
Downloads/=:\
Documents/=:\
Desktop/=:\
Music/=:\
Wallpapers/=:\
Pictures/=:\
Programming/=:\
Movies/=:\
TV/=:\
Public/=:\
Users/=:\
Notes/=:\
Shared/=:\
node_modules/=:\
.git/=:\
"

~/.config/nvim/init.lua:

require('fm-nvim').setup{
    ui = {
        default = "float",
        float = {
            border   = "single",
            border_hl = "NONE",
        },
    },
    cmds = {
                -- https://gist.github.com/Provessor/dbb4a6d22945e7a42c3b904302ee273c
        lf_cmd  = "~/.config/lf/startlf"
    },
}
piersolenski commented 2 years ago

Exporting LF_ICONS from .zshenv fixed it! Thanks!!!