Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions keymaps/vim-mode.cson
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
'ctrl-w q': 'core:close'
'g t': 'pane:show-next-item'
'g T': 'pane:show-previous-item'
'ctrl-6': 'vim-mode:focus-recent-tab'
'ctrl-^': 'vim-mode:focus-recent-tab'

'm': 'vim-mode:mark'
'`': 'vim-mode:move-to-mark-literal'
Expand Down
2 changes: 2 additions & 0 deletions lib/motions/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Motions = require './general-motions'
{Search, SearchCurrentWord, BracketMatchingMotion, RepeatSearch} = require './search-motion'
MoveToMark = require './move-to-mark-motion'
{Find, Till} = require './find-motion'
Pane = require './pane-motion'

Motions.Search = Search
Motions.SearchCurrentWord = SearchCurrentWord
Expand All @@ -10,5 +11,6 @@ Motions.RepeatSearch = RepeatSearch
Motions.MoveToMark = MoveToMark
Motions.Find = Find
Motions.Till = Till
Motions.Pane = Pane

module.exports = Motions
21 changes: 21 additions & 0 deletions lib/motions/pane-motion.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports =
class Pane
constructor: (@editor, @vimState) ->

execute: (count) ->
if count
atom.workspace.getActivePane().activateItemAtIndex(count-1)
else
activeEditor = atom.workspace.getActiveTextEditor()
editors = atom.workspace.getTextEditors()
editors = (editor for editor in editors when editor isnt activeEditor)
editors = editors.sort (a, b) -> b.lastOpened - a.lastOpened
@activateEditor(editors[0])

activateEditor: (item) ->
for pane in atom.workspace.getPanes()
index = pane.getItems().indexOf(item)
pane.activateItemAtIndex(index) if index?

isComplete: -> true
isRecordable: -> false
1 change: 1 addition & 0 deletions lib/vim-state.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class VimState
'search-current-word': (e) => new Motions.SearchCurrentWord(@editor, this)
'bracket-matching-motion': (e) => new Motions.BracketMatchingMotion(@editor, this)
'reverse-search-current-word': (e) => (new Motions.SearchCurrentWord(@editor, this)).reversed()
'focus-recent-tab': (e) => new Motions.Pane(@editor, this)

# Private: Register multiple command handlers via an {Object} that maps
# command names to command handler functions.
Expand Down