mirror of
https://github.com/atom/atom.git
synced 2026-02-06 12:44:59 -05:00
Add ctrl-Z keybinding to checkout HEAD revision
This commit is contained in:
@@ -8,7 +8,7 @@ CursorView = require 'cursor-view'
|
||||
SelectionView = require 'selection-view'
|
||||
Native = require 'native'
|
||||
fs = require 'fs'
|
||||
|
||||
Git = require 'git'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
|
||||
@@ -154,6 +154,7 @@ class Editor extends View
|
||||
'editor:show-previous-buffer': @loadPreviousEditSession
|
||||
'editor:toggle-line-comments': @toggleLineCommentsInSelection
|
||||
'editor:log-cursor-scope': @logCursorScope
|
||||
'editor:checkout-head-revision': @checkoutHead
|
||||
|
||||
documentation = {}
|
||||
for name, method of editorBindings
|
||||
@@ -274,6 +275,11 @@ class Editor extends View
|
||||
setInvisibles: (@invisibles={}) ->
|
||||
@renderLines()
|
||||
|
||||
checkoutHead: ->
|
||||
if path = @getPath()
|
||||
if new Git(path).checkoutHead(path)
|
||||
@trigger 'editor-git-status-change'
|
||||
|
||||
setText: (text) -> @getBuffer().setText(text)
|
||||
getText: -> @getBuffer().getText()
|
||||
getPath: -> @getBuffer().getPath()
|
||||
|
||||
2
src/app/keymaps/git.coffee
Normal file
2
src/app/keymaps/git.coffee
Normal file
@@ -0,0 +1,2 @@
|
||||
window.keymap.bindKeys '.editor',
|
||||
'ctrl-Z': 'editor:checkout-head-revision'
|
||||
@@ -40,6 +40,8 @@ class StatusBar extends View
|
||||
@updateCursorPositionText()
|
||||
@editor.on 'cursor-move', => _.delay (=> @updateCursorPositionText()), 50
|
||||
|
||||
@editor.on 'editor-git-status-change', => @updateStatusBar()
|
||||
|
||||
@subscribeToBuffer()
|
||||
|
||||
subscribeToBuffer: ->
|
||||
|
||||
Reference in New Issue
Block a user