associatedpress / laptop

A shell script which turns your Mac into an awesome web development machine.
Other
2 stars 0 forks source link

Set terminal editor to something user-friendly #6

Open zstumgoren opened 8 years ago

zstumgoren commented 8 years ago

The default terminal editor on a fresh OS 10.10 install appears to be vim. Laptop script should configure this to be something more user-friendly such as Pico

tthibo commented 8 years ago

Hmm. I would be as lost with Pico as a new user would be with vim.

If we're going to go that route, why not make sure sublime is installed and make the commandline invocation the default? (Or everyone can learn three commands in vim, right?)

zstumgoren commented 8 years ago

Sublime is fine too. I had considered that but left it open-ended since this most affects the data analysis folks (I suspect I'm not the only devops/newsapps person customizing this).

I'd be opposed to vim as the default, however. The use cases in git-land (merge conflicts and multi-line commits) are fairly infrequent for most folks working on data projects, so it would be easy for them to forget even a small number of commands (much less grok and remember the modal editing switches). Feels like we could easily spare them this pain with a sensible default.

Better yet, we could serve all users by having the script prompt for a preferred editor (sublime, nano, pico, emacs, vim, whatev) and configure the EDITOR variable in _~/.bashprofile

Thoughts?

myersjustinc commented 8 years ago

I'd lean toward setting $EDITOR, personally.

tthibo commented 8 years ago

+1 For offering options there. People get tetchy about their editors.

zstumgoren commented 8 years ago

Alright! +1's all around :) Prompt for $EDITOR it is!

myersjustinc commented 8 years ago

Excellent! What should our options be?

The ones I'm thinking of so far (keeping in mind that we'd have to install them if they're not already provided):

Do we have anyone using anything else? Any Atom fans in the house, for example? (I should post this issue in #data-team.)

myersjustinc commented 8 years ago

Oh, I just remembered Bob's a TextMate guy (mate -w, with brew cask install textmate).

bobweston commented 8 years ago

I haven't yet tested this. But TextMate 2 is open source and it appears can be partially installed via brew:

http://burgua.org/post/29064784750/open-source-textmate-2

brew install ragel boost pgrep multimarkdown hg
brew install --HEAD https://raw.github.com/adamv/homebrew-alt/master/head-only/ninja.rb
git clone https://github.com/textmate/textmate.git
cd textmate
./configure && ninja

To allow it to work via the terminal, we need to add this symlink:

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate

https://manual.macromates.com/en/using_textmate_from_terminal.html

myersjustinc commented 8 years ago

I have most of this working in the editor-prompt branch. There's a menu during setup that asks for a text editor, installs that editor, and sets $EDITOR accordingly.

My two remaining concerns:

Thoughts?

zstumgoren commented 8 years ago

+1 to multiple questions. I think you're right that folks may want multiple editors installed, and it helps to separate out the question of which editor(s) one wants installed vs. the editor of choice for $EDITOR.

Crontab is a tricky one. Sounds like the wrapper script is the general solution.

Short-term alternatives could be:

  1. Restrict list of options for $EDITOR setting to options that work "out-of-the-box", with "nano" as default.
  2. Allow folks to select any $EDITOR, but alert them that selecting sublime and certain other text editors will require them to explicitly override the $EDITOR env variable when working with cron: export EDITOR=nano crontab -e

I suspect that most folks on the team are generally not using crontab on their personal dev machines, so number 2 could be a livable solution. But leaving the system in a broken state makes me itch.

I'd prefer to keep this simple and just go with option 1 above. This avoids the need to create a wrapper script, and while learning vim may be a tall order, I think folks could easily manage nano on the rare occasions this comes up.

And yes, that pretty much brings us back full circle to the start of this thread :)

@tthibo thoughts?