" EasyMotion - Vim motions on speed! " " Author: Kim Silkebækken " Maintainer: haya14busa " Source: https://github.com/haya14busa/vim-easymotion " Original: https://github.com/Lokaltog/vim-easymotion " == Script initialization {{{ if exists('g:EasyMotion_loaded') || &compatible || version < 702 finish endif let g:EasyMotion_loaded = 1 " }}} " == Saving 'cpoptions' {{{ let s:save_cpo = &cpo set cpo&vim " }}} " == Default configuration {{{ " -- Option ------------------------------ {{{ let g:EasyMotion_keys = get(g:, \ 'EasyMotion_keys', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') let g:EasyMotion_do_mapping = get(g: , 'EasyMotion_do_mapping' , 1) let g:EasyMotion_do_special_mapping = get(g: , 'EasyMotion_do_special_mapping' , 0) let g:EasyMotion_do_shade = get(g: , 'EasyMotion_do_shade' , 1) let g:EasyMotion_grouping = get(g: , 'EasyMotion_grouping' , 1) let g:EasyMotion_startofline = get(g: , 'EasyMotion_startofline' , 1) let g:EasyMotion_smartcase = get(g: , 'EasyMotion_smartcase' , 0) let g:EasyMotion_skipfoldedline = get(g: , 'EasyMotion_skipfoldedline' , 1) let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0) let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0) let g:EasyMotion_enter_jump_first = get(g: , 'EasyMotion_enter_jump_first' , 0) "}}} " -- Default highlighting ---------------- {{{ let g:EasyMotion_hl_group_target = get(g:, \ 'EasyMotion_hl_group_target', 'EasyMotionTarget') let g:EasyMotion_hl2_first_group_target = get(g:, \ 'EasyMotion_hl2_first_group_target', 'EasyMotionTarget2First') let g:EasyMotion_hl2_second_group_target = get(g:, \ 'EasyMotion_hl2_second_group_target', 'EasyMotionTarget2Second') let g:EasyMotion_hl_group_shade = get(g:, \ 'EasyMotion_hl_group_shade', 'EasyMotionShade') let g:EasyMotion_hl_line_group_shade = get(g:, \ 'EasyMotion_hl_line_group_shade', 'EasyMotionShadeLine') let s:target_hl_defaults = { \ 'gui' : ['NONE', '#ff0000' , 'bold'] \ , 'cterm256': ['NONE', '196' , 'bold'] \ , 'cterm' : ['NONE', 'red' , 'bold'] \ } let s:target_hl2_first_defaults = { \ 'gui' : ['NONE', '#ffb400' , 'bold'] \ , 'cterm256': ['NONE', '11' , 'bold'] \ , 'cterm' : ['NONE', '11' , 'bold'] \ } let s:target_hl2_second_defaults = { \ 'gui' : ['NONE', '#b98300' , 'bold'] \ , 'cterm256': ['NONE', '3' , 'bold'] \ , 'cterm' : ['NONE', '3' , 'bold'] \ } let s:shade_hl_defaults = { \ 'gui' : ['NONE', '#777777' , 'NONE'] \ , 'cterm256': ['NONE', '242' , 'NONE'] \ , 'cterm' : ['NONE', 'grey' , 'NONE'] \ } let s:shade_hl_line_defaults = { \ 'gui' : ['red' , '#FFFFFF' , 'NONE'] \ , 'cterm256': ['red' , '242' , 'NONE'] \ , 'cterm' : ['red' , 'grey' , 'NONE'] \ } call EasyMotion#init#InitHL(g:EasyMotion_hl_group_target, s:target_hl_defaults) call EasyMotion#init#InitHL(g:EasyMotion_hl2_first_group_target, s:target_hl2_first_defaults) call EasyMotion#init#InitHL(g:EasyMotion_hl2_second_group_target, s:target_hl2_second_defaults) call EasyMotion#init#InitHL(g:EasyMotion_hl_group_shade, s:shade_hl_defaults) call EasyMotion#init#InitHL(g:EasyMotion_hl_line_group_shade, s:shade_hl_line_defaults) " Reset highlighting after loading a new color scheme {{{ augroup EasyMotionInitHL autocmd! autocmd ColorScheme * call EasyMotion#init#InitHL(g:EasyMotion_hl_group_target, s:target_hl_defaults) autocmd ColorScheme * call EasyMotion#init#InitHL(g:EasyMotion_hl2_first_group_target, s:target_hl2_first_defaults) autocmd ColorScheme * call EasyMotion#init#InitHL(g:EasyMotion_hl2_second_group_target, s:target_hl2_second_defaults) autocmd ColorScheme * call EasyMotion#init#InitHL(g:EasyMotion_hl_group_shade, s:shade_hl_defaults) autocmd ColorScheme * call EasyMotion#init#InitHL(g:EasyMotion_hl_line_group_shade, s:shade_hl_line_defaults) augroup end " }}} " }}} " }}} " == Mapping {{{ " Note: bd is short for bidirectional " l is short for (within) line " -- Find Motion {{{ " F: {{{ " (cound, visual, direction) noremap (easymotion-f) :call EasyMotion#S(1,0,0) xnoremap (easymotion-f) :call EasyMotion#S(1,1,0) noremap (easymotion-F) :call EasyMotion#S(1,0,1) xnoremap (easymotion-F) :call EasyMotion#S(1,1,1) noremap (easymotion-s) :call EasyMotion#S(1,0,2) xnoremap (easymotion-s) :call EasyMotion#S(1,1,2) "}}} " T: {{{ noremap (easymotion-t) :call EasyMotion#T(1,0,0) xnoremap (easymotion-t) :call EasyMotion#T(1,1,0) noremap (easymotion-T) :call EasyMotion#T(1,0,1) xnoremap (easymotion-T) :call EasyMotion#T(1,1,1) "}}} " Multi: {{{ noremap (easymotion-s2) :call EasyMotion#S(2,0,2) xnoremap (easymotion-s2) :call EasyMotion#S(2,1,2) "}}} "}}} " -- Word Motion {{{ " Word: {{{ noremap (easymotion-w) :call EasyMotion#WB(0,0) xnoremap (easymotion-w) :call EasyMotion#WB(1,0) noremap (easymotion-b) :call EasyMotion#WB(0,1) xnoremap (easymotion-b) :call EasyMotion#WB(1,1) " backward compatibility noremap (easymotion-S) :call EasyMotion#WB(0,2) xnoremap (easymotion-S) :call EasyMotion#WB(1,2) noremap (easymotion-bd-w) :call EasyMotion#WB(0,2) xnoremap (easymotion-bd-w) :call EasyMotion#WB(1,2) "}}} " WORD: {{{ noremap (easymotion-w) :call EasyMotion#WBW(0,0) xnoremap (easymotion-w) :call EasyMotion#WBW(1,0) noremap (easymotion-B) :call EasyMotion#WBW(0,1) xnoremap (easymotion-B) :call EasyMotion#WBW(1,1) noremap (easymotion-bd-W) :call EasyMotion#WBW(0,2) xnoremap (easymotion-bd-W) :call EasyMotion#WBW(1,2) "}}} " End Word: {{{ noremap (easymotion-e) :call EasyMotion#E(0,0) xnoremap (easymotion-e) :call EasyMotion#E(1,0) noremap (easymotion-ge) :call EasyMotion#E(0,1) xnoremap (easymotion-ge) :call EasyMotion#E(1,1) noremap (easymotion-bd-e) :call EasyMotion#E(0,2) xnoremap (easymotion-bd-e) :call EasyMotion#E(1,2) "}}} " END WORD: {{{ noremap (easymotion-E) :call EasyMotion#E(0,0) xnoremap (easymotion-E) :call EasyMotion#E(1,0) noremap (easymotion-gE) :call EasyMotion#E(0,1) xnoremap (easymotion-gE) :call EasyMotion#E(1,1) noremap (easymotion-bd-E) :call EasyMotion#EW(0,2) xnoremap (easymotion-bd-E) :call EasyMotion#EW(1,2) "}}} "}}} " -- JK Motion {{{ noremap (easymotion-j) :call EasyMotion#JK(0,0) xnoremap (easymotion-j) :call EasyMotion#JK(1,0) noremap (easymotion-k) :call EasyMotion#JK(0,1) xnoremap (easymotion-k) :call EasyMotion#JK(1,1) noremap (easymotion-bd-jk) :call EasyMotion#JK(0,2) xnoremap (easymotion-bd-jk) :call EasyMotion#JK(1,2) "}}} " -- Search Motion {{{ noremap (easymotion-n) :call EasyMotion#Search(0,0) xnoremap (easymotion-n) :call EasyMotion#Search(1,0) noremap (easymotion-N) :call EasyMotion#Search(0,1) xnoremap (easymotion-N) :call EasyMotion#Search(1,1) noremap (easymotion-bd-n) :call EasyMotion#Search(0,2) xnoremap (easymotion-bd-n) :call EasyMotion#Search(1,2) "}}} " -- Jump To Anywhere Motion {{{ noremap (easymotion-jumptoanywhere) \ :call EasyMotion#JumpToAnywhere(0,2) xnoremap (easymotion-jumptoanywhere) \ :call EasyMotion#JumpToAnywhere(1,2) "}}} " -- Repeat Motion {{{ noremap (easymotion-repeat) \ :call EasyMotion#Repeat(0) xnoremap (easymotion-repeat) \ :call EasyMotion#Repeat(1) "}}} " -- Line Motion {{{ " F Line: {{{ noremap (easymotion-fl) :call EasyMotion#SL(1,0,0) xnoremap (easymotion-fl) :call EasyMotion#SL(1,1,0) noremap (easymotion-Fl) :call EasyMotion#SL(1,0,1) xnoremap (easymotion-Fl) :call EasyMotion#SL(1,1,1) noremap (easymotion-sl) :call EasyMotion#SL(1,0,2) xnoremap (easymotion-sl) :call EasyMotion#SL(1,1,2) "}}} " T Line: {{{ noremap (easymotion-tl) :call EasyMotion#TL(1,0,0) xnoremap (easymotion-tl) :call EasyMotion#TL(1,1,0) noremap (easymotion-Tl) :call EasyMotion#TL(1,0,1) xnoremap (easymotion-Tl) :call EasyMotion#TL(1,1,1) "}}} " Word Line: {{{ noremap (easymotion-wl) :call EasyMotion#WBL(0,0) xnoremap (easymotion-wl) :call EasyMotion#WBL(1,0) noremap (easymotion-bl) :call EasyMotion#WBL(0,1) xnoremap (easymotion-bl) :call EasyMotion#WBL(1,1) noremap (easymotion-bd-wl) :call EasyMotion#WBL(0,2) xnoremap (easymotion-bd-wl) :call EasyMotion#WBL(1,2) "}}} " End Word Line: {{{ noremap (easymotion-el) :call EasyMotion#EL(0,0) xnoremap (easymotion-el) :call EasyMotion#EL(1,0) noremap (easymotion-gel) :call EasyMotion#EL(0,1) xnoremap (easymotion-gel) :call EasyMotion#EL(1,1) noremap (easymotion-bd-el) :call EasyMotion#EL(0,2) xnoremap (easymotion-bd-el) :call EasyMotion#EL(1,2) "}}} " LineAnywhere Line: {{{ noremap (easymotion-lineforward) \ :call EasyMotion#LineAnywhere(0,0) xnoremap (easymotion-lineforward) \ :call EasyMotion#LineAnywhere(1,0) noremap (easymotion-linebackward) \ :call EasyMotion#LineAnywhere(0,1) xnoremap (easymotion-linebackward) \ :call EasyMotion#LineAnywhere(1,1) noremap (easymotion-lineanywhere) \ :call EasyMotion#LineAnywhere(0,2) xnoremap (easymotion-lineanywhere) \ :call EasyMotion#LineAnywhere(1,2) "}}} "}}} " -- Special Motion {{{ onoremap (easymotion-special-l) :call EasyMotion#SelectLines() xnoremap (easymotion-special-l) :call EasyMotion#SelectLines() nnoremap y(easymotion-special-l) :call EasyMotion#SelectLinesYank() nnoremap d(easymotion-special-l) :call EasyMotion#SelectLinesDelete() onoremap (easymotion-special-p) :call EasyMotion#SelectPhrase() xnoremap (easymotion-special-p) :call EasyMotion#SelectPhrase() nnoremap y(easymotion-special-p) :call EasyMotion#SelectPhraseYank() nnoremap d(easymotion-special-p) :call EasyMotion#SelectPhraseDelete() "}}} " }}} " == Default key mapping {{{ if g:EasyMotion_do_mapping == 1 || g:EasyMotion_do_special_mapping == 1 " Prepare Prefix: {{{ if exists('g:EasyMotion_leader_key') exec 'map ' . g:EasyMotion_leader_key . ' (easymotion-prefix)' else if !hasmapto('(easymotion-prefix)') map (easymotion-prefix) endif endif "}}} " Default Mapping: call EasyMotion#init#InitMappings({ \ 'f' : { 'name': 'S' , 'dir': 0 } \ , 'F' : { 'name': 'S' , 'dir': 1 } \ , 's' : { 'name': 'S' , 'dir': 2 } \ , 'S' : { 'name': 'WB' , 'dir': 2 } \ , 't' : { 'name': 'T' , 'dir': 0 } \ , 'T' : { 'name': 'T' , 'dir': 1 } \ , 'w' : { 'name': 'WB' , 'dir': 0 } \ , 'W' : { 'name': 'WBW' , 'dir': 0 } \ , 'b' : { 'name': 'WB' , 'dir': 1 } \ , 'B' : { 'name': 'WBW' , 'dir': 1 } \ , 'e' : { 'name': 'E' , 'dir': 0 } \ , 'E' : { 'name': 'EW' , 'dir': 0 } \ , 'ge': { 'name': 'E' , 'dir': 1 } \ , 'gE': { 'name': 'EW' , 'dir': 1 } \ , 'j' : { 'name': 'JK' , 'dir': 0 } \ , 'k' : { 'name': 'JK' , 'dir': 1 } \ , 'n' : { 'name': 'Search' , 'dir': 0 } \ , 'N' : { 'name': 'Search' , 'dir': 1 } \ }, g:EasyMotion_do_mapping) " Special Mapping For Default: {{{ call EasyMotion#init#InitSpecialMappings({ \ 'l' : { 'name': 'SelectLines'} \ , 'p' : { 'name': 'SelectPhrase'} \ }, g:EasyMotion_do_special_mapping) " }}} endif "}}} " == Restore 'cpoptions' {{{ let &cpo = s:save_cpo unlet s:save_cpo " }}} " vim: fdm=marker:et:ts=4:sw=4:sts=4