All Projects → SpringHan → sniem

SpringHan / sniem

Licence: GPL-3.0 license
Hands-eased united editing method for emacs.

Programming Languages

emacs lisp
2029 projects

Projects that are alternatives of or similar to sniem

keymacs
Ergonomic keyboard layout for nonergonomic keyboards.
Stars: ✭ 22 (+29.41%)
Mutual labels:  colemak, dvorak
kinesis-advantage-2
Keyboard layouts and macros for the Kinesis Advantage 2 keyboard.
Stars: ✭ 72 (+323.53%)
Mutual labels:  colemak
lain-emacs
A modern(?) day Emacs configuration for the stubborn dvorak vimmer
Stars: ✭ 14 (-17.65%)
Mutual labels:  dvorak
dvorakjp-romantable
Google 日本語入力用DvorakJPローマ字テーブル / DvorakJP Roman Table for Google Japanese Input
Stars: ✭ 43 (+152.94%)
Mutual labels:  dvorak

Sniem

中文文档

Screenshot

screenshot.png

Dependences

  • s
  • dash

Installation

(use-package
 sniem
 :init (global-sniem-mode t)
 :config
 (sniem-set-keyboard-layout 'qwerty))

What is sniem

Sniem means Hands-eased United Editing Method,it’s a new editing method for Emacs.

Features

  • last-point

    last-point is a thing that through all motions and most of operations. Like its name, when execute any motions, the last position will be set to last-point.

  • leader-key

    Sniem has leader key,the key of leader map can be set by (sniem-leader-set-key). And you can use (sniem-set-leader-key) to set the key of leader.

    (sniem-leader-set-key
     "d" 'sniem-digit-argument-or-fn
     "D" 'dired)
    (sniem-set-leader-key ",")
        
  • Modes

    Sniem has 5 modes.

    • NORMAL: This mode is the default mode for the editing buffers.

      You can use (sniem-normal-set-key) to set keys for normal mode. Its usage is same as (sniem-leader-set-key).

    • INSERT: This mode will be used when you executed sniem-insert in NORMAL mode. It’s used to edit. In this mode, there’s only one binding for sniem, that is <ESC> which will make you exit INSERT mode back to NORMAL mode.
    • MOTION: This mode is used in special modes, there’s only has one binding for sniem, that is <SPC> which can let you use leader keys.
    • EXPAND: This mode is used to expand region more comfortablely.

      You can use (sniem-expand-set-key) to set keys for normal mode. Its usage is same as (sniem-leader-set-key).

      KeyFunction
      RETCall the object-catch function
      TABsniem-shift
      rRepeat the object-catch
      pCatch the parent pair of the content selected
      bCatch pair by its prefix char
      BCatch the parent pair of the content selected by its prefix char
      oCatch () pair
      OCatch parent () pair for the content selected
      sCatch [] pair
      SCatch parent [] pair for the content selected
      cCatch {} pair
      CCatch parent {} pair for the content selected
      qCatch ~”~ pair
      QCatch parent ~”~ pair for the content selected
      dCatch ~”“~ pair
      DCatch parent ~”“~ pair for the content selected
      aCatch <> pair
      ACatch parent <> pair for the content selected
      /Reverse the direction of catch
      Other alpha keysQuit expand mode and goto NORMAL mode
    • MINIBUFFER-KEYPAD: This mode allows you to use keypad in any minibuffers.

      When you’re in a minibuffer, you can input as usual. But when you input space in twice time, the keypad mode will be opened. And you can input space twice to exit keypad mode.

    • Keyboard layout

      Sniem provides supports for the mainly 4 layouts,you can use (sniem-set-keyboard-layout) to set.

      (sniem-set-keyboard-layout 'qwerty)
      (sniem-set-keyboard-layout 'colemak)
      (sniem-set-keyboard-layout 'dvorak)
      (sniem-set-keyboard-layout 'dvp)        ;For Dvorak Programmer
              

      After you set the keyboard layout, Sniem will set the default keys in NORMAL mode accroding to your layout, then create the cheatsheet.

    • Keypad

      Sniem provides the Keypad function, After you execute the Keypad, When you press: , is C- , . is M- , / is C-M- . After you press <SPC>, it will reture the next key itself which you press.

    • middle-keyboard-digit-argument-or-function

      This function is defaultly bound on <SPC>. After you execute it, the middle keys of the keyboard can be instead of numbers and -, the record will be over after you pressed <SPC>. You can also use the keys in the table to do the special operations:

      KeyFunction
      ,Repeat object-catch
      .Mark the content at point or a region
      kUnmark the content and select it
      KPop the newest marked-content
      SPCExecute function in motion-hint
      /Reverse the direction of object-catch
      pAdd, change or delete the pair of region
      <Jump to prev comment mark
      >Jump to next comment mark
      mInsert new comment mark
      cClear the special clipboard
      xPop the newest content in special clipboard
      PPaste from special clipboard
      yYank for special clipboard
      YYank in region for special clipboard
    • (sniem-shift)

      This function normally be binded to TAB in some mode’s keymaps. (Expect the insert mode keymap) And there’s a motion list (called shift-motion-list at below) which be linked to this function, it’s: sniem-forward-char, sniem-backward-char, sniem-next-line, sniem-prev-line, sniem-next-word, sniem-prev-word, sniem-scroll-up-command. Then, there’re three conditions you execute this function.

      1. Press TAB (The key which binds sniem-shift ) once

        When you just press once, this function is a replacement of shift. e.g.: You can execute the command of K by execute sniem-shift & k . Defaultly, it can be TAB k .

        But when you pressed a capital letter key after executing the function, in addition, the command of its lower case letter is a motion in shift-motion-list , the motion will be added or deleted from the motion-shift-locked key list.

      2. Press twice

        When you execute it twice, it’ll enter the motion-shift-locked mode. In this case, when you press the key of motions included in shift-motion-list , it will execute the motion of its capital letter key. And normally, only the first four motions of shift-motion-list are the in the motion-shift-locked mode key list. If you want to add or delete a motion from this mode, you just need to press its capital letter key. You can exit motion-shift-locked mode by press it twice.

      3. Press three times

        In this case, it will enter the Caps_Lock mode only in sniem insert mode. The effect is just like caps-lock (another package). You can press 3 times to exit this mode.

Some special operations

  • Motions
    • (sniem-goto-prev) & (sniem-goto-next)

      Use middle-keyboard to get the lines to forward or backward, then execute it.

    • (sniem-next-word) & (sniem-prev-word)

      Normally, goto the next or previous word. If there is a content selected, goto the next or previous content same as it.

    • (sniem-goto-last-point)

      Normally, goto the last-point. If the sniem-mark-content is exists, goto the mark-content.

    • (sniem-beginning-of-line)

      Normally, goto the beginning of current line. If the cursor is at beginning now, execute indentation function.

  • Editing operations
    • operation-about-last-point

      Most of the editing operations is related to last-point (Without (sniem-paste)).

      • You can press p after the operations to execute it with last-point.
      • (sniem-lock-unlock-last-point) Lock or unlock the last-point. When it is locked, it will display in the buffer.
    • operation-in-region

      All of the operations which are end with -in-region will edit the area from the forward point of the start of region to the backward point of the end of the region.

    • object-catch

      Sniem provides functions to get the object smartly: object-catch.

      • <RET>

        Get the closest pair to cursor.

      • <M-RET>

        Get the parent pair of the selected pair.

      • <C-RET>

        Input the char of the pair, then get the closest to cursor.

      • <C-M-RET>

        Input the char of the pair, then get the parent of the selected pair.

      • ( & [ & {

        Quickly get the pair.

    • (sniem-paste)

      Defaultly, press p to enter the interface of the sniem-paste. Then you can use n & p to flip. You can paste the first content when you press p in the first page. [1-9] to select the content.

    • (sniem-macro)

      Sniem provides some great kmacro functions.

      • Basic

        q for record, e for execution, n to name the last kmacro, l for lock or unlock the macro, . for forcely lock macro, c for call macro.

      • Advance
        • When you record after selecting some lines, the kmacro will be executed to all the lines you selected after recording.
        • If you record after selecting content in the same line, the content will be recorded. Then you can execute (sniem-next-word) or (sniem-prev-word) to goto the next or previous content same as it. Execute (keyboard-quit) can cancel the content record.
    • (sniem-search)

      Normally, searching the original content you input. When you give it prefix argument, the content will be packed with regexp for finding symbol automatically.

    • (sniem-mark) Expand

      When you use this function to mark symbol, if there’re some expand attachment of current mode in sniem-mark-attachments (custom part will introduce it) around current selection, you can execute mark function again to expand selection.

      For example, when you writing Python, you can execute mark function (mark symbol) twice to select self.test .

    • sniem-mark-jump

      sniem-mark-jump provides two motions. They are (sniem-mark-jump-next) & (sniem-mark-jump-prev). Normally, execute them can goto the next or previous comment mark. But if you use them with digit-argument, they’ll find the next or previous comment mark with type which is the number you input of the mark type alist.

Custom

  • sniem-center-message & sniem-mark-message , etc.

    Theses variables are the help message for their operations. If you don’t want them, you can execute this function:

    (setq sniem-center-message nil
          sniem-mark-message nil
          sniem-delete-message nil
          sniem-change-message nil
          sniem-yank-message nil
          sniem-macro-message nil
          sniem-pair-message nil)
        
  • sniem-xxx-mode-cursor

    The xxx can be: normal, insert, motion.

  • sniem-motion-hint-sit-time

    This is the sit time for motion hint. Default is 1.

  • State Hint

    If you use awesome-tray, sniem will automaticly set (sniem-state) to the alist, so you can use it. Otherwise, you can set the state hint accroding to your modeline.

    If you use the default modeline, you can try this:

    (setq-default mode-line-format (append '((:eval (sniem-state))) mode-line-format))
    (force-mode-line-update)
        
  • sniem-mark-jump
    • sniem-mark-jump-author-name

      This is the author name for the comment mark.

    • sniem-mark-jump-author-name-enable

      This variable is the status of the author name’s enablement.

  • sniem-mark-attachments

    When marking symbol, sniem will try getting attachment from this variable. If the pair under cursor is in this variable, it will be regarded as a part of symbol. To set this variable, you can use function (sniem-mark-set-attachment) . e.g.:

    (sniem-mark-set-attachment 'global "_")
    (sniem-mark-set-attachment 'emacs-lisp-mode "<" ">")
    (sniem-mark-set-attachment
     'c-mode
     :expand '("::")
     ;; Normally, if the expand attachment is one char, it will only work for once.
     ;; But if you set it to more chars, the attachment will work like a normal attachment.
     )
    (sniem-mark-set-attachment
     'python-mode
     :expand '(".")                         ;For expand
     )
        
  • sniem-object-catch-global-symbol-alist

    This variable is the list of pairs which can be catched. And this variable can also provide pair info to (sniem-mark) & (sniem-pair) . This variable includes some global pairs and some pairs for specific modes.

    You can set this by (add-to-list) to add global pairs or (sniem-object-catch-mode-defalist) to set for certain mode. e.g.:

    (add-to-list 'sniem-object-catch-global-symbol-alist '("^" . "^"))
    
    (sniem-object-catch-mode-defalist emacs-lisp-mode
      ("`" . "'")
      ("'" . ""))                           ;Set the back-pair to empty string, means to remove it from pair-list
        
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].