Here is a part of my ftplugin/fortran_state.vim

" Check python modules and install{{{1
if !executable('fprettify') || !executable('fortls') || !executable('unidecode')
  :let choice =confirm("Some python dependencies doesn't exists! Install them?", "&Yes\n&No(use fallback)")
  if !executable('fprettify')
    :call install_deps#install_fprettify() 
  if !executable('fortls')
    :call install_deps#install_fortls() 
  if !executable('unidecode')
    :call install_deps#install_unidecode() 

The intention is these block will be executed and install the dependencies only when they are not installed (obviously!) Problem is, even they are installed and in path, this block is executed every time I open a fortran file.

pip3 install --user fortran-language-server fprettify unidecode
Requirement already satisfied: fortran-language-server in ~/.local/lib/python3.9/site-packages (1.12.0)
Requirement already satisfied: fprettify in ~.local/lib/python3.9/site-packages (0.3.7)
Requirement already satisfied: unidecode in ~/.local/lib/python3.9/site-packages (1.1.2)
Requirement already satisfied: configargparse in ~/.local/lib/python3.9/site-packages (from fprettify) (1.2.3)

which fprettify 
which fortls
which unidecode 

One odd thing is installation is going on even if I select No(Use fallback).

The install_deps is from autoload, with:

function! install_deps#install_fprettify()
  echom "Installing fprettify"
  :execute ':!pip3 install fprettify --user -q'
function! install_deps#install_unidecode()
  echom "Installing unidecode"
  :execute ':!pip3 install unidecode --user -q'
function! install_deps#install_fortls()
  echom "Installing fortls"
  :execute ':!pip3 install fortran-language-server --user -q'

So,it looks like if block and choice does not work as I think.

What I am doing wrong here?


  1. Reply to Mat:

  2. Reply to Ben: I have used:

     let choice =confirm("Some python dependencies doesn't exists! Install them?", "&Yes\n&No(use fallback)")
     echo choice

If I chose Yes, confirm is 1, with No, its 2. But, code should not go to choice at all when all of them are already installed. Why the code is reading that choice line?

  • 1
    :echo $PATH while inside Vim.
    – Matt
    Commented Jan 30, 2021 at 12:21
  • 1
    You haven't checked the return value of confirm, have you?
    – D. Ben Knoble
    Commented Jan 30, 2021 at 13:54
  • Note that in ftplugin/*.vim you don't need to type the colon before commands (i.e. just call install_deps#install_fprettify(), not :call install_deps#install_fprettify()) Commented Mar 4, 2021 at 14:15

1 Answer 1


oh, I have found the solution. This is for others reference. vim probably can not expand ~/ to $HOME. In my .bashrc, I had


changing that to


solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.