If your project is deployed on Heroku Cloud Platform, you can easily make your changes using the CLI and deploy them to Heroku.
Firstly, you need to run bash within some app. You can either specify the app via the --app key as the help actually says or you can run this command inside the folder which has a heroku app initialized already.
I recently turned the original gist into a heroku cli plugin.
Just install:
heroku plugins:install https://github.com/naaman/heroku-vim
And use:
heroku vim
The heroku vim
command will drop you into a bash shell with vim
installed on your $PATH
. All you have to do is retrain your fingers to type heroku vim
instead of heroku run bash
.
If you don't want to mess around with plugins and just want a copy of nano in your one-off dyno, just run
mkdir /app/nano
curl https://github.com/Ehryk/heroku-nano/raw/master/heroku-nano-2.5.1/nano.tar.gz --location --silent | tar xz -C /app/nano
export PATH=$PATH:/app/nano
This will download a copy of nano from this plugin and put it in your PATH.
there's ed
if you're a masochist.
It looks like you can download and install vim for one session:
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
This idea was found here.
Even if you could edit the files with vi
it probably wouldn't solve your problem because the file system is ephemeral. Meaning... If you edit a file via heroku run bash
you aren't actually changing the file for other dynos. To change a file for all dynos you need to either change what you push in a Git repo or change the buildpack. More details:
https://devcenter.heroku.com/articles/oneoff-admin-ps#formation-dynos-vs-oneoff-dynos
The plugin provided by Naaman Newbold is no longer working with heroku-16
stack, so I made a new plugin out of this updated gist.
Install:
heroku plugins:install @jasonheecs/heroku-vim
And use:
heroku vim
In the comments on the Brian Takita's answer link, there is the more recent solution to get Vim working on the Heroku console:
https://gist.github.com/dvdbng/7375821b20f189c189ab1bd29392c98e
Just saved me a lot of time! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With