3

I am using Windows Subsystem for Linux with Rails 5.2 and Sublime Text 3. When i do

EDITOR="subl --wait" rails credentials:edit

It says "New credentials encrypted and saved." but does not open the file to be edited with Sublime Text 3. Also when trying Visual Studio Code with

EDITOR="code --wait" rails credentials:edit

Visual Studio Code opens but it is empty.

I can only edit the file with VIM and the command EDITOR="vim" rails credentials:edit

The thing is i do not want to edit the file with vim. What is the problem so it does not open the file to be edited with Sublime or VS Code?

I am using Rails 5.2

Thanks a lot in advance

enter image description here

4 Answers 4

12

On macOS, you would run this command to edit the credentials in Sublime. When you are done, save and close the file in Sublime:

EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit
Sign up to request clarification or add additional context in comments.

Comments

5

I am on windows 7x64 and stumbled upon this issue this morning.Solved it by adding atom to my system variable Path(so cmd & powershell & bash all know about it) and by adding powershell to my environment.I use separate environment for ruby & rails.

So now when I type set EDITOR=atom --wait && rails credentials:edit in cmd or

1st $env:EDITOR="atom --wait", 2nd rails credentials:editin powershell or

EDITOR="atom --wait" rails credentials:edit in bash,

I get the desired result wich is to open credentials and edit them :).. Hope this helps

PS. I didn't need to use --wait flag when setting the editor to subl or notepad! EDITOR is just a temporary variable for the current session, meaning for the cmd,powershell or bash window that is opened at the moment!

Comments

1

By default Sublime Text Editor is not configured to be run directly from the command line. You're trying to set the EDITOR variable to "subl --wait", but the command line doesn't know what "subl" is! Try this post which goes into detail on setting up a "subl" alias for starting up sublime on the command line, then try again!

Open Sublime Text from Terminal in macOS

EDIT: Noticed you are on Ubuntu and not MacOS, but that post should still work as long as you're using bash, which is the default shell on Ubuntu.

5 Comments

I did configure subl command in Terminal, so when i type subl it opens Sublime Text 3. Same thing as sublime happens with Atom, Notepad, Wordpad
Noticed a typo in your VS Code example, you need a space between code and --wait, not a regular sublime user, but I did get it to work with Atom like this: EDITOR="atom --wait" rails credentials:edit
i copied code --wait wrong. I am running it with code --wait. When i am trying to run it with Atom, i get same behavior with VS Code (empty file)
Are you able to open Atom/Code from the terminal, i.e. atom . or code . to open the current directory?
yes i am able to open Atom/Code from the terminal to current directory.
1

I have succeeded my following this

 SET EDITOR="full_path to sublime"
 rails credentials:edit

after closing sublime only i am getting new credentials saved response.

Hope it helps

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.