diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..9289537b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [haya14busa] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 00000000..c5f6acf6 --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -0,0 +1,36 @@ +name: reviewdog +on: + push: + branches: + - master + pull_request: + +jobs: + vint: + name: runner / vint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-vint@v1 + if: github.event_name == 'pull_request' + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-check + level: warning + - uses: reviewdog/action-vint@v1 + if: github.event_name != 'pull_request' + with: + github_token: ${{ secrets.github_token }} + reporter: github-check + level: warning + + languagetool: + name: runner / languagetool + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-languagetool@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-check + level: info diff --git a/.travis.yml b/.travis.yml index 09f727d3..ae7ddc63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,31 @@ +# This config is based on lightline.vim + language: ruby rvm: - 2.0.0 +install: + - git clone https://github.com/kana/vim-vspec.git before_script: - bundle install - bundle show + - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then + git clone https://github.com/vim/vim $HOME/vim && + cd $HOME/vim && + git checkout v$VIM_VERSION && + ./configure --prefix=$HOME/vim-$VIM_VERSION && + make && + make install; + fi) + +cache: + directories: + - $HOME/vim-$VIM_VERSION + +env: + - VIM_VERSION=8.0.0000 + - VIM_VERSION=7.4 + script: + - export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH + - cd $TRAVIS_BUILD_DIR - rake ci -install: - - git clone https://github.com/kana/vim-vspec.git diff --git a/Gemfile b/Gemfile index c562feef..8e36a7b2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gem 'vim-flavor', '~> 1.1' +gem 'vim-flavor', '~> 2.2.2' gem 'rake' diff --git a/README.md b/README.md index 709652c5..7077030a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Vim motion on speed! ===== [![Build Status](https://travis-ci.org/easymotion/vim-easymotion.svg?branch=master)](https://travis-ci.org/easymotion/vim-easymotion) +[![reviewdog](https://github.com/easymotion/vim-easymotion/workflows/reviewdog/badge.svg?branch=master&event=push)](https://github.com/easymotion/vim-easymotion/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster) ![Animated demonstration](https://f.cloud.github.com/assets/3797062/2039359/a8e938d6-899f-11e3-8789-60025ea83656.gif) @@ -98,7 +99,7 @@ Press `b` to jump to the second "o": Lorem ipsum dolor sit amet. Jeffrey Way of Nettuts+ has also [written -a tutorial](http://net.tutsplus.com/tutorials/other/vim-essential-plugin-easymotion/) +a tutorial](https://code.tutsplus.com/tutorials/vim-essential-plugin-easymotion--net-19223) about EasyMotion. New features in version 3.0 @@ -138,7 +139,7 @@ nmap w (easymotion-overwin-w) ```vim " You can use other keymappings like instead of if you want to -" use these mappings as default search and somtimes want to move cursor with +" use these mappings as default search and sometimes want to move cursor with " EasyMotion. function! s:incsearch_config(...) abort return incsearch#util#deepextend(deepcopy({ @@ -192,7 +193,7 @@ get to your destination. ### Bidirectional motions -All motions now come in a bidirectional variants (e.g. `(easymotion-s)`, +All motions now come in bidirectional variants (e.g. `(easymotion-s)`, `(easymotion-bd-w)` and so forth). By default, you can already jump forward or backward with `s`. A useful trick is to map `nmap s (easymotion-s)` to use `s` instead and save one @@ -200,7 +201,7 @@ keystroke! ### 2-character search motion -You can now also perform a 2-character search, similar to [vim-seek](https://github.com/goldfeld/vim-seek)/[vim-sneak](https://github.com/justinmk/vim-sneak) with `(easymotion-s2)`. For example you can highlight all words that start with `fu`. +You can now also perform a 2-character search, similar to [vim-seek](https://github.com/goldfeld/vim-seek)/[vim-sneak](https://github.com/justinmk/vim-sneak) with `(easymotion-s2)`. For example, you can highlight all words that start with `fu`. ![2-key-find-motion](https://f.cloud.github.com/assets/3797062/2039612/7cafcec8-89a5-11e3-8f2c-5f26a6b83efd.gif) @@ -316,7 +317,7 @@ input characters to find the last motion again. This requires https://github.com/tpope/vim-repeat. You can use EasyMotion with operators and press `.` to repeat! -It is well-behaved, and consistent with the default behavior of Vim. +It is well-behaved and consistent with the default behavior of Vim. ![repeat-motion](https://f.cloud.github.com/assets/3797062/2039538/0aef66aa-89a4-11e3-8242-c27a5208cfca.gif) @@ -355,6 +356,16 @@ Plugin 'easymotion/vim-easymotion' NeoBundle 'easymotion/vim-easymotion' ``` +### Vim-Plug (https://github.com/junegunn/vim-plug) +``` +Plug 'easymotion/vim-easymotion' +``` + +### Vim8 Native Plugin Manager (https://vimhelp.org/repeat.txt.html#packages) +``` +git clone https://github.com/easymotion/vim-easymotion.git ~/.vim/pack/plugins/start/vim-easymotion +``` + Minimal Configuration Tutorial ------------------------------ **I recommend configuring and map keys by yourself if you are true Vimmer.** @@ -377,7 +388,7 @@ nmap s (easymotion-overwin-f) " Need one more keystroke, but on average, it may be more comfortable. nmap s (easymotion-overwin-f2) -" Turn on case insensitive feature +" Turn on case-insensitive feature let g:EasyMotion_smartcase = 1 " JK motions: Line motions @@ -390,6 +401,6 @@ Now, all you need to remember is `s` and JK motions bindings, and it's good enou **`j`** & **`k`** make it easy to move to the lines. -Of course you can use any key you want instead of `s` such as ``, `s`, etc... +Of course, you can use any key you want instead of `s` such as ``, `s`, etc... If you want to use more useful mappings, please see [:h easymotion.txt](https://github.com/easymotion/vim-easymotion/blob/master/doc/easymotion.txt) for more detail. diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index df39bf2d..2a472237 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -435,7 +435,7 @@ function! s:Message(message) " {{{ if g:EasyMotion_verbose echo 'EasyMotion: ' . a:message else - " Make the current message dissapear + " Make the current message disappear echo '' " redraw endif @@ -739,14 +739,6 @@ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{ endfunction "}}} " -- Others ------------------------------ -function! s:is_cmdwin() "{{{ - return bufname('%') ==# '[Command Line]' -endfunction "}}} -function! s:should_use_wundo() "{{{ - " wundu cannot use in command-line window and - " unless undolist is not empty - return ! s:is_cmdwin() && undotree().seq_last != 0 -endfunction "}}} function! s:handleEmpty(input, visualmode) "{{{ " if empty, reselect and return 1 if empty(a:input) @@ -1103,13 +1095,12 @@ function! s:PromptUser(groups) "{{{ let lines_items = items(lines) " }}} + " Invoke autocmd so the user can temporarily disable linters, etc. + silent doautocmd User EasyMotionPromptBegin + " -- Put labels on targets & Get User Input & Restore all {{{ - " Save undo tree {{{ - let s:undo_file = tempname() - if s:should_use_wundo() - execute "wundo" s:undo_file - endif - "}}} + " Save undo tree + let undo_lock = EasyMotion#undo#save() try " Set lines with markers {{{ call s:SetLines(lines_items, 'marker') @@ -1156,23 +1147,13 @@ function! s:PromptUser(groups) "{{{ \ ) " }}} - " Restore undo tree {{{ - if s:should_use_wundo() && filereadable(s:undo_file) - silent execute "rundo" s:undo_file - call delete(s:undo_file) - unlet s:undo_file - else - " Break undo history (undobreak) - let old_undolevels = &undolevels - set undolevels=-1 - keepjumps call setline('.', getline('.')) - let &undolevels = old_undolevels - unlet old_undolevels - " FIXME: Error occur by GundoToggle for undo number 2 is empty - keepjumps call setline('.', getline('.')) - endif "}}} + " Restore undo tree + call undo_lock.restore() redraw + + " Invoke autocmd + silent doautocmd User EasyMotionPromptEnd endtry "}}} " -- Check if we have an input char ------ {{{ diff --git a/autoload/EasyMotion/undo.vim b/autoload/EasyMotion/undo.vim new file mode 100644 index 00000000..a14ef880 --- /dev/null +++ b/autoload/EasyMotion/undo.vim @@ -0,0 +1,50 @@ +let s:Buffer = vital#easymotion#import('Vim.Buffer') + +function! EasyMotion#undo#save() abort + return s:undo_lock.save() +endfunction + +let s:undo_lock = {} + +function! s:undo_lock.save() abort + let undo = deepcopy(self) + call undo._save() + return undo +endfunction + +function! s:undo_lock._save() abort + if undotree().seq_last == 0 + " if there are no undo history, disable undo feature by setting + " 'undolevels' to -1 and restore it. + let self.save_undolevels = &l:undolevels + let &l:undolevels = -1 + elseif !s:Buffer.is_cmdwin() + " command line window doesn't support :wundo. + let self.undofile = tempname() + execute 'wundo!' self.undofile + else + let self.is_cmdwin = s:TRUE + endif +endfunction + +function! s:undo_lock.restore() abort + if has_key(self, 'save_undolevels') + let &l:undolevels = self.save_undolevels + endif + if has_key(self, 'undofile') && filereadable(self.undofile) + silent execute 'rundo' self.undofile + call delete(self.undofile) + endif + if has_key(self, 'is_cmdwin') + " XXX: it breaks undo history. AFAIK, there are no way to save and restore + " undo history in commandline window. + call self.undobreak() + endif +endfunction + +function! s:undo_lock.undobreak() abort + let old_undolevels = &l:undolevels + setlocal undolevels=-1 + keepjumps call setline('.', getline('.')) + let &l:undolevels = old_undolevels +endfunction diff --git a/autoload/vital/_easymotion/HitAHint/Motion.vim b/autoload/vital/_easymotion/HitAHint/Motion.vim index 0e803d58..1f52cbd8 100644 --- a/autoload/vital/_easymotion/HitAHint/Motion.vim +++ b/autoload/vital/_easymotion/HitAHint/Motion.vim @@ -52,7 +52,7 @@ endfunction " - https://groups.google.com/forum/#!searchin/vim_dev/matchadd$20conceal/vim_dev/8bKa98GhHdk/VOzIBhd1m8YJ let s:can_preserve_syntax = s:has_patch(7, 4, 792) -" s:move() moves cursor over/accross window with Hit-A-Hint feature like +" s:move() moves cursor over/across window with Hit-A-Hint feature like " vim-easymotion " @param {dict} config function! s:move(pattern, ...) abort diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 845681af..1998112f 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -1,4 +1,4 @@ -*easymotion.txt* Version 3.0 +*easymotion.txt* Version 3.0 ______ __ ___ __ _ @@ -38,6 +38,7 @@ CONTENTS *easymotion-contents* Custom mappings ................. |easymotion-custom-mappings| Leader key .................. |easymotion-leader-key| Custom keys ................. |easymotion-custom-keys| + Autocommands .................... |easymotion-autocommands| License ............................ |easymotion-license| Known bugs ......................... |easymotion-known-bugs| Contributing ....................... |easymotion-contributing| @@ -252,7 +253,7 @@ Bidirection ~ End of word forward and backward. See |e| & |ge|. (easymotion-bd-E) *(easymotion-bd-E)* - End of WORD forward and backward. See |e| & |ge|. + End of WORD forward and backward. See |E| & |gE|. (easymotion-bd-jk) *(easymotion-bd-jk)* Line downward and upward. See |j| & |k|. @@ -424,9 +425,9 @@ JK Motion ~ JK motion option *(easymotion-j)* *(easymotion-k)* *g:EasyMotion_startofline* - The default behavior of the |j| and |k| is to move your cursor to the - start of the line. Set this option to 0 to force the cursor to stay in - the same column If you want to use both movements as separate + The default behavior of the |j| and |k| keys is to move your cursor to + the start of the line. Set this option to 0 to force the cursor to stay + in the same column. If you want to use both movements as separate mappings, set |'g:EasyMotion_startofline'| to 0 and map |(easymotion-sol-j)| & |(easymotion-sol-k)| to the start of line mapping: @@ -482,7 +483,7 @@ Search motion respect previous direction This is vim compatible |n| & |N| easymotion. Unlike |(easymotion-n)| and |(easymotion-N)| 's direction is always forward or backward, - these motions consider previous search direction. + these motions consider previous search direction. Within line motion ~ *easymotion-within-line* @@ -891,7 +892,7 @@ With this option enabled, |Easymotion| will shows target labels with uppercase letters, but allow you to type it in lowercase and have Easymotion automatically convert it uppercase. -This feature improve targets' readability. +This feature improves targets' readability. Example: > @@ -1002,7 +1003,7 @@ EasyMotion_add_search_history *g:EasyMotion_add_search_history* EasyMotion_off_screen_search *g:EasyMotion_off_screen_search* If you set this option to 1, the 'n' key find motion will search patterns - even outside of the current screen range. If you want to disable this + even outside the current screen range. If you want to disable this feature, set this value to 0. > let g:EasyMotion_off_screen_search = 0 @@ -1139,6 +1140,28 @@ Example: > See |easymotion-plug-table| for a table of motions that can be mapped and their default values. +------------------------------------------------------------------------------ +Autocommands *easymotion-autocommands* + *EasyMotionPromptBegin* *EasyMotionPromptEnd* + +EasyMotion invokes two |User| autocommands, |EasyMotionPromptBegin| and +|EasyMotionPromptEnd|, so you can temporarily disable your linter to avoid +annoying syntax errors. + +EasyMotionPromptBegin Before the content of buffer is changed with + markers. If EasyMotion directly jumps to the + target (no prompts given), this autocommand will + not be executed. + +EasyMotionPromptEnd After the content of buffer and the undo tree are + restored. + +Example with coc.nvim: > + + autocmd User EasyMotionPromptBegin silent! CocDisable + autocmd User EasyMotionPromptEnd silent! CocEnable +< + ============================================================================== License *easymotion-license*