From fd6621cbf5b03618f6bf61200a92d9622c79db19 Mon Sep 17 00:00:00 2001 From: Wang Zhuochun Date: Sat, 20 Sep 2014 23:59:59 +0800 Subject: [PATCH] add toggle pin tab command --- extension/locale/en-US/vimfx.properties | 1 + extension/packages/commands.coffee | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/extension/locale/en-US/vimfx.properties b/extension/locale/en-US/vimfx.properties index 56407af..02d40aa 100644 --- a/extension/locale/en-US/vimfx.properties +++ b/extension/locale/en-US/vimfx.properties @@ -42,6 +42,7 @@ help_command_tab_move_right=Move current tab to the right help_command_home=Navigate to the Home Page help_command_tab_first=Go to the First tab help_command_tab_last=Go to the Last tab +help_command_toggle_pin_tab=Pin/Unpin current tab help_command_duplicate_tab=Duplicate current tab help_command_close_tabs_to_end=Close tabs from right to the end help_command_close_other_tabs=Close other tabs diff --git a/extension/packages/commands.coffee b/extension/packages/commands.coffee index 0d3fa0a..ef8fd94 100644 --- a/extension/packages/commands.coffee +++ b/extension/packages/commands.coffee @@ -177,6 +177,17 @@ command_tab_first = (vim) -> command_tab_last = (vim) -> vim.rootWindow.gBrowser.selectTabAtIndex(-1) +# Toggle Pin Tab +command_toggle_pin_tab = (vim) -> + console.log "pinning tab" + currenTab = vim.rootWindow.gBrowser.selectedTab + + console.log "yes inside #{currenTab}" + if currenTab.pinned + vim.rootWindow.gBrowser.unpinTab(currenTab) + else + vim.rootWindow.gBrowser.pinTab(currenTab) + # Duplicate current tab. command_duplicate_tab = (vim) -> { gBrowser } = vim.rootWindow @@ -378,6 +389,7 @@ commands = [ new Command('tabs', 'home', command_home, ['g,h']) new Command('tabs', 'tab_first', command_tab_first, ['g,H', 'g,^']) new Command('tabs', 'tab_last', command_tab_last, ['g,L', 'g,$']) + new Command('tabs', 'toggle_pin_tab', command_toggle_pin_tab, []) new Command('tabs', 'duplicate_tab', command_duplicate_tab, []) new Command('tabs', 'close_tabs_to_end', command_close_tabs_to_end, []) new Command('tabs', 'close_other_tabs', command_close_other_tabs, []) -- 2.39.3