vim-easymotion/plugin/EasyMotion.vim

163 lines
5.9 KiB
VimL
Raw Normal View History

2011-03-28 10:18:00 +02:00
" EasyMotion - Vim motions on speed!
2011-03-28 00:08:06 +02:00
"
2011-03-29 14:10:00 +02:00
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
" Source repository: https://github.com/Lokaltog/vim-easymotion
2011-03-28 00:08:06 +02:00
2011-03-30 14:18:39 +02:00
" Script initialization {{{
if exists('g:EasyMotion_loaded') || &compatible || version < 702
2011-03-28 00:08:06 +02:00
finish
endif
let g:EasyMotion_loaded = 1
" }}}
2013-12-18 21:32:27 +09:00
" Saving 'cpoptions' {{{
let s:save_cpo = &cpo
set cpo&vim
" }}}
2011-03-28 00:08:06 +02:00
" Default configuration {{{
" Default options {{{
let g:EasyMotion_do_mapping = get(g:, 'EasyMotion_do_mapping', 1)
if g:EasyMotion_do_mapping == 1
if exists('g:EasyMotion_leader_key')
exec 'map ' . g:EasyMotion_leader_key . ' <Plug>(easymotion-prefix)'
else
if !hasmapto('<Plug>(easymotion-prefix)')
map <Leader><Leader> <Plug>(easymotion-prefix)
endif
endif
endif
call EasyMotion#init#InitOptions({
\ 'keys' : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
2013-10-04 23:32:09 +09:00
\ , 'do_shade' : 1
\ , 'do_special_mapping' : 0
2013-10-04 23:32:09 +09:00
\ , 'grouping' : 1
\ , 'startofline' : 1
\ , 'smartcase' : 0
2013-10-05 12:58:51 +09:00
\ , 'skipfoldedline' : 1
\ , 'use_migemo' : 0
\ , 'use_upper' : 0
\ , 'enter_jump_first' : 0
\
2013-05-15 14:05:02 -07:00
\ , 'hl_group_target' : 'EasyMotionTarget'
\ , 'hl2_first_group_target' : 'EasyMotionTarget2First'
\ , 'hl2_second_group_target' : 'EasyMotionTarget2Second'
\ , 'hl_group_shade' : 'EasyMotionShade'
2013-10-04 22:45:06 +09:00
\ , 'hl_line_group_shade' : 'EasyMotionShadeLine'
\ })
" }}}
" Default highlighting {{{
let s:target_hl_defaults = {
2011-03-31 15:39:58 +02:00
\ 'gui' : ['NONE', '#ff0000' , 'bold']
\ , 'cterm256': ['NONE', '196' , 'bold']
\ , 'cterm' : ['NONE', 'red' , 'bold']
\ }
2013-05-15 14:05:02 -07:00
let s:target_hl2_first_defaults = {
2013-05-13 21:43:58 -07:00
\ 'gui' : ['NONE', '#ffb400' , 'bold']
2013-05-31 11:12:34 -07:00
\ , 'cterm256': ['NONE', '11' , 'bold']
\ , 'cterm' : ['NONE', '11' , 'bold']
2013-05-13 21:43:58 -07:00
\ }
2013-05-15 14:05:02 -07:00
let s:target_hl2_second_defaults = {
\ 'gui' : ['NONE', '#b98300' , 'bold']
2013-05-31 11:12:34 -07:00
\ , 'cterm256': ['NONE', '3' , 'bold']
\ , 'cterm' : ['NONE', '3' , 'bold']
2013-10-04 20:35:22 +09:00
\ }
2013-05-13 22:53:51 -07:00
let s:shade_hl_defaults = {
2011-06-01 10:11:13 +02:00
\ 'gui' : ['NONE', '#777777' , 'NONE']
\ , 'cterm256': ['NONE', '242' , 'NONE']
\ , 'cterm' : ['NONE', 'grey' , 'NONE']
\ }
2013-05-15 19:32:47 -07:00
let s:shade_hl_line_defaults = {
2013-05-31 11:12:11 -07:00
\ 'gui' : ['red' , '#FFFFFF' , 'NONE']
\ , 'cterm256': ['red' , '242' , 'NONE']
\ , 'cterm' : ['red' , 'grey' , 'NONE']
2013-05-15 19:32:47 -07:00
\ }
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
" }}}
" }}}
2011-04-01 07:46:42 +02:00
" Default key mapping {{{
call EasyMotion#init#InitMappings({
\ 'f' : { 'name': 'F' , 'dir': 0 }
\ , 'F' : { 'name': 'F' , 'dir': 1 }
2013-05-15 14:05:02 -07:00
\ , '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)
2011-04-01 07:46:42 +02:00
" }}}
2013-06-03 17:26:16 -07:00
" Special mapping for other functions {{{
call EasyMotion#init#InitSpecialMappings({
\ 'l' : { 'name': 'SelectLines'}
\ , 'p' : { 'name': 'SelectPhrase'}
\ }, g:EasyMotion_do_special_mapping)
" }}}
" Prepare more key mapping {{{
2013-12-21 21:29:53 +09:00
" Note: bd is short for bidirectional
2013-12-22 23:49:56 +09:00
" l is short for (within) line
call EasyMotion#init#InitMappings({
\ 'bd-w' : { 'name': 'WB' , 'dir': 2 }
2013-12-21 21:29:53 +09:00
\ , 'bd-W' : { 'name': 'WBW' , 'dir': 2 }
\ , 'bd-e' : { 'name': 'E' , 'dir': 2 }
2013-12-21 21:29:53 +09:00
\ , 'bd-E' : { 'name': 'EW' , 'dir': 2 }
\ , 'bd-n' : { 'name': 'Search' , 'dir': 2 }
\ , 'bd-jk' : { 'name': 'JK' , 'dir': 2 }
2013-12-22 23:49:56 +09:00
\
\ , 'jumptoanywhere' : { 'name': 'JumpToAnywhere' , 'dir': 2 }
2013-12-22 23:49:56 +09:00
\ , 'lineforward' : { 'name': 'LineAnywhere' , 'dir': 0 }
\ , 'linebackward' : { 'name': 'LineAnywhere' , 'dir': 1 }
\ , 'lineanywhere' : { 'name': 'LineAnywhere' , 'dir': 2 }
\
\ , 'sl' : { 'name': 'SL' , 'dir': 2 }
\ , 'fl' : { 'name': 'SL' , 'dir': 0 }
\ , 'Fl' : { 'name': 'SL' , 'dir': 1 }
\ , 'tl' : { 'name': 'TL' , 'dir': 0 }
\ , 'Tl' : { 'name': 'TL' , 'dir': 1 }
2013-12-22 23:49:56 +09:00
\ , 'wl' : { 'name': 'WBL' , 'dir': 0 }
\ , 'bl' : { 'name': 'WBL' , 'dir': 1 }
\ , 'bd-wl' : { 'name': 'WBL' , 'dir': 2 }
\ , 'el' : { 'name': 'EL' , 'dir': 0 }
\ , 'gel' : { 'name': 'EL' , 'dir': 1 }
\ , 'bd-el' : { 'name': 'EL' , 'dir': 2 }
\
\ , 'repeat' : { 'name': 'Repeat' , 'dir': 0 }
\ }, 0) " Prepare <Plug> but don't map by default.
2013-12-19 15:55:31 +09:00
" }}}
2013-12-18 21:32:27 +09:00
" }}}
" Restore 'cpoptions' {{{
let &cpo = s:save_cpo
unlet s:save_cpo
2011-03-28 00:08:06 +02:00
" }}}
2011-06-17 22:27:23 +02:00
" vim: fdm=marker:noet:ts=4:sw=4:sts=4