Have same vifm configuration file for both OSX and linux systems

158 Views Asked by At

I recently started using vifm and having a solid background in vim, I am excited about the capabilities this file manager offers!

I use vifm both in my host OSX system and in my Linux vm. How can I have both configurations in the same rc file? Is there any if-clause that can be used to identify the os and run a set of commands based on it? (e.g the file opening commands differ from OSX, where a single "open -g %f" opens the file with the correct application and in Linux where you have to explicitly assign programs to the corresponding filetypes)

I tried the following vim block of commands but without any luck:

let os = substitute(system('uname'), "\n", "", "")
if os == "Darwin"
    let a = "kalinuxta"
elseif os == "Linux"
    let a = "kalimera"
endif
1

There are 1 best solutions below

0
On

You can do this in a way similar to your code, but mind that vifm doesn't have all of the Vim's functionality. In particular there are no variables, but you can use environment variables instead:

let $OS = system('uname -s')
if $OS == 'Darwin'
    let $a = 'kalinuxta'
elseif $OS == 'Linux'
    let $a = 'kalimera'
endif