Affichage des articles dont le libellé est shortcuts. Afficher tous les articles
Affichage des articles dont le libellé est shortcuts. Afficher tous les articles

mardi 2 avril 2013

Little elisp proto-snippet of the day : duplicate-line, select-current-line

Because `C-a C-SPC C-e M-w` just doesn't cut it, and I like playing piano, I decided to dig the web for a few helpers. I'm quite fond of the keybindings right now, let's see if they stick.

(defun duplicate-line ()
  "copy the current line underneath"
  (interactive)
  (move-beginning-of-line 1)
  (kill-line)
  (yank)
  (open-line 1)
  (next-line 1)
  (yank)
  (move-beginning-of-line 1)
  (message "TODO: restore caret position?, on original or new line?"))

(defun select-current-line ()
  "Select the current line"
  (interactive)
  ;; (end-of-line) ; move to end of line
  ;; (set-mark (line-beginning-position))

  (beginning-of-line)
  (set-mark (line-end-position))
  (message "TODO: select from begin to end or end to begin ? (caret > [begin..end]/2 => beg to end. end to beg otherwise)"))

(global-set-key (kbd "C-S-d") 'duplicate-line)
(global-set-key (kbd "C-S-l") 'select-current-line)

samedi 14 avril 2012

Notes about Chrome Tabs. Ctrl, Shift and multiple tabs selection.

Messing with too many opened tabs in Chrome, I'm missing Firefox Tab Groups / Panorama. Just to bitch about Chrome I start shift-clicking tabs .. when they actually start to move together.  


It actually does what you'd expect:
  • Maintain SHIFT, click on two tabs, they're now a selected tab interval.
  • Maintain CTRL, click on many tabs, they're now a selected tab set.
The selection can be moved around in the tab bar, onto another window, or out to a new one. If you fiddle with a sparse tab set, the tabs will group together. It lacks a bit of user feedback, but beside that it does what you'd expect.

note: I run Chrome '20.0.1100.0 canary' on Windows XP.

Can't find any documentation about it, don't know if it's new or not.. but it's sure cute.


Edit: Tab Selection is really thought through. Operations allowed also include : 

  • pinning
  • closing* selection
  • closing* all but selection

(*) close a group isn't directly undo-able, Ctrl-Shift-T will re-open one at a time. nothing too bad.


And it's actually one year old. 'multiple tabs selection' or 'multiselect tabs'. cf these :
http://exde601e.blogspot.fr/2011/03/multiple-tab-selection-in-google-chrome.html
http://lifehacker.com/5791787/select-multiple-chrome-tabs-by-domain-or-history
http://www.thechromesource.com/tag/multiselect-chrome-tabs/
http://src.chromium.org/viewvc/chrome?view=rev&revision=78884


There's more: you can also select by domain or by opener.