Home > osx > How can I use Atom as the default editor for "open"?

How can I use Atom as the default editor for "open"?

August 2Hits:18
Advertisement

I would like to set Atom as my default editor for open.

In order to do this, I set in my .bashrc:

export EDITOR="atom -nw" 

and reload the file with source .bashrc. Anyway, when I try to open a text file through open filename, it always opens it with TextEdit.

I also tried variations of the above, such as export EDITOR=atom, or exporting VISUAL.

I am sure that .bashrc gets loaded on login.

What am I missing/doing wrong?

Answers

The open command is part of OS X and uses Finder's default “Open With…” application to open the file, just like double-clicking it in Finder. $EDITOR is used for things like fc where it is used as the default command-line editor (a replacement for vim or emacs).

To use Atom with the open command, you can select a file of the type you want in Finder, press ⌘ command+I for “Get Info”, and then change “Open With:” to Atom, and click “Change All…”.

Alternatively you can define an alias like

alias e="atom -nw"

in your .bashrc and then run e file-to-edit.txt whenever you want to edit a file in Atom.

Following this answer on Stackoverflow, the following command should work:

defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.github.atom;}'

I am not sure how fare this works through. For me, open /etc/hosts opened the file in Atom as expected, but open demo.properties did not.

Related Articles

  • How can I use Atom as the default editor for "open"?August 2

    I would like to set Atom as my default editor for open. In order to do this, I set in my .bashrc: export EDITOR="atom -nw" and reload the file with source .bashrc. Anyway, when I try to open a text file through open filename, it always opens it

  • make quantaplus a default editor for php files in ubuntuJune 23

    In Ubuntu, how can I make Quanta Plus the default editor for PHP files? In Windows we just use the open with context menu the first time for any new types of files and check use this application for these type of files. After that the files always op

  • Making vim the default editor in Ubuntu LinuxApril 8

    While trying to make vim default instead of gedit, I found this could be done two ways: Use defaults.list and make text/plain (and others) point to vim.desktop (what is the format for creating .desktop files?) Use update-alternatives and change gnome

  • How to reassign default editor for different file types from the command line?August 2

    I am looking for a way to reassign default editor on OS X. For example I want to reassign all file types opened by TextEditor with TextWrangler. Probably it has something to do with the defaults command but I do not know how to list current assignmen

  • Advanced Custom Fields Plugin - Conflict with Custom Post Type Default EditorOctober 13

    Advanced custom fields(2.1.4) plugin disables the wordpress default editor for custom post types. How can I fix this. --------------Solutions------------- I'm using Advanced Custom Fields (3.1.5) and attaching it to a custom post type. I was startled

  • Making phpStorm default editor of php or other supported files in UbuntuOctober 18

    How do I can make phpStorm default editor of php or other supported files in Ubuntu? Php storms is run using a .sh file. --------------Solutions------------- You can do something like this. It will set default editor. you can select phpstorm to set a

  • How do I set IDLE as the default editor for Python scripts?

    How do I set IDLE as the default editor for Python scripts?November 12

    I would like to set IDLE as the default editor for python scripts, but when I click on "open with application" and hit the dropdown to show more applications it isn't an option. Here's exactly what I am doing... right-click on .py file on my des

  • Linux mint 12: change default editor and terminalFebruary 13

    I have the sublime text editor located in usr/bin. How can I make it the default editor so I can do sublime /var/www/test.php? And can I change the default terminal to yakuake? --------------Solutions------------- Even without setting it as the defau

  • How do I set Notepad++ as the default editor?

    How do I set Notepad++ as the default editor?September 14

    I want set Notepad++ as the default editor. I tried to set it by right-clicking on a file, then Open With. But I did not see Notepad++ in the resulting list (even after clicking on Choose Other Programs). When I try to redirect to Notepad++ through t

  • How do I make Geany my default editor on Ubuntu?September 30

    I actually want to change the default text editor on my Ubuntu 12.04 from nano to Geany. When I used this code: update-alternatives --config editor .. I don't see Geany in the list. So to add Geany, this is supposed to work right? update-alternatives

  • Linux: How to automatically detect display and set up default editor accordinglyOctober 19

    I am relatively new to linux. I am connecting to a remote linux machine sometimes via telnet and sometimes via NX client for windows. When I connect via telent I would like the default editor to be vim, and when I connect via NX I would like the defa

  • Set emacs -nw as default editorJanuary 3

    When editing files like sudoers, I want to use emacs instead of nano. So I ran this command sudo update-alternatives --config editor And I selected emacs. The only issue is I like emacs in no window mode (the -nw flag) and I've aliased emacs as emacs

  • How can I set "vi" as my default editor in UNIX?April 23

    I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where. How can I set "vi" as my default editor? --------------Solutions------------- You should add it to your shell's configuration file. For Bash,

  • Setting default editor for php files

    Setting default editor for php filesMay 27

    I am using Ubuntu 12.04 TLS. I had installed Netbeans on my PC. I want change default file to netbeans. I've tried to right-click on a php file > Properties > Open With > Show other Application ; but there is no netbeans anywhere. How can I set t

  • How to set NetBeans as a default editor in FileZillaJune 10

    When I open any php, html, or css files FileZilla opens them in GEdit. Instead I would like FileZilla to open them in NetBeans 7.3. I would like to set NetBeans as the default editor in FileZilla. Please suggest a procedure to open the files in NetBe

  • Make eclipse pdt default editor for php, css etc. files in ubuntu 12.04?July 2

    I downloaded Eclipse php recently. When i want to open a css or php file it doesn't show option for eclipse, not even in the other applications list. I want to set Eclipse as my default editor to handle such kind of files.

  • How to set default editor in 13.04?

    How to set default editor in 13.04? September 15

    This question already has an answer here: Change all associations from gedit to another application 3 answers None of this, this nor this worked in setting my default editor. Haven't tried this, I'm afraid it won't work either. So how do I set the de

  • How to change the default editor for a file type in Mac OSx?

    How to change the default editor for a file type in Mac OSx?January 5

    The default editor for java files on my Mac seems to have been set to Xcode, but I want to change it to be the basic TextEditor. I've looked in preferences for the association, but it's not there. How do I change the default editor? --------------Sol

  • How to set Bluefish as a default editor in FileZillaFebruary 1

    How to use bluefish as a default editor in filezilla(ubuntu operating system). please give me solution. thank you --------------Solutions------------- In the Filezilla FTP client, go to settings. Scroll down until you hit "File Editing" and sele

  • Function launching default editorFebruary 2

    I have written a function that launches the default editor set in git config, right now I have managed to get it working for Sublime, nano and Vim. def launchEditor(editor): """ this function launches the default editor for user to compose

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.677 s.