Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
README.org 9.21 KB
Copy Edit Web IDE Raw Blame History

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 Simple 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 3 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).

      Key Function
      RET Call the object-catch function
      r Repeat the object-catch
      p Catch the parent pair of the content selected
      b Catch pair by its prefix char
      B Catch the parent pair of the content selected by its prefix char
      o Catch () pair
      O Catch parent () pair for the content selected
      s Catch [] pair
      S Catch parent [] pair for the content selected
      c Catch {} pair
      C Catch parent {} pair for the content selected
      q Catch ~”~ pair
      Q Catch parent ~”~ pair for the content selected
      d Catch ~”“~ pair
      D Catch parent ~”“~ pair for the content selected
      a Catch <> pair
      A Catch parent <> pair for the content selected
      / Reverse the direction of catch
      Other alpha keys Quit expand mode and goto NORMAL 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:

      Key Function
      , Repeat object-catch
      . Mark the content at point or a region
      SPC Execute function in motion-hint
      / Reverse the direction of object-catch
      p Add, change or delete the pair of region
      < Jump to prev comment mark
      > Jump to next comment mark
      m Insert new comment mark

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.

  • 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.

      • 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-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 & sniem-delete-message & sniem-change-message & sniem-yank-message & sniem-macro-message

    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-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.

Comment ( 0 )

Sign in for post a comment