I need to configure vim to add the shebang #!/bin/bash if the edited file is in the directory /usr/bin/ and if it is empty (or even better if it doesn't exist)
How can I add a shebang to file in a specific directory
vimrc
Here's one way to add the shebang to any new file in /usr/bin/:func Shebang(path)    echo a:path    if a:path =~ /usr/bin/[^/]*        normal i#!/bin/bash    endifendfuncautocmd BufNewFile /usr/bin/* execute Shebang(expand('<amatch>'))This will only execute on new files, and also ensures the file isn't in a subdirectory in /usr/bin.  You could also modify it so the pattern of *.sh (a new shell file created anywhere) also gets the shebang.  If you don't care about subdirectories and only want this to every work in /usr/bin, you could also just do:autocmd BufNewFile /usr/bin/* normal i#!/bin/bash