Home git Replacing the default code editor in Git

Replacing the default code editor in Git

Author

Date

Category

started working with Git (namely c bitbucket) and the built-in editor (VIM) turned out to be very incomprehensible to me in management.

There was a desire to replace it with another (at least a notebook embedded in OS 7). How to do it?


Answer 1, Authority 100%

1. Setup levels.

Editor that uses Git is selected from the following list, it is in this order (from man git-commit ):

  1. Variable environment Git_Editor
  2. Git Core.Editor . Used normal for git priority settings:
    1. - Local – for this project.
    2. - Global – for this user. It is logical to configure the editor at this level.
    3. - System – for this work machine (within OS).
  3. Variable environment Visual
  4. Variable environment editor (Why so much variables? )
  5. If all these options are not installed, then uses VI / Vim.

2. Why -W ?

Why most of the above commands -W (- WAIT )? Git opens the editor and waits for the return exit code to continue working on the data in the file. If this parameter is not, Git will continue to work immediately and will not wait when you edit and save the file.

from atom -h :

- w, --wait wait for window to be closed before before returning.

3. Setting through the change Core.Editor .

does not require direct editing files and has flexibility in setting levels. The minus is that the remaining applications will continue to use the default editor.

In general, the configuration setting looks like this:

git config --global core.editor "Editor --parameters"

3.1 Linux, OS X

Many editors (Atom, TextWrangler and others) do not include support for the command line when installed. They need to be enabled separately, finding the command Install Shell Commands .

.

These lines can be immediately copied and executed in the terminal:

atom :

git config --global core.editor "atom -w"

Emacs (-W Default):

git config --global core.editor "Emacs"

Sublime Text

git config --global core.editor "subl -n -w"

TextMate

git config --global core.editor "Mate -W"

TextWrangler

git config --global core.editor "edit -w"

vim (-w by default):

git config --global core.editor "vim"

3.2 Windows

Option 1: Add editor in the PATH variable and use lines as for * nix.

Some editors when installing themselves prescribe themselves in Path.

Option 2: without changing the PATH variable, directly specify the path to the executable file. Pay attention to the nesting of quotes and how the parameter concisely looks like - WAIT under Windows .

NotePad ++ , on a 32-bit OS (Source ):

git config --global core.editor \
"'C: / Program Files / NotePad ++ / NotePad ++. EXE' -multiInst -Notabbar -Nosession -Noplugin"

NotePad ++, on a 64-bit OS:

git config --global core.editor \
"C: / Program Files (x86) / NotePad ++ / NotePad ++. EXE '-multiInst -Notabbar -Nosession -Noplugin"

Answer 2, Authority 38%

In the gita there is a setting for the editor, you can make for example so

git config --global core.editor youreditor

Variable YouReditor Must be Specified in PATH . When you dial YouReditor in the Windows console, then the console climbs into path and looks at which file corresponds to YouReditor .

However, it is worth it to something advanced, with a conventional notebook you are guaranteed to get a lot of problems, in particular with the endings of the lines.


Answer 3

Very handy Git Editor from Jetbrains (PhpStorm, Webstorm, Rubymine, IDEA)

Algorithm for adding Git Repository:

  1. vcs - & gt; Enable VCI
  2. git add ./
  3. Create a new repository
  4. bitbucket

  5. We register in the PHPSTOM terminal settings "C: \ Program Files (x86) \ Git \ Bin \ sh.exe" --Login -i - in the case of Windows,
    / bin / bash - in case of Linux
  6. We write in the console

    git remote add origin https: //[email protected]/asdalexey/angular-multi-select.git
    

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions