From fadb3ffebf47e174ac0bd997a744cd49a9c5ac42 Mon Sep 17 00:00:00 2001 From: Taufik Nurrohman Date: Tue, 6 Dec 2022 07:17:39 +0700 Subject: [PATCH] Add Vim Cycle --- .../vendor/start/better-whitespace/.gitignore | 1 - .../vendor/start/better-whitespace/doc/tags | 16 ++ .../vendor/start/bullets/.all-contributorsrc | 18 ++ .vim/pack/vendor/start/bullets/.gitignore | 1 + .vim/pack/vendor/start/bullets/.tool-versions | 2 +- .vim/pack/vendor/start/bullets/Gemfile | 1 + .vim/pack/vendor/start/bullets/Gemfile.lock | 3 + .vim/pack/vendor/start/bullets/README.md | 106 +++++-- .../vendor/start/bullets/plugin/bullets.vim | 164 ++++++++--- .../start/bullets/spec/asciidoc_spec.rb | 1 + .../start/bullets/spec/nested_bullets_spec.rb | 29 ++ .../vendor/start/bullets/spec/spec_helper.rb | 16 ++ .vim/pack/vendor/start/closetag/README.md | 48 +++- .../closetag/ftplugin/javascript.jsx.vim | 1 + .../closetag/ftplugin/javascriptreact.vim | 1 + .../closetag/ftplugin/typescript.tsx.vim | 1 + .../closetag/ftplugin/typescriptreact.vim | 1 + .../vendor/start/closetag/plugin/closetag.vim | 17 +- .../start/commentary/.github/FUNDING.yml | 2 - .../start/commentary/plugin/commentary.vim | 7 +- .../vendor/start/ctrlp/autoload/ctrlp.vim | 70 +++-- .../start/ctrlp/autoload/ctrlp/buffertag.vim | 10 +- .vim/pack/vendor/start/ctrlp/doc/ctrlp.cnx | 23 +- .vim/pack/vendor/start/ctrlp/doc/ctrlp.txt | 41 +-- .vim/pack/vendor/start/cycle/.gitignore | 1 + .vim/pack/vendor/start/cycle/README.markdown | 57 ++++ .vim/pack/vendor/start/cycle/doc/cycle.txt | 40 +++ .vim/pack/vendor/start/cycle/plugin/cycle.vim | 231 +++++++++++++++ .../start/lastplace/plugin/vim-lastplace.vim | 2 +- .vim/pack/vendor/start/lexima/.gitignore | 3 +- .vim/pack/vendor/start/lexima/.travis.yml | 21 +- .vim/pack/vendor/start/lexima/README.md | 18 +- .../vendor/start/lexima/autoload/lexima.vim | 9 +- .../lexima/autoload/lexima/charstack.vim | 4 + .../start/lexima/autoload/lexima/cmdmode.vim | 65 +++-- .../lexima/autoload/lexima/endwise_rule.vim | 2 +- .../start/lexima/autoload/lexima/insmode.vim | 267 ++++++++++++------ .../start/lexima/autoload/lexima/string.vim | 4 +- .vim/pack/vendor/start/lexima/doc/lexima.txt | 130 +++++++-- .vim/pack/vendor/start/lexima/doc/tags | 16 +- .../vendor/start/lexima/plugin/lexima.vim | 34 ++- .../vendor/start/lexima/test/cmdmode.vimspec | 48 ++++ .../start/lexima/test/default_rules.vimspec | 2 + .../start/lexima/test/endwise_rules.vimspec | 2 +- .../vendor/start/lexima/test/insmode.vimspec | 186 +++++++++++- .../start/nerdtree-visual-selection/README.md | 47 ++- .../ftplugin/nerdtree.vim | 39 ++- .../nerdtree/.github/ISSUE_TEMPLATE/bug.md | 46 --- .../.github/ISSUE_TEMPLATE/feature_request.md | 8 - .../.github/ISSUE_TEMPLATE/question.md | 13 - .../nerdtree/.github/PULL_REQUEST_TEMPLATE.md | 22 -- .../start/nerdtree/.github/workflows/vint.yml | 15 - .../vendor/start/nerdtree/README.markdown | 2 +- .../vendor/start/repeat/.github/FUNDING.yml | 2 - .../vendor/start/surround/.github/FUNDING.yml | 2 - .vim/pack/vendor/start/surround/.gitignore | 2 +- .../vendor/start/surround/README.markdown | 9 +- .../vendor/start/surround/doc/surround.txt | 14 +- .../vendor/start/surround/plugin/surround.vim | 23 +- .../start/unimpaired/.github/FUNDING.yml | 2 - .../start/unimpaired/doc/unimpaired.txt | 3 +- .../start/unimpaired/plugin/unimpaired.vim | 72 +++-- .vim/vimrc | 1 + README.md | 3 + 64 files changed, 1566 insertions(+), 481 deletions(-) delete mode 100644 .vim/pack/vendor/start/better-whitespace/.gitignore create mode 100644 .vim/pack/vendor/start/better-whitespace/doc/tags create mode 100644 .vim/pack/vendor/start/closetag/ftplugin/javascript.jsx.vim create mode 100644 .vim/pack/vendor/start/closetag/ftplugin/javascriptreact.vim create mode 100644 .vim/pack/vendor/start/closetag/ftplugin/typescript.tsx.vim create mode 100644 .vim/pack/vendor/start/closetag/ftplugin/typescriptreact.vim delete mode 100644 .vim/pack/vendor/start/commentary/.github/FUNDING.yml create mode 100644 .vim/pack/vendor/start/cycle/.gitignore create mode 100644 .vim/pack/vendor/start/cycle/README.markdown create mode 100644 .vim/pack/vendor/start/cycle/doc/cycle.txt create mode 100644 .vim/pack/vendor/start/cycle/plugin/cycle.vim delete mode 100644 .vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/bug.md delete mode 100644 .vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/question.md delete mode 100644 .vim/pack/vendor/start/nerdtree/.github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .vim/pack/vendor/start/nerdtree/.github/workflows/vint.yml delete mode 100644 .vim/pack/vendor/start/repeat/.github/FUNDING.yml delete mode 100644 .vim/pack/vendor/start/surround/.github/FUNDING.yml delete mode 100644 .vim/pack/vendor/start/unimpaired/.github/FUNDING.yml diff --git a/.vim/pack/vendor/start/better-whitespace/.gitignore b/.vim/pack/vendor/start/better-whitespace/.gitignore deleted file mode 100644 index 926ccaa..0000000 --- a/.vim/pack/vendor/start/better-whitespace/.gitignore +++ /dev/null @@ -1 +0,0 @@ -doc/tags diff --git a/.vim/pack/vendor/start/better-whitespace/doc/tags b/.vim/pack/vendor/start/better-whitespace/doc/tags new file mode 100644 index 0000000..fd4fb76 --- /dev/null +++ b/.vim/pack/vendor/start/better-whitespace/doc/tags @@ -0,0 +1,16 @@ +better-whitespace-:DisableStripWhitespaceOnSave better-whitespace.txt /*better-whitespace-:DisableStripWhitespaceOnSave* +better-whitespace-:DisableWhitespace better-whitespace.txt /*better-whitespace-:DisableWhitespace* +better-whitespace-:EnableStripWhitespaceOnSave better-whitespace.txt /*better-whitespace-:EnableStripWhitespaceOnSave* +better-whitespace-:EnableWhitespace better-whitespace.txt /*better-whitespace-:EnableWhitespace* +better-whitespace-:NextTrailingWhitespace better-whitespace.txt /*better-whitespace-:NextTrailingWhitespace* +better-whitespace-:PrevTrailingWhitespace better-whitespace.txt /*better-whitespace-:PrevTrailingWhitespace* +better-whitespace-:StripWhitespace better-whitespace.txt /*better-whitespace-:StripWhitespace* +better-whitespace-:StripWhitespaceOnChangedLines better-whitespace.txt /*better-whitespace-:StripWhitespaceOnChangedLines* +better-whitespace-:ToggleStripWhitespaceOnSave better-whitespace.txt /*better-whitespace-:ToggleStripWhitespaceOnSave* +better-whitespace-:ToggleWhitespace better-whitespace.txt /*better-whitespace-:ToggleWhitespace* +better-whitespace-colors better-whitespace.txt /*better-whitespace-colors* +better-whitespace-commands better-whitespace.txt /*better-whitespace-commands* +better-whitespace-current_line better-whitespace.txt /*better-whitespace-current_line* +better-whitespace-operator better-whitespace.txt /*better-whitespace-operator* +better-whitespace-preferences better-whitespace.txt /*better-whitespace-preferences* +better-whitespace.txt better-whitespace.txt /*better-whitespace.txt* diff --git a/.vim/pack/vendor/start/bullets/.all-contributorsrc b/.vim/pack/vendor/start/bullets/.all-contributorsrc index a0716e9..83dc64a 100644 --- a/.vim/pack/vendor/start/bullets/.all-contributorsrc +++ b/.vim/pack/vendor/start/bullets/.all-contributorsrc @@ -147,6 +147,24 @@ "contributions": [ "doc" ] + }, + { + "login": "clarkshaeffer", + "name": "Clark", + "avatar_url": "https://avatars.githubusercontent.com/u/58539767?v=4", + "profile": "https://github.com/clarkshaeffer", + "contributions": [ + "doc" + ] + }, + { + "login": "wenzel-hoffman", + "name": "Wenzel", + "avatar_url": "https://avatars.githubusercontent.com/u/111205756?v=4", + "profile": "https://github.com/wenzel-hoffman", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/.vim/pack/vendor/start/bullets/.gitignore b/.vim/pack/vendor/start/bullets/.gitignore index cc60121..0d1204a 100644 --- a/.vim/pack/vendor/start/bullets/.gitignore +++ b/.vim/pack/vendor/start/bullets/.gitignore @@ -1,3 +1,4 @@ doc/tags vendor/ spec/examples.txt +doc/tags diff --git a/.vim/pack/vendor/start/bullets/.tool-versions b/.vim/pack/vendor/start/bullets/.tool-versions index 44d859d..059ca47 100644 --- a/.vim/pack/vendor/start/bullets/.tool-versions +++ b/.vim/pack/vendor/start/bullets/.tool-versions @@ -1 +1 @@ -ruby 2.7.0 +ruby 3.1.0 diff --git a/.vim/pack/vendor/start/bullets/Gemfile b/.vim/pack/vendor/start/bullets/Gemfile index 0e38c42..5e44fe6 100644 --- a/.vim/pack/vendor/start/bullets/Gemfile +++ b/.vim/pack/vendor/start/bullets/Gemfile @@ -7,5 +7,6 @@ group :test do gem 'pry-byebug' gem 'rake', '~> 12.3.3' gem 'rspec' + gem 'rspec-retry' gem 'vimrunner' end diff --git a/.vim/pack/vendor/start/bullets/Gemfile.lock b/.vim/pack/vendor/start/bullets/Gemfile.lock index f346f69..0f47b00 100644 --- a/.vim/pack/vendor/start/bullets/Gemfile.lock +++ b/.vim/pack/vendor/start/bullets/Gemfile.lock @@ -24,6 +24,8 @@ GEM rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) + rspec-retry (0.6.2) + rspec-core (> 3.3) rspec-support (3.8.0) vimrunner (0.3.4) @@ -35,6 +37,7 @@ DEPENDENCIES pry-byebug rake (~> 12.3.3) rspec + rspec-retry vimrunner BUNDLED WITH diff --git a/.vim/pack/vendor/start/bullets/README.md b/.vim/pack/vendor/start/bullets/README.md index 3453379..e918a9d 100644 --- a/.vim/pack/vendor/start/bullets/README.md +++ b/.vim/pack/vendor/start/bullets/README.md @@ -1,11 +1,13 @@ ![Bullets.vim](img/bullets-vim-logo.svg) -[![Build Status](https://travis-ci.org/dkarter/bullets.vim.svg?branch=master)](https://travis-ci.org/dkarter/bullets.vim) +[![Build Status](https://travis-ci.org/dkarter/bullets.vim.svg?branch=master)](https://travis-ci.org/dkarter/bullets.vim) -[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-) +> :information_source: Looking for help/maintainers https://github.com/dkarter/bullets.vim/issues/126 + # Description Bullets.vim is a Vim plugin for automated bullet lists. @@ -22,7 +24,14 @@ Renumbering lines: # Installation -With VimPlug: +### With Vim 8.1+ native package manager: +Clone into + +`.vim/pack/plugins/start` + +Make sure to include `packloadall` in your `vimrc`. + +### With VimPlug: ```vim Plug 'dkarter/bullets.vim' @@ -70,6 +79,36 @@ Add a leader key before default mappings: let g:bullets_mapping_leader = '' " default = '' ``` +Customize key mappings: + +```vim +let g:bullets_set_mappings = 0 " disable adding default key mappings, default = 1 + +" default = [] +" N.B. You can set these mappings as-is without using this g:bullets_custom_mappings option but it +" will apply in this case for all file types while when using g:bullets_custom_mappings it would +" take into account file types filter set in g:bullets_enabled_file_types, and also +" g:bullets_enable_in_empty_buffers option. +let g:bullets_custom_mappings = [ + \ ['imap', '', '(bullets-newline)'], + \ ['inoremap', '', ''], + \ + \ ['nmap', 'o', '(bullets-newline)'], + \ + \ ['vmap', 'gN', '(bullets-renumber)'], + \ ['nmap', 'gN', '(bullets-renumber)'], + \ + \ ['nmap', 'x', '(bullets-toggle-checkbox)'], + \ + \ ['imap', '', '(bullets-demote)'], + \ ['nmap', '>>', '(bullets-demote)'], + \ ['vmap', '>', '(bullets-demote)'], + \ ['imap', '', '(bullets-promote)'], + \ ['nmap', '<<', '(bullets-promote)'], + \ ['vmap', '<', '(bullets-promote)'], + \ ] +``` + Enable/disable deleting the last empty bullet when hitting `` (insert mode) or `o` (normal mode): ```vim @@ -101,6 +140,15 @@ let g:bullets_pad_right = 0 " ^ no extra space between bullet and text ``` +Indent new bullets when the previous bullet ends with a colon: + +```vim +let g:bullets_auto_indent_after_colon = 1 " default = 1 +" a. text +" b. text: +" i. text +``` + Maximum number of alphabetic characters to use for bullets: ```vim @@ -175,7 +223,7 @@ let g:bullets_nested_checkboxes = 1 " default = 1 " - [ ] child bullet [ type x ] " - [ ] sub-child " - [ ] child bullet -" +" " Result: " - [o] first bullet [ <- indicates partial completion of sub-tasks ] " - [X] child bullet @@ -216,18 +264,18 @@ let g:bullets_checkbox_partials_toggle = 1 " default = 1 " - [o] partially checked [ type x ] " - [x] sub bullet " - [ ] sub bullet -" +" " Result: " - [x] checked " - [x] sub bullet " - [x] sub bullet -" +" " Example 2: let g:bullets_checkbox_partials_toggle = 0 " - [o] partially checked [ type x ] " - [x] sub bullet " - [ ] sub bullet -" +" " Result: " - [ ] checked " - [ ] sub bullet @@ -260,7 +308,7 @@ let g:bullets_set_mappings = 0 Add a leader key before default mappings: ```vim -let g:bullets_mapping_leader = '' +let g:bullets_mapping_leader = '' " Set to the leader before all default mappings: " Example: renumbering becomes `gN` instead of just `gN` ``` @@ -338,24 +386,30 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +

Dorian Karter

💻 ⚠️ 📖 🚧

Cormac Relf

💻 🐛

Keith Miyake

💻 📖 🤔 🚧

Chayoung You

💻 📖

Adriaan Zonnenberg

💻

eater

💻

hut

💻 📖

mykoza

💻 🤔

noodlor

💻

Harshad Srinivasan

💻 🐛

Erick A. Chacón Montalván

🤔

Sam Griesemer

💻 🐛

Charles Pence

💻

Marko Stojanovic

📖

Dorian Karter

💻 ⚠️ 📖 🚧

Cormac Relf

💻 🐛

Keith Miyake

💻 📖 🤔 🚧

Chayoung You

💻 📖

Adriaan Zonnenberg

💻

eater

💻

hut

💻 📖

mykoza

💻 🤔

noodlor

💻

Harshad Srinivasan

💻 🐛

Erick A. Chacón Montalván

🤔

Sam Griesemer

💻 🐛

Charles Pence

💻

Marko Stojanovic

📖

Clark

📖

Wenzel

💻
diff --git a/.vim/pack/vendor/start/bullets/plugin/bullets.vim b/.vim/pack/vendor/start/bullets/plugin/bullets.vim index 6027a7f..f54116f 100644 --- a/.vim/pack/vendor/start/bullets/plugin/bullets.vim +++ b/.vim/pack/vendor/start/bullets/plugin/bullets.vim @@ -1,6 +1,6 @@ scriptencoding utf-8 " Vim plugin for automated bulleted lists -" Last Change: Thu Mar 4 21:29:54 CST 2021 +" Last Change: Sat Jan 29 06:56:14 PM CST 2022 " Maintainer: Dorian Karter " License: MIT " FileTypes: markdown, text, gitcommit @@ -34,6 +34,18 @@ if !exists('g:bullets_mapping_leader') let g:bullets_mapping_leader = '' end +" Extra key mappings in addition to default ones. +" If you don’t need default mappings set 'g:bullets_set_mappings' to '0'. +" N.B. 'g:bullets_mapping_leader' has no effect on these mappings. +" +" Example: +" let g:bullets_custom_mappings = [ +" \ ['imap', '', '(bullets-newline)'], +" \ ] +if !exists('g:bullets_custom_mappings') + let g:bullets_custom_mappings = [] +endif + if !exists('g:bullets_delete_last_bullet_if_empty') let g:bullets_delete_last_bullet_if_empty = 1 end @@ -96,22 +108,34 @@ if !exists('g:bullets_checkbox_partials_toggle') let g:bullets_checkbox_partials_toggle = 1 endif +if !exists('g:bullets_auto_indent_after_colon') + " Should a line ending in a colon result in the next line being indented (1)? + let g:bullets_auto_indent_after_colon = 1 +endif + " ------------------------------------------------------ }}} " Parse Bullet Type ------------------------------------------- {{{ fun! s:parse_bullet(line_num, line_text) - let l:kinds = s:filter( - \ [ - \ s:match_bullet_list_item(a:line_text), - \ s:match_checkbox_bullet_item(a:line_text), - \ s:match_numeric_list_item(a:line_text), - \ s:match_roman_list_item(a:line_text), - \ s:match_alphabetical_list_item(a:line_text), - \ ], - \ '!empty(v:val)' - \ ) - - return s:map(l:kinds, 'extend(v:val, { "starting_at_line_num": ' . a:line_num . ' })') + + let l:bullet = s:match_bullet_list_item(a:line_text) + " Must be a bullet to be a checkbox + let l:check = !empty(l:bullet) ? s:match_checkbox_bullet_item(a:line_text) : {} + " Cannot be numeric if a bullet + let l:num = empty(l:bullet) ? s:match_numeric_list_item(a:line_text) : {} + " Cannot be alphabetic if numeric or a bullet + let l:alpha = empty(l:bullet) && empty(l:num) ? s:match_alphabetical_list_item(a:line_text) : {} + " Cannot be roman if numeric or a bullet + let l:roman = empty(l:bullet) && empty(l:num) ? s:match_roman_list_item(a:line_text) : {} + + let l:kinds = s:filter([l:bullet, l:check, l:num, l:alpha, l:roman], '!empty(v:val)') + + for l:data in l:kinds + let l:data.starting_at_line_num = a:line_num + endfor + + return l:kinds + endfun fun! s:match_numeric_list_item(input_text) @@ -437,6 +461,7 @@ fun! s:insert_new_bullet() " searching up from there let l:send_return = 1 let l:normal_mode = mode() ==# 'n' + let l:indent_next = s:line_ends_in_colon(l:curr_line_num) && g:bullets_auto_indent_after_colon " check if current line is a bullet and we are at the end of the line (for " insert mode only) @@ -466,12 +491,23 @@ fun! s:insert_new_bullet() " insert next bullet call append(l:curr_line_num, l:next_bullet_list) - " got to next line after the new bullet + + + " go to next line after the new bullet let l:col = strlen(getline(l:next_line_num)) + 1 - if g:bullets_renumber_on_change + call setpos('.', [0, l:next_line_num, l:col]) + + " indent if previous line ended in a colon + if l:indent_next + " demote the new bullet + call s:change_bullet_level_and_renumber(-1) + " reset cursor position after indenting + let l:col = strlen(getline(l:next_line_num)) + 1 + call setpos('.', [0, l:next_line_num, l:col]) + elseif g:bullets_renumber_on_change call s:renumber_whole_list() endif - call setpos('.', [0, l:next_line_num, l:col]) + let l:send_return = 0 endif endif @@ -495,6 +531,14 @@ fun! s:is_at_eol() endfun command! InsertNewBullet call insert_new_bullet() + +" Helper for Colon Indent +" returns 1 if current line ends in a colon, else 0 +fun! s:line_ends_in_colon(lnum) + return getline(a:lnum)[strlen(getline(a:lnum))-1:] ==# ':' +endfun +" --------------------------------------------------------- }}} + " --------------------------------------------------------- }}} " Checkboxes ---------------------------------------------- {{{ @@ -926,11 +970,11 @@ fun! s:change_bullet_level(direction) endfun fun! s:change_bullet_level_and_renumber(direction) - " Calls change_bullet_level and then renumber_whole_list if required - call s:change_bullet_level(a:direction) - if g:bullets_renumber_on_change - call s:renumber_whole_list() - endif + " Calls change_bullet_level and then renumber_whole_list if required + call s:change_bullet_level(a:direction) + if g:bullets_renumber_on_change + call s:renumber_whole_list() + endif endfun fun! s:visual_change_bullet_level(direction) @@ -959,14 +1003,34 @@ command! -range=% BulletPromoteVisual call visual_change_bullet_level(1) " --------------------------------------------------------- }}} " Keyboard mappings --------------------------------------- {{{ -fun! s:add_local_mapping(mapping_type, mapping, action) + +" Automatic bullets +inoremap (bullets-newline) =insert_new_bullet() +nnoremap (bullets-newline) :call insert_new_bullet() + +" Renumber bullet list +vnoremap (bullets-renumber) :RenumberSelection +nnoremap (bullets-renumber) :RenumberList + +" Toggle checkbox +nnoremap (bullets-toggle-checkbox) :ToggleCheckbox + +" Promote and Demote outline level +inoremap (bullets-demote) :BulletDemote +nnoremap (bullets-demote) :BulletDemote +vnoremap (bullets-demote) :BulletDemoteVisual +inoremap (bullets-promote) :BulletPromote +nnoremap (bullets-promote) :BulletPromote +vnoremap (bullets-promote) :BulletPromoteVisual + +fun! s:add_local_mapping(with_leader, mapping_type, mapping, action) let l:file_types = join(g:bullets_enabled_file_types, ',') execute 'autocmd FileType ' . \ l:file_types . \ ' ' . \ a:mapping_type . \ ' ' . - \ g:bullets_mapping_leader . + \ (a:with_leader ? g:bullets_mapping_leader : '') . \ a:mapping . \ ' ' . \ a:action @@ -975,7 +1039,7 @@ fun! s:add_local_mapping(mapping_type, mapping, action) execute 'autocmd BufEnter * if bufname("") == "" | ' . \ a:mapping_type . \ ' ' . - \ g:bullets_mapping_leader . + \ (a:with_leader ? g:bullets_mapping_leader : '') . \ a:mapping . \ ' ' . \ a:action . @@ -987,27 +1051,31 @@ augroup TextBulletsMappings autocmd! if g:bullets_set_mappings - " automatic bullets - call s:add_local_mapping('inoremap', '', '=insert_new_bullet()') - call s:add_local_mapping('inoremap', '', '') + " Automatic bullets + call s:add_local_mapping(1, 'imap', '', '(bullets-newline)') + call s:add_local_mapping(1, 'inoremap', '', '') - call s:add_local_mapping('nnoremap', 'o', ':call insert_new_bullet()') + call s:add_local_mapping(1, 'nmap', 'o', '(bullets-newline)') " Renumber bullet list - call s:add_local_mapping('vnoremap', 'gN', ':RenumberSelection') - call s:add_local_mapping('nnoremap', 'gN', ':RenumberList') + call s:add_local_mapping(1, 'vmap', 'gN', '(bullets-renumber)') + call s:add_local_mapping(1, 'nmap', 'gN', '(bullets-renumber)') " Toggle checkbox - call s:add_local_mapping('nnoremap', 'x', ':ToggleCheckbox') + call s:add_local_mapping(1, 'nmap', 'x', '(bullets-toggle-checkbox)') " Promote and Demote outline level - call s:add_local_mapping('inoremap', '', ':BulletDemote') - call s:add_local_mapping('nnoremap', '>>', ':BulletDemote') - call s:add_local_mapping('inoremap', '', ':BulletPromote') - call s:add_local_mapping('nnoremap', '<<', ':BulletPromote') - call s:add_local_mapping('vnoremap', '>', ':BulletDemoteVisual') - call s:add_local_mapping('vnoremap', '<', ':BulletPromoteVisual') + call s:add_local_mapping(1, 'imap', '', '(bullets-demote)') + call s:add_local_mapping(1, 'nmap', '>>', '(bullets-demote)') + call s:add_local_mapping(1, 'vmap', '>', '(bullets-demote)') + call s:add_local_mapping(1, 'imap', '', '(bullets-promote)') + call s:add_local_mapping(1, 'nmap', '<<', '(bullets-promote)') + call s:add_local_mapping(1, 'vmap', '<', '(bullets-promote)') end + + for s:custom_key_mapping in g:bullets_custom_mappings + call call('add_local_mapping', [0] + s:custom_key_mapping) + endfor augroup END " --------------------------------------------------------- }}} @@ -1247,6 +1315,28 @@ fun! s:replace_char_in_line(lnum, chari, item) call setline(a:lnum, l:before . a:item . l:after) endfun +fun! s:select_bullet_text(lnum) + let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum)) + if l:curr_line != [] + let l:startpos = l:curr_line[0].bullet_length + 1 + call setpos('.',[0,a:lnum,l:startpos]) + normal! v + call setpos('.',[0,a:lnum,len(getline(a:lnum))]) + endif +endfun + +fun! s:select_bullet_item(lnum) + let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum)) + if l:curr_line != [] + let l:startpos = len(l:curr_line[0].leading_space) + 1 + call setpos('.',[0,a:lnum,l:startpos]) + normal! v + call setpos('.',[0,a:lnum,len(getline(a:lnum))]) + endif +endfun + +command! SelectBullet call select_bullet_item(line('.')) +command! SelectBulletText call select_bullet_text(line('.')) " ------------------------------------------------------- }}} " Restore previous external compatibility options --------- {{{ diff --git a/.vim/pack/vendor/start/bullets/spec/asciidoc_spec.rb b/.vim/pack/vendor/start/bullets/spec/asciidoc_spec.rb index 2d90b8c..18d7981 100644 --- a/.vim/pack/vendor/start/bullets/spec/asciidoc_spec.rb +++ b/.vim/pack/vendor/start/bullets/spec/asciidoc_spec.rb @@ -28,6 +28,7 @@ end it 'supports nested dot bullets' do + pending('FIXME: this test fails, but the functionality works') test_bullet_inserted('rats', <<-INIT, <<-EXPECTED) = Pets! . dogs diff --git a/.vim/pack/vendor/start/bullets/spec/nested_bullets_spec.rb b/.vim/pack/vendor/start/bullets/spec/nested_bullets_spec.rb index 7cf7ee4..a20b44e 100644 --- a/.vim/pack/vendor/start/bullets/spec/nested_bullets_spec.rb +++ b/.vim/pack/vendor/start/bullets/spec/nested_bullets_spec.rb @@ -565,5 +565,34 @@ TEXT end + + it 'indents after a line ending in a colon' do + filename = "#{SecureRandom.hex(6)}.txt" + write_file(filename, <<-TEXT) + # Hello there + a. this is the first bullet + TEXT + + vim.command 'let g:bullets_auto_indent_after_colon = 1' + vim.edit filename + vim.type 'GA' + vim.feedkeys '\' + vim.type 'this is the second bullet:' + vim.feedkeys '\' + vim.type 'this bullet is indented' + vim.feedkeys '\' + vim.type 'this bullet is also indented' + vim.write + + file_contents = IO.read(filename) + + expect(file_contents.strip).to eq normalize_string_indent(<<-TEXT) + # Hello there + a. this is the first bullet + b. this is the second bullet: + \ti. this bullet is indented + \tii. this bullet is also indented + TEXT + end end end diff --git a/.vim/pack/vendor/start/bullets/spec/spec_helper.rb b/.vim/pack/vendor/start/bullets/spec/spec_helper.rb index c494970..58f3c15 100644 --- a/.vim/pack/vendor/start/bullets/spec/spec_helper.rb +++ b/.vim/pack/vendor/start/bullets/spec/spec_helper.rb @@ -3,6 +3,7 @@ require 'vimrunner' require 'vimrunner/rspec' require 'securerandom' +require 'rspec/retry' Vimrunner::RSpec.configure do |config| # Use a single Vim instance for the test suite. Set to false to use an @@ -27,6 +28,21 @@ end RSpec.configure do |config| + + # RSpec Retry + # =========== + # show retry status in spec process + config.verbose_retry = true + + # show exception that triggers a retry if verbose_retry is set to true + config.display_try_failure_messages = true + + # retry each spec 3 times + config.around :each do |ex| + ex.run_with_retry retry: 3 + end + # ============ + config.around do |example| Dir.mktmpdir do |dir| Dir.chdir(dir) do diff --git a/.vim/pack/vendor/start/closetag/README.md b/.vim/pack/vendor/start/closetag/README.md index 30a80a9..8dd5c15 100644 --- a/.vim/pack/vendor/start/closetag/README.md +++ b/.vim/pack/vendor/start/closetag/README.md @@ -1,7 +1,7 @@ closetag.vim -================ +============ -#### Usage +### Usage The current content: @@ -30,7 +30,7 @@ The following tags will not be closed: , , , , , , , , ``` -#### Installation +### Installation * Just put the files into ~/.vim/ or <HOMEDIR>\vimfiles\ (for Windows). @@ -42,7 +42,17 @@ Plugin 'alvan/vim-closetag' * Use other package manager. -#### Options +### Commands + +Use these commands to toggle/enable/disable this function for the current buffer: + +```vim +:CloseTagToggleBuffer +:CloseTagEnableBuffer +:CloseTagDisableBuffer +``` + +### Options Set in your vimrc: @@ -91,12 +101,32 @@ let g:closetag_shortcut = '>' let g:closetag_close_shortcut = '>' ``` -#### Commands +### Note about React fragments + +By default, React fragments are automatically closed **only** when a React file is open. -Use these commands to toggle enable/disable this function for current buffer: +When editing a `.html` file you will get: + +``` +<| +<>| +``` + +When editing a `.{t,j}sx` file you will get: +``` +<| +<>| +``` + +To override this behavior, you can set the global `g:closetag_enable_react_fragment` in your `.vimrc`: ```vim -:CloseTagToggleBuffer -:CloseTagEnableBuffer -:CloseTagDisableBuffer +" integer value [0|1] +" Enables closing tags for React fragments -> <> for all supported file types +" +let g:closetag_enable_react_fragment = 1 +" Disable closing tags for React fragments -> <> for all supported file types +" +let g:closetag_enable_react_fragment = 0 ``` + diff --git a/.vim/pack/vendor/start/closetag/ftplugin/javascript.jsx.vim b/.vim/pack/vendor/start/closetag/ftplugin/javascript.jsx.vim new file mode 100644 index 0000000..06b3a50 --- /dev/null +++ b/.vim/pack/vendor/start/closetag/ftplugin/javascript.jsx.vim @@ -0,0 +1 @@ +let b:closetag_enable_react_fragment = get(g:, 'closetag_enable_react_fragment', 1) diff --git a/.vim/pack/vendor/start/closetag/ftplugin/javascriptreact.vim b/.vim/pack/vendor/start/closetag/ftplugin/javascriptreact.vim new file mode 100644 index 0000000..06b3a50 --- /dev/null +++ b/.vim/pack/vendor/start/closetag/ftplugin/javascriptreact.vim @@ -0,0 +1 @@ +let b:closetag_enable_react_fragment = get(g:, 'closetag_enable_react_fragment', 1) diff --git a/.vim/pack/vendor/start/closetag/ftplugin/typescript.tsx.vim b/.vim/pack/vendor/start/closetag/ftplugin/typescript.tsx.vim new file mode 100644 index 0000000..06b3a50 --- /dev/null +++ b/.vim/pack/vendor/start/closetag/ftplugin/typescript.tsx.vim @@ -0,0 +1 @@ +let b:closetag_enable_react_fragment = get(g:, 'closetag_enable_react_fragment', 1) diff --git a/.vim/pack/vendor/start/closetag/ftplugin/typescriptreact.vim b/.vim/pack/vendor/start/closetag/ftplugin/typescriptreact.vim new file mode 100644 index 0000000..06b3a50 --- /dev/null +++ b/.vim/pack/vendor/start/closetag/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +let b:closetag_enable_react_fragment = get(g:, 'closetag_enable_react_fragment', 1) diff --git a/.vim/pack/vendor/start/closetag/plugin/closetag.vim b/.vim/pack/vendor/start/closetag/plugin/closetag.vim index e31f5de..49cebd8 100644 --- a/.vim/pack/vendor/start/closetag/plugin/closetag.vim +++ b/.vim/pack/vendor/start/closetag/plugin/closetag.vim @@ -20,6 +20,8 @@ fun! s:Initial() call s:Declare('g:closetag_emptyTags_caseSensitive', 0) + " call s:Declare('g:closetag_enable_react_fragment', 0) + call s:Declare('g:closetag_regions', { \ 'typescript.tsx': 'jsxRegion,tsxRegion', \ 'javascript.jsx': 'jsxRegion', @@ -65,8 +67,8 @@ fun! s:Initial() " Script rgular expresion used. Documents those nasty criters " Don't check for quotes around attributes!!! - let s:ReqAttrib = '\(\(\s\|\n\)\+\([^>= \t]\+=[^>&]\+\)\(\s\|\n\)*\)\+\(\/\)\@\' - let s:EndofName = '\($\|\s\|>\)' + let s:ReqAttrib = '\(\(\s\|\n\)\+\([^>= \t]\+=\([^&]\+\)\)\(\s\|\n\)*\)\+\(\/\)\@' + let s:EndofName = '\($\|\s\|\(=\)\@\)' endf " Define default variables @@ -84,6 +86,7 @@ fun! s:InitBuf() call s:Declare('b:closetag_html_mode', 1) call s:Declare('b:closetag_haveAtt', 0) call s:Declare('b:closetag_use_xhtml', &filetype == 'xhtml' ? 1 : 0) + call s:Declare('b:closetag_enable_react_fragment', get(g:, 'closetag_enable_react_fragment')) endf fun! s:SavePos() @@ -170,7 +173,7 @@ fun! s:FindTag() retu l:haveTag en - if search('[<>]','bW') >=0 + if search('<\|\(=\)\@','bW') >= 0 if getline('.')[col('.')-1] == '<' if getline('.')[col('.')] == '/' let b:closetag_firstWasEndTag = 1 @@ -201,11 +204,11 @@ fun! s:FindTag() let b:closetag_tagName = s:TagName(col('.') + b:closetag_firstWasEndTag) "echo 'Tag ' . b:closetag_tagName - "begin: gwang customization, do not work with an empty tag name - if b:closetag_tagName == '' + if !b:closetag_enable_react_fragment && b:closetag_tagName ==? '' + "begin: gwang customization, do not work with an empty tag name retu l:haveTag + "end: gwang customization, do not work with an empty tag name en - "end: gwang customization, do not work with an empty tag name let l:haveTag = 1 if b:closetag_firstWasEndTag == 0 @@ -271,7 +274,7 @@ fun! s:CloseIt() en elseif s:FindTag() if b:closetag_firstWasEndTag == 0 - exe "silent normal! />\" + exe "silent normal! /\\(=\\)\\@\" if b:closetag_html_mode && s:AsEmpty() if b:closetag_haveAtt == 0 call s:Handler(b:closetag_tagName, b:closetag_html_mode) diff --git a/.vim/pack/vendor/start/commentary/.github/FUNDING.yml b/.vim/pack/vendor/start/commentary/.github/FUNDING.yml deleted file mode 100644 index e2a49d1..0000000 --- a/.vim/pack/vendor/start/commentary/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: tpope -custom: ["https://www.paypal.me/vimpope"] diff --git a/.vim/pack/vendor/start/commentary/plugin/commentary.vim b/.vim/pack/vendor/start/commentary/plugin/commentary.vim index 2c81622..5370106 100644 --- a/.vim/pack/vendor/start/commentary/plugin/commentary.vim +++ b/.vim/pack/vendor/start/commentary/plugin/commentary.vim @@ -3,7 +3,7 @@ " Version: 1.3 " GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim -if exists("g:loaded_commentary") || v:version < 700 +if exists("g:loaded_commentary") || v:version < 703 finish endif let g:loaded_commentary = 1 @@ -18,7 +18,7 @@ function! s:strip_white_space(l,r,line) abort if l[-1:] ==# ' ' && stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0 let l = l[:-2] endif - if r[0] ==# ' ' && a:line[-strlen(r):] != r && a:line[1-strlen(r):] == r[1:] + if r[0] ==# ' ' && (' ' . a:line)[-strlen(r)-1:] != r && a:line[-strlen(r):] == r[1:] let r = r[1:] endif return [l, r] @@ -115,9 +115,6 @@ if !hasmapto('Commentary') || maparg('gc','n') ==# '' nmap gc Commentary omap gc Commentary nmap gcc CommentaryLine - if maparg('c','n') ==# '' && !exists('v:operator') - nmap cgc ChangeCommentary - endif nmap gcu CommentaryCommentary endif diff --git a/.vim/pack/vendor/start/ctrlp/autoload/ctrlp.vim b/.vim/pack/vendor/start/ctrlp/autoload/ctrlp.vim index 38b6ed8..600ffa2 100644 --- a/.vim/pack/vendor/start/ctrlp/autoload/ctrlp.vim +++ b/.vim/pack/vendor/start/ctrlp/autoload/ctrlp.vim @@ -95,7 +95,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = \ 'brief_prompt': ['s:brfprt', 0], \ 'match_current_file': ['s:matchcrfile', 0], \ 'match_natural_name': ['s:matchnatural', 0], - \ 'compare_lim': ['s:compare_lim', 3000], + \ 'compare_lim': ['s:compare_lim', 0], \ 'bufname_mod': ['s:bufname_mod', ':t'], \ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'], \ 'formatline_func': ['s:flfunc', 's:formatline(v:val)'], @@ -330,7 +330,11 @@ fu! s:Open() endf fu! s:Close() - cal s:async_glob_abort() + if has('patch-9.0.0115') && exists('s:cmdheight') + let &cmdheight = s:cmdheight + unlet s:cmdheight + en + cal s:async_glob_abort(0) cal s:buffunc(0) if winnr('$') == 1 bw! @@ -396,7 +400,7 @@ fu! ctrlp#files() en " Remove base directory cal ctrlp#rmbasedir(g:ctrlp_allfiles) - if len(g:ctrlp_allfiles) <= s:compare_lim + if !s:compare_lim || len(g:ctrlp_allfiles) <= s:compare_lim cal sort(g:ctrlp_allfiles, 'ctrlp#complen') en cal s:writecache(cafile) @@ -425,13 +429,17 @@ fu! s:CloseCustomFuncs() en endf -if has('patch-8.2-0995') +if has('patch-8.2-0995') && get(g:, 'ctrlp_use_readdir', 1) fu! s:GlobPath(dirs, depth) let entries = [] - for e in split(a:dirs, ',') - sil let files = readdir(e, '1', {'sort': 'none'}) - if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en - let entries += map(files, 'e.s:lash.v:val') + let dirs = substitute(a:dirs, '\\\([%# ]\)', '\1', 'g') + for e in split(dirs, ',') + try + let files = readdir(e, '1', {'sort': 'none'}) + if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en + let entries += map(files, 'e.s:lash.v:val') + cat + endt endfo let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] if &wig != '' | cal filter(dnf[1], 'glob(v:val) != ""') | en @@ -487,10 +495,12 @@ fu! s:async_glob_on_exit(...) en endf -fu! s:async_glob_abort() +fu! s:async_glob_abort(upd) cal s:stop_job_if_exists() cal s:stop_timer_if_exists() - cal s:ForceUpdate() + if a:upd + cal s:ForceUpdate() + en endf fu! s:stop_timer_if_exists() @@ -750,6 +760,9 @@ fu! s:Render(lines, pat) en if s:mw_order == 'btt' | cal reverse(lines) | en let s:lines = copy(lines) + if s:nolim == 0 && len(lines) > height + let lines = lines[:height-1] + en if has('patch-8.1-0') && s:flfunc ==# 's:formatline(v:val)' cal map(lines, function('s:formatline2', [s:curtype()])) el @@ -1094,7 +1107,7 @@ fu! s:MapSpecs() if !( exists('s:smapped') && s:smapped == s:bufnr ) " Correct arrow keys in terminal if ( has('termresponse') && v:termresponse =~ "\" ) - \ || &term =~? '\vxterm|','\B ','\C ','\D '] exe s:lcmap.' ['.each endfo @@ -1151,7 +1164,7 @@ fu! s:ToggleByFname() endf fu! s:ToggleType(dir) - cal s:async_glob_abort() + cal s:async_glob_abort(1) let max = len(g:ctrlp_ext_vars) + len(s:coretypes) - 1 let next = s:walker(max, s:itemtype, a:dir) cal ctrlp#setlines(next) @@ -1761,16 +1774,22 @@ fu! s:formatline2(ct, key, str) let str .= printf(' %s', parts[3]) en en + retu s:lineprefix.str en - let cond = a:ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str) + let cond = s:ispath && ( s:winw - 4 ) < strchars(str) retu s:lineprefix.( cond ? s:pathshorten(str) : str ) endf - -fu! s:pathshorten(str) - retu matchstr(a:str, '^.\{9}').'...' - \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') -endf +if exists('*strchars') && exists('*strcharpart') + fu! s:pathshorten(str) + retu strcharpart(a:str, 0, 9).'...'.strcharpart(a:str, strchars(a:str) - s:winw + 16) + endf +el + fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') + endf +en fu! s:offset(lines, height) let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 @@ -2713,6 +2732,15 @@ fu! ctrlp#nosy() retu !( has('syntax') && exists('g:syntax_on') ) endf +fu! s:hiupdate() + for [ke, va] in items(s:hlgrps) + let ke = 'CtrlP' . ke + if hlexists(ke) + exe 'hi link' ke va + en + endfo +endf + fu! ctrlp#hicheck(grp, defgrp) if !hlexists(a:grp) exe 'hi link' a:grp a:defgrp @@ -2821,6 +2849,11 @@ fu! ctrlp#init(type, ...) if shouldExitSingle && s:ExitIfSingleCandidate() retu 0 en + + if has('patch-9.0.0115') && &cmdheight == 0 + let s:cmdheight = &cmdheight + set cmdheight=1 + en cal s:BuildPrompt(1) if s:keyloop | cal s:KeyLoop() | en retu 1 @@ -2846,6 +2879,7 @@ if has('autocmd') au BufEnter ControlP cal s:checkbuf() au BufLeave ControlP noa cal s:Close() au VimLeavePre * cal s:leavepre() + au ColorScheme * cal s:hiupdate() aug END en diff --git a/.vim/pack/vendor/start/ctrlp/autoload/ctrlp/buffertag.vim b/.vim/pack/vendor/start/ctrlp/autoload/ctrlp/buffertag.vim index f36a5cf..4f75e6d 100644 --- a/.vim/pack/vendor/start/ctrlp/autoload/ctrlp/buffertag.vim +++ b/.vim/pack/vendor/start/ctrlp/autoload/ctrlp/buffertag.vim @@ -203,10 +203,14 @@ endf fu! s:parseline(line) let vals = matchlist(a:line, - \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)') + \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)\t?([^\t]*)') if vals == [] | retu '' | en let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] - retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] + if len(vals) > 7 && vals[7] != '' + retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'|'.vals[7].'| '.vals[3] + else + retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] + en endf fu! s:syntax() @@ -249,7 +253,7 @@ endf fu! ctrlp#buffertag#accept(mode, str) let vals = matchlist(a:str, - \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$') + \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)%(\|[^\t|]+)?\|\s(.+)$') let bufnr = str2nr(get(vals, 1)) if bufnr cal ctrlp#acceptfile(a:mode, bufnr) diff --git a/.vim/pack/vendor/start/ctrlp/doc/ctrlp.cnx b/.vim/pack/vendor/start/ctrlp/doc/ctrlp.cnx index 3cd9139..74379d4 100644 --- a/.vim/pack/vendor/start/ctrlp/doc/ctrlp.cnx +++ b/.vim/pack/vendor/start/ctrlp/doc/ctrlp.cnx @@ -241,22 +241,8 @@ OPTIONS *ctrlp-options* < 注意: 当命令使用 |g:ctrlp_user_command| 定义时该选项无效。 - *'ctrlp-wildignore'* -你可以使用Vim的 |'wildignore'| 来从结果集中排序文件或目录。 -例子: > - " 排除版本控制文件 - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') -< -注意 #1: 每个目录设置前的字符 `*/` 是必须的。 - -注意 #2: |wildignore| 影响 |expand()| , |globpath()| 和 |glob()| 的结果,这些函数被很 -多插件用来在系统中执行查找。(例如和版本控制系统有关的插件在查找.git/、.hg/等, -一些其他插件用来在Windows上查找外部的*.exe工具),所以要修改 |wildignore| 时请先 -考虑清楚。 - *'g:ctrlp_custom_ignore'* -作为对 |'wildignore'| 和 |g:ctrlp_show_hidden| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正 +除了 |g:ctrlp_show_hidden|,你可以用这个选项设置你想在CtrlP中隐藏的文件和目录。使用正 则表达式来指定匹配模式: > let g:ctrlp_custom_ignore = '' < @@ -274,9 +260,7 @@ OPTIONS *ctrlp-options* \ 'func': 'some#custom#match_function' \ } < -注意 #1: 默认情况下, |wildignore| 和 |g:ctrlp_custom_ignore| 只在 |globpath()| 被用 -来扫描文件的情况下使用,这样这些选项在那些使用 |g:ctrlp_user_command| 定义的命 -令中不会生效。 +注意 #1: |g:ctrlp_custom_ignore| 在已经使用 |g:ctrlp_user_command| 的时候不会生效。 注意 #2: 当改变选项的变量类型时,记得先 |:unlet| ,或者重启Vim来避免这个错误: "E706: Variable type mismatch" 。 @@ -285,6 +269,9 @@ OPTIONS *ctrlp-options* 自动加载的函数。函数必须接受两个参数,要匹配的条目和接受的类型,类型可以是目 录、文件和链接。如果条目被忽略,函数需要返回1,反之,返回0。 +注意 #4: 如果设置 |g:ctrlp_use_readdir| 为0,你可以使用 Vim 的 |'wildignore'| +来将文件和目录排除出搜索结果。 + *'g:ctrlp_max_files'* 扫描文件的最大数量,设置为0时不进行限制: > let g:ctrlp_max_files = 10000 diff --git a/.vim/pack/vendor/start/ctrlp/doc/ctrlp.txt b/.vim/pack/vendor/start/ctrlp/doc/ctrlp.txt index 82eecfc..da1d515 100644 --- a/.vim/pack/vendor/start/ctrlp/doc/ctrlp.txt +++ b/.vim/pack/vendor/start/ctrlp/doc/ctrlp.txt @@ -240,23 +240,8 @@ Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: > Note: does not apply when a command defined with |g:ctrlp_user_command| is being used. - *'ctrlp-wildignore'* -You can use Vim's |'wildignore'| to exclude files and directories from the -results. -Examples: > - " Excluding version control directories - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') -< -Note #1: the `*/` in front of each directory glob is required. - -Note #2: |wildignore| influences the result of |expand()|, |globpath()| and -|glob()| which many plugins use to find stuff on the system (e.g. VCS related -plugins look for .git/, .hg/,... some other plugins look for external *.exe -tools on Windows). So be a little mindful of what you put in your |wildignore|. - *'g:ctrlp_custom_ignore'* -In addition to |'wildignore'| and |g:ctrlp_show_hidden|, use this for files +In addition to |g:ctrlp_show_hidden|, use this for files and directories you want only CtrlP to not show. Use regexp to specify the patterns: > let g:ctrlp_custom_ignore = '' @@ -275,8 +260,7 @@ Examples: > \ 'func': 'some#custom#match_function' \ } < -Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when -|globpath()| is used to scan for files, thus these options do not apply when a +Note #1: |g:ctrlp_custom_ignore| does not apply when a command defined with |g:ctrlp_user_command| is being used. Note #2: when changing the option's variable type, remember to |:unlet| it @@ -288,6 +272,9 @@ recommended here. The function must take 2 parameters, the item to match and its type. The type will be "dir", "file", or "link". The function must return 1 if the item should be ignored, 0 otherwise. +Note #4: when |g:ctrlp_use_readdir| is set to 0, you can also use Vim's |'wildignore'| +to exclude files and directories. + *'g:ctrlp_max_files'* The maximum number of files to scan, set to 0 for no limit: > let g:ctrlp_max_files = 10000 @@ -846,6 +833,13 @@ Example: > *'g:ctrlp_brief_prompt'* When this is set to 1, the on empty prompt exit CtrlP. + *'g:ctrlp_use_readdir'* +Unlike kien/ctrlp.vim, ctrlpvim/ctrlp.vim uses readdir() instead of globpath() +for speed. Set this option to 0 if you want to revert to the original +behavior. +Example: > + let g:ctrlp_use_readdir = 0 +< *ctrlp-default-value* Otherwise, you can use below to change default value. Example: > @@ -853,6 +847,17 @@ Example: > This is possible to change no-limit mode for match type "path". + *ctrlp_compare_lim* +If your search directory has more number of files than this limit, no sorting +will be performed for the first readout. You can improve CtrlP performance by +setting this to a proper value, but no sorting on the first readout can reduce +the quality of fuzzy finding results. +Example: + let g:ctrlp_compare_lim = 100 + +Set the value to 0 for unlimited sorting. Default is 0. + + =============================================================================== COMMANDS *ctrlp-commands* diff --git a/.vim/pack/vendor/start/cycle/.gitignore b/.vim/pack/vendor/start/cycle/.gitignore new file mode 100644 index 0000000..89026d1 --- /dev/null +++ b/.vim/pack/vendor/start/cycle/.gitignore @@ -0,0 +1 @@ +doc/tags \ No newline at end of file diff --git a/.vim/pack/vendor/start/cycle/README.markdown b/.vim/pack/vendor/start/cycle/README.markdown new file mode 100644 index 0000000..3f8713a --- /dev/null +++ b/.vim/pack/vendor/start/cycle/README.markdown @@ -0,0 +1,57 @@ +Cycle.vim +========= + +A Vim plugin that allows you to toggle between pairs or lists of related words. +Use by placing your cursor on a word, like `left`, and press `control-a`. +The word will be replaced with `right`. +The default mappings are the same as those with which you can increment and +decrement a number under the cursor: `` and ``, respectively. + +Check out [the code](https://github.com/zef/vim-cycle/blob/master/plugin/cycle.vim) +to see what cycle groups are included by default. + +Customization +------------- + +You can add your own word groups: + + call AddCycleGroup(['one', 'two', 'three']) + +To deal with conflicts, Cycle.vim also supports adding groups that are specific +to a certain filetype: + + call AddCycleGroup('ruby', ['class', 'module']) + call AddCycleGroup('python', ['else', 'elif']) + +When multiple groups define the same word, groups belonging to specific +filetypes will be used instead of global groups. This is useful in the cases +above, since in HTML we would want `class` to cycle with `id` and Python uses +`elif` while some other languages use `else if` or `elsif`. + +Providing a list of filetypes is also supported: + + call AddCycleGroup(['ruby', 'eruby', 'perl'], ['else', 'elsif']) + +However, if there are no conflicting cases it is preferable to define all cycle +groups in the global namespace, using filetype-specific groups only in case of +conflict. + +Matches are evaluated in reverse order, so whatever has been defined most +recently will take precedence over groups defined previously. Keep this in mind +when defining new cycle groups to make sure broad definitions are not matched +when they are not desired. + + +Todo +---- + +- The ability to handle pairs: quotes, brackets, html tags, etc. +- Operate on non-lowercase text and retain case +- Put cursor back at beginning of word if it started there + +Bugs +---- + +- Does not work with speeddating.vim - currently won't work if speeddating is + installed. + diff --git a/.vim/pack/vendor/start/cycle/doc/cycle.txt b/.vim/pack/vendor/start/cycle/doc/cycle.txt new file mode 100644 index 0000000..939ad7a --- /dev/null +++ b/.vim/pack/vendor/start/cycle/doc/cycle.txt @@ -0,0 +1,40 @@ +*cycle.txt* Quickly toggle between related words. + +ABOUT *cycle* + +Cycle.vim allows you to toggle between pairs or lists of related words. The +default mappings are the same as those with which you can increment and +decrement a number under the cursor —  and , respectively. + +CUSTOMIZATION + +You can add your own word groups: +> + call AddCycleGroup(['one', 'two', 'three']) +< +To deal with conflicts, Cycle.vim also supports adding groups that are specific +to a certain filetype: +> + call AddCycleGroup('ruby', ['class', 'module']) + call AddCycleGroup('python', ['else', 'elif']) +< +When multiple groups define the same word, groups belonging to specific +filetypes will be used instead of global groups. This is useful in the cases +above, since in HTML we would want 'class' to cycle with 'id' and Python uses +'elif' while some other languages use 'else if' or 'elsif'. + +Providing a list of filetypes is also supported: +> + call AddCycleGroup(['ruby', 'eruby', 'perl'], ['else', 'elsif']) +< +However, if there are no conflicting cases it is preferable to define all +cycle groups in the global namespace, using filetype-specific groups only in +case of conflict. + +Matches are evaluated in reverse order, so whatever has been defined most +recently will take precedence over groups defined previously. Keep this in +mind when defining new cycle groups to make sure broad definitions are not +matched when they are not desired. + + vim:tw=78:ts=8:ft=help:norl: + diff --git a/.vim/pack/vendor/start/cycle/plugin/cycle.vim b/.vim/pack/vendor/start/cycle/plugin/cycle.vim new file mode 100644 index 0000000..ec16475 --- /dev/null +++ b/.vim/pack/vendor/start/cycle/plugin/cycle.vim @@ -0,0 +1,231 @@ +" cycle.vim - Toggle between related words + +" if exists("g:loaded_cycle") +" finish +" endif +" let g:loaded_cycle = 1 + +let s:options = {} + +let s:options['global'] = [ + \ ['==', '!='], + \ ['_', '-'], + \ [' + ', ' - '], + \ ['-=', '+='], + \ ['&&', '||'], + \ ['and', 'or'], + \ ['if', 'unless'], + \ ['true', 'false'], + \ ['YES', 'NO'], + \ ['yes', 'no'], + \ ['on', 'off'], + \ ['running', 'stopped'], + \ ['first', 'last'], + \ ['else', 'else if'], +\] + +" css/sass/javascript/html +let s:options['global'] = s:options['global'] + [ + \ ['div', 'p', 'span'], + \ ['max', 'min'], + \ ['ul', 'ol'], + \ ['class', 'id'], + \ ['px', '%', 'em'], + \ ['left', 'right'], + \ ['top', 'bottom'], + \ ['margin', 'padding'], + \ ['height', 'width'], + \ ['absolute', 'relative'], + \ ['h1', 'h2', 'h3'], + \ ['png', 'jpg', 'gif'], + \ ['linear', 'radial'], + \ ['horizontal', 'vertical'], + \ ['show', 'hide'], + \ ['mouseover', 'mouseout'], + \ ['mouseenter', 'mouseleave'], + \ ['add', 'remove'], + \ ['up', 'down'], + \ ['before', 'after'], + \ ['text', 'html'], + \ ['slow', 'fast'], + \ ['small', 'large'], + \ ['even', 'odd'], + \ ['inside', 'outside'], + \ ['push', 'pull'], +\] + +" ruby/eruby +let s:options['global'] = s:options['global'] + [ + \ ['include', 'require'], + \ ['Time', 'Date'], + \ ['present', 'blank'], + \ ['while', 'until'], + \ ['only', 'except'], + \ ['create', 'update'], + \ ['new', 'edit'], + \ ['get', 'post', 'put', 'patch'] +\] + +" Takes one or two arguments: +" +" group +" - or - +" filetype(s), group +function! AddCycleGroup(filetypes_or_group, ...) + if a:0 + let group = a:1 + + " type(['list']) == 3 + " type('string') == 1 + if type(a:filetypes_or_group) == 1 + let filetypes = [a:filetypes_or_group] + else + let filetypes = a:filetypes_or_group + end + else + let group = a:filetypes_or_group + let filetypes = ['global'] + endif + + for type in filetypes + if !has_key(s:options, type) + let s:options[type] = [] + endif + + call add(s:options[type], group) + endfor +endfunction + +function! s:Cycle(direction) + let filetype = &ft + let match = [] + + if has_key(s:options, filetype) + let match = s:matchInList(s:options[filetype]) + endif + + if empty(match) + let match = s:matchInList(s:options['global']) + endif + + if empty(match) + " if exists("g:loaded_speeddating") + " echo 'speed dating!' + " else + " echo 'no speed dating' + " endif + + if a:direction == 1 + exe "norm! " . v:count1 . "\" + else + exe "norm! " . v:count1 . "\" + endif + else + let [group, start, end, string] = match + + let index = index(group, string) + a:direction + let max_index = (len(group) - 1) + + if index > max_index + let index = 0 + endif + + call s:replaceinline(start,end,group[index]) + endif + +endfunction + +" returns the following list if a match is found: +" [group, start, end, string] +" +" returns [] if no match is found +function! s:matchInList(list) + " reverse the list so the most recently defined matches are used + for group in reverse(copy(a:list)) + " We must iterate each group with the longest values first. + " This covers a case like ['else', 'else if'] where the + " first will match successfuly even if the second could + " be matched. Checking for the longest values first + " ensures that the most specific match will be returned + for item in sort(copy(group), "s:sorterByLength") + let match = s:findinline(item) + if match[0] >= 0 + return [group] + match + endif + endfor + endfor + + return [] +endfunction + +function! s:sorterByLength(item, other) + return len(a:other) - len(a:item) +endfunction + +" pulled the following out of speeddating.vim +" modified slightly +function! s:findatoffset(string,pattern,offset) + let line = a:string + let curpos = 0 + let offset = a:offset + while strpart(line,offset,1) == " " + let offset += 1 + endwhile + let [start,end,string] = s:match(line,a:pattern,curpos,0) + while start >= 0 + if offset >= start && offset < end + break + endif + let curpos = start + 1 + let [start,end,string] = s:match(line,a:pattern,curpos,0) + endwhile + return [start,end,string] +endfunction + +function! s:findinline(pattern) + return s:findatoffset(getline('.'),a:pattern,col('.')-1) +endfunction + +function! s:replaceinline(start,end,new) + let line = getline('.') + let before_text = strpart(line,0,a:start) + let after_text = strpart(line,a:end) + " If this generates a warning it will be attached to an ugly backtrace. + " No warning at all is preferable to that. + silent call setline('.',before_text.a:new.after_text) + call setpos("'[",[0,line('.'),strlen(before_text)+1,0]) + call setpos("']",[0,line('.'),a:start+strlen(a:new),0]) +endfunction + +function! s:match(...) + let start = call("match",a:000) + let end = call("matchend",a:000) + let matches = call("matchlist",a:000) + if empty(matches) + let string = '' + else + let string = matches[0] + endif + return [start, end, string] +endfunction +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" language specific overrides: +call AddCycleGroup('ruby', ['class', 'module']) +call AddCycleGroup(['ruby', 'eruby', 'perl'], ['else', 'elsif']) +call AddCycleGroup('python', ['else', 'elif']) + +" Swift +call AddCycleGroup('swift', ['let', 'var']) +call AddCycleGroup('swift', ['open', 'public', 'internal', 'fileprivate', 'private']) +call AddCycleGroup('swift', ['class', 'struct', 'enum', 'protocol', 'extension']) +call AddCycleGroup('swift', ['set', 'get']) + +nnoremap CycleNext :call Cycle(1) +nnoremap CyclePrevious :call Cycle(-1) + +if !exists("g:cycle_no_mappings") || !g:cycle_no_mappings + nmap CycleNext + nmap CyclePrevious +endif + diff --git a/.vim/pack/vendor/start/lastplace/plugin/vim-lastplace.vim b/.vim/pack/vendor/start/lastplace/plugin/vim-lastplace.vim index 1aacd16..6ed1bec 100644 --- a/.vim/pack/vendor/start/lastplace/plugin/vim-lastplace.vim +++ b/.vim/pack/vendor/start/lastplace/plugin/vim-lastplace.vim @@ -76,5 +76,5 @@ endf augroup lastplace_plugin autocmd! - autocmd BufWinEnter * call s:lastplace() + autocmd BufRead * call s:lastplace() augroup END diff --git a/.vim/pack/vendor/start/lexima/.gitignore b/.vim/pack/vendor/start/lexima/.gitignore index e18bb41..42efe2d 100644 --- a/.vim/pack/vendor/start/lexima/.gitignore +++ b/.vim/pack/vendor/start/lexima/.gitignore @@ -1,4 +1,5 @@ -.bundle mysession.vim /.plugintest.dein.cache/ +/.plugintest.vimrc /test/vim-themis +/doc/tags diff --git a/.vim/pack/vendor/start/lexima/.travis.yml b/.vim/pack/vendor/start/lexima/.travis.yml index 3f08748..78b6196 100644 --- a/.vim/pack/vendor/start/lexima/.travis.yml +++ b/.vim/pack/vendor/start/lexima/.travis.yml @@ -1,10 +1,23 @@ language: minimal dist: focal +jobs: + include: + - name: neovim + env: THEMIS_VIM=nvim + install: + - sudo apt update -y + - sudo apt install -y neovim + - git clone https://github.com/thinca/vim-themis + script: + - nvim --version + - vim-themis/bin/themis --reporter spec + - name: vim + install: + - git clone https://github.com/thinca/vim-themis + script: + - vim --version + - vim-themis/bin/themis --reporter spec install: - - git clone https://github.com/thinca/vim-themis -script: - - vim --version - - vim-themis/bin/themis --reporter spec branches: - master - dev diff --git a/.vim/pack/vendor/start/lexima/README.md b/.vim/pack/vendor/start/lexima/README.md index b456852..e4843b1 100644 --- a/.vim/pack/vendor/start/lexima/README.md +++ b/.vim/pack/vendor/start/lexima/README.md @@ -1,6 +1,6 @@ lexima.vim ========== -[![Build Status](https://travis-ci.com/cohama/lexima.vim.svg?branch=master)](https://travis-ci.com/cohama/lexima.vim) +[![Build Status](https://app.travis-ci.com/cohama/lexima.vim.svg?branch=master)](https://app.travis-ci.com/cohama/lexima.vim) Auto close parentheses and repeat by dot dot dot... @@ -8,11 +8,17 @@ Basically, you can automatically close pairs such as `()`, `{}`, `""`, ... But in advance, you can also customize the rule to automatically input any character on any context. -Screen Shots ------------ +SCREEN SHOTS +------------ ![Screen Shot](http://i.gyazo.com/af2d7a59c82f93e49a6fd424dbbf6f88.gif) +REQUIREMENTS +------------ + +- Vim 8.1+ or Neovim 0.4.3+ + + DEFAULT RULES ------------- @@ -33,6 +39,8 @@ If `g:lexima_enable_basic_rules` is `1`, the following rules are enabled. ------------------------------------ ''| ' '''|''' ------------------------------------ + ``| ` ```|``` + ------------------------------------ \| [ \[| ------------------------------------ \| " \"| @@ -66,6 +74,10 @@ If `g:lexima_enable_newline_rules` is `1`, the following rules are enabled. | } ------------------------------------ + ```vim|``` ```vim + | + ``` + ------------------------------------ Same as `()` and `[]`. diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima.vim b/.vim/pack/vendor/start/lexima/autoload/lexima.vim index b62201a..7aa0961 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima.vim @@ -20,6 +20,8 @@ if exists('g:lexima_nvim_accept_pum_with_enter') endif let g:lexima_accept_pum_with_enter = get(g:, 'lexima_accept_pum_with_enter', has('nvim')) let g:lexima_ctrlh_as_backspace = get(g:, 'lexima_ctrlh_as_backspace', 0) +let g:lexima_disable_on_nofile = get(g:, 'lexima_disable_on_nofile', 0) +let g:lexima_disable_abbrev_trigger = get(g:, 'lexima_disable_abbrev_trigger', 0) let s:lexima_vital = { \ 'L' : s:L, @@ -85,6 +87,7 @@ let g:lexima#newline_rules = [ \ {'char': '', 'at': '{\%#$', 'input_after': '}', 'except': '\C\v^(\s*)\S.*%#\n%(%(\s*|\1\s.+)\n)*\1\}'}, \ {'char': '', 'at': '\[\%#]', 'input_after': ''}, \ {'char': '', 'at': '\[\%#$', 'input_after': ']', 'except': '\C\v^(\s*)\S.*%#\n%(%(\s*|\1\s.+)\n)*\1\]'}, +\ {'char': '', 'at': '^```\(\S*\)\%#```', 'input': '', 'input_after': ''}, \ ] let g:lexima#space_rules = [ @@ -164,7 +167,11 @@ function! s:regularize(rule) let reg_rule.syntax = [reg_rule.syntax] endif if !has_key(reg_rule, 'input') - let reg_rule.input = reg_rule.char + if has_key(reg_rule, 'leave') + let reg_rule.input = '' + else + let reg_rule.input = reg_rule.char + endif endif let reg_rule.char = lexima#string#to_upper_specialkey(reg_rule.char) return reg_rule diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima/charstack.vim b/.vim/pack/vendor/start/lexima/autoload/lexima/charstack.vim index a9e5144..144ce45 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima/charstack.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima/charstack.vim @@ -33,6 +33,10 @@ function! s:stack.peek(...) return join(self.v[0:n-1], '') endfunction +function! s:stack.peek_all() + return self.peek(len(self.v)) +endfunction + function! s:stack.pop_all() return self.pop(len(self.v)) endfunction diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima/cmdmode.vim b/.vim/pack/vendor/start/lexima/autoload/lexima/cmdmode.vim index 310c371..ea41b4f 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima/cmdmode.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima/cmdmode.vim @@ -5,6 +5,8 @@ let s:L = lexima#vital().L let s:map_dict = {} +let s:magic_cursor_string = '__LEXIMA_CMDLINE_CURSOR__' + function! lexima#cmdmode#get_map_rules(char) abort let char = lexima#string#to_upper_specialkey(a:char) if has_key(s:map_dict, char) @@ -19,6 +21,14 @@ function! lexima#cmdmode#get_map_rules(char) abort endif endfunction +function! lexima#cmdmode#_default_prehook(char) abort + if lexima#string#to_inputtable(a:char) !~ '.*\k$' && !g:lexima_disable_abbrev_trigger + return '' + else + return '' + endif +endfunction + function! lexima#cmdmode#add_rules(rule) " Expect a:rule to be regularized. if has_key(s:map_dict, a:rule.char) @@ -28,8 +38,8 @@ function! lexima#cmdmode#add_rules(rule) \ 'rules': { \ '_': lexima#sortedlist#new([], function('lexima#cmdmode#_priority_order')) \ }, - \ 'prehooks': [], - \ 'posthooks': [], + \ 'prehook': function('lexima#cmdmode#_default_prehook'), + \ 'posthook': '', \ } " Add prehook to expand abbreviation. if (v:version > 703 || (v:version == 703 && has('patch489'))) " old vim does not support @@ -72,41 +82,59 @@ endfunction function! lexima#cmdmode#_expand(char) abort let char = lexima#string#to_upper_specialkey(a:char) let map = s:map_dict[char] - let prehooks = lexima#string#to_inputtable(join(map.prehooks, '')) - let posthooks = lexima#string#to_inputtable(join(map.posthooks, '')) + let prehook = lexima#string#to_inputtable( + \ type(map.prehook) == v:t_func ? call(map.prehook, [a:char]) : map.prehook + \ ) + let posthook = lexima#string#to_inputtable( + \ type(map.posthook) == v:t_func ? call(map.posthook, [a:char]) : map.posthook + \ ) + return prehook .. s:input_impl(char) .. posthook +endfunction + +function! s:input_impl(char) abort + let char = a:char let pos = getcmdpos() let cmdline = getcmdline() - let [precursor, postcursor] = lexima#string#take_many(cmdline, pos-1) let rule = s:find_rule(char) if rule == {} + if char == '' + return lexima#string#to_inputtable('') + endif return lexima#string#to_inputtable(char) else + let final_input = '' if has_key(rule, 'leave') if type(rule.leave) ==# type(0) - let input = repeat("\", rule.leave) + let final_input .= repeat("\", rule.leave) elseif type(rule.leave) ==# type('') let matchidx = match(cmdline[pos-1:-1], lexima#string#to_inputtable(rule.leave)) if matchidx ==# -1 - let input = a:char + let final_input .= char else - let input = repeat("\", matchidx + 1) + let final_input .= repeat("\", matchidx + 1) endif else throw 'lexima: Not applicable rule (' . string(rule) . ')' endif - let input_after = '' - else - let input = rule.input - if has_key(rule, 'delete') - let input .= repeat("\", rule.delete) + endif + if has_key(rule, 'delete') + if type(rule.delete) ==# type(0) + let final_input .= repeat("\", rule.delete) + elseif type(rule.delete) ==# type('') + let matchidx = match(cmdline[pos-1:-1], lexima#string#to_inputtable(rule.leave)) + if matchidx ==# -1 + let final_input .= char + else + let final_input .= repeat("\", matchidx + 1) + endif endif - let input_after = rule.input_after endif - return lexima#string#to_inputtable(input) . lexima#string#to_inputtable(input_after) . repeat("\", len(lexima#string#to_inputtable(input_after))) + let final_input .= rule.input . rule.input_after + return lexima#string#to_inputtable(final_input) . repeat("\", len(lexima#string#to_inputtable(rule.input_after))) endif endfunction -function! s:find_rule(char) +function! s:find_rule(char) abort let pos = getcmdpos() let cmdline = getcmdline() let [precursor, postcursor] = lexima#string#take_many(cmdline, pos-1) @@ -115,8 +143,9 @@ function! s:find_rule(char) for rule in rules if rule.mode =~# 'c' || rule.mode =~# cmdtype if rule.char ==# a:char - let [pre_at, post_at] = map(split(rule.at, '\\%#', 1) + ['', ''], 'v:val . "$"')[0:1] - if precursor =~# pre_at && postcursor =~# post_at + let rule_at = substitute(rule.at, '\\%#\|$', s:magic_cursor_string, '') + let cmdline_with_cursor = (precursor .. s:magic_cursor_string .. postcursor) + if cmdline_with_cursor =~# rule_at return rule endif endif diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima/endwise_rule.vim b/.vim/pack/vendor/start/lexima/autoload/lexima/endwise_rule.vim index 82a3bbe..6a385e7 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima/endwise_rule.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima/endwise_rule.vim @@ -6,7 +6,7 @@ let s:cr_key = '' function! lexima#endwise_rule#make() let rules = [] " vim - for at in ['fu', 'fun', 'func', 'funct', 'functi', 'functio', 'function', 'if', 'wh', 'whi', 'whil', 'while', 'for', 'try'] + for at in ['fu', 'fun', 'func', 'funct', 'functi', 'functio', 'function', 'if', 'wh', 'whi', 'whil', 'while', 'for', 'try', 'def'] call add(rules, s:make_rule('^\s*' . at . '\>.*\%#$', 'end' . at, 'vim', [])) endfor diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima/insmode.vim b/.vim/pack/vendor/start/lexima/autoload/lexima/insmode.vim index 28d3078..ca6dfae 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima/insmode.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima/insmode.vim @@ -4,7 +4,8 @@ set cpo&vim let s:B = lexima#vital().B let s:L = lexima#vital().L -let s:input_stack = lexima#charstack#new() +let s:pass_through_input_stack = lexima#charstack#new() " can use arrow key e.g. ()U +let s:lazy_input_stack = lexima#charstack#new() " cannot use arrow key e.g. {. It will be input on press . " mapping dictionary. e.g. " { @@ -41,8 +42,8 @@ endfunction function! lexima#insmode#_default_prehook(char) abort " Add prehook to expand abbreviation. - if (v:version > 703 || (v:version == 703 && has('patch489'))) " old vim does not support - \ && lexima#string#to_inputtable(a:char) !~ '.*\k$' + if lexima#string#to_inputtable(a:char) !~ '.*\k$' + \ && (!g:lexima_disable_abbrev_trigger && !get(b:, 'lexima_disable_abbrev_trigger', 0)) if pumvisible() && a:char == '' return '' else @@ -103,12 +104,11 @@ function! lexima#insmode#clear_rules() endfunction function! lexima#insmode#_expand(char) abort - let char = lexima#string#to_upper_specialkey(a:char) let fallback = lexima#string#to_inputtable(a:char) - if !has_key(s:map_dict, char) || mode() !=# 'i' + if !has_key(s:map_dict, a:char) || mode() !=# 'i' return fallback endif - let map = s:map_dict[char] + let map = s:map_dict[a:char] let prehook = lexima#string#to_inputtable( \ (type(map.prehook)) ==# type(function("tr")) ? call(map.prehook, [a:char]) : map.prehook \ ) @@ -117,15 +117,11 @@ function! lexima#insmode#_expand(char) abort \ ) return printf("%s\=lexima#insmode#_map_impl(%s)\%s", \ prehook, - \ string(char), + \ string(a:char), \ posthook \ ) endfunction -function! lexima#insmode#_map_impl(char) abort - return s:map_impl(a:char) -endfunction - function! lexima#insmode#define_altanative_key(char, mapping) execute printf("inoremap %s lexima#expand(%s, 'i')", \ a:char, @@ -145,42 +141,65 @@ function! lexima#insmode#map_hook(when, char, expr) endif endfunction -function! s:map_impl(char) +function! lexima#insmode#_map_impl(char) abort let fallback = lexima#string#to_inputtable(a:char) - if &buftype ==# 'nofile' && !s:B.is_cmdwin() + if g:lexima_disable_on_nofile && &buftype ==# 'nofile' return fallback endif if exists('b:lexima_disabled') && b:lexima_disabled return fallback endif - let rule = s:find_rule(a:char) + let [rule, at_start_pos] = s:find_rule(a:char) if rule == {} return fallback else + let final_input = '' if has_key(rule, 'leave') if type(rule.leave) ==# type('') - let input = printf('=lexima#insmode#leave_till(%s, %s)', string(rule.leave), string(lexima#string#to_mappable(a:char))) + let final_input .= lexima#insmode#leave_till(rule.leave, lexima#string#to_mappable(a:char)) elseif type(rule.leave) ==# type(0) - let input = printf('=lexima#insmode#leave(%d, %s)', rule.leave, string(lexima#string#to_mappable(a:char))) + let final_input .= lexima#insmode#leave(rule.leave, lexima#string#to_mappable(a:char)) else throw 'lexima: Not applicable rule (' . string(rule) . ')' endif - let input_after = '' - elseif has_key(rule, 'delete') + endif + if has_key(rule, 'delete') if type(rule.delete) ==# type('') - let input = printf('=lexima#insmode#delete_till(%s, %s)', string(rule.delete), string(lexima#string#to_mappable(a:char))) + let final_input .= lexima#insmode#delete_till(rule.delete, lexima#string#to_mappable(a:char)) elseif type(rule.delete) ==# type(0) - let input = printf('=lexima#insmode#delete(%d, %s)', rule.delete, string(lexima#string#to_mappable(a:char))) + let final_input .= lexima#insmode#delete(rule.delete, lexima#string#to_mappable(repeat("\", rule.delete))) else throw 'lexima: Not applicable rule (' . string(rule) . ')' endif - let input = input . rule.input - let input_after = '' + endif + if get(rule, 'with_submatch', 0) + let searchlimit = max([0, line('.') - 20]) + let at_end_pos = searchpos(rule.at, 'bcWne', searchlimit) + if at_end_pos == [0, 0] + let at_end_pos = searchpos(rule.at, 'cWne', searchlimit) + if at_end_pos == [0, 0] + echoerr "Pattern not found. This is lexima's bug. Please report an issue with the following information." + echoerr rule + endif + endif + let context = join(getline(at_start_pos[0], at_end_pos[0]), "\n")[at_start_pos[1] - 1:at_end_pos[1]] + let pattern = substitute(rule.at, '\\%#', '', '') + let base_string = matchstr(context, pattern) + let input = substitute(base_string, pattern, rule.input, '') + let input_after = substitute(base_string, pattern, rule.input_after, '') else let input = rule.input let input_after = rule.input_after endif - return s:input(lexima#string#to_inputtable(input), lexima#string#to_inputtable(input_after)) + " Delay calling input_impl + " so that 'delete' and 'leave' always perform BEFORE 'input'. + " Tips: Unlike input_impl, calling 'delete' and 'leave' offen have no side effects, + " these return just a string such as , U unless multiline + let final_input .= printf('=lexima#insmode#_input_impl(%s, %s)', + \ string(lexima#string#to_mappable(input)), + \ string(lexima#string#to_mappable(input_after)) + \ ) + return lexima#string#to_inputtable(final_input) endif endfunction @@ -189,22 +208,22 @@ function! s:find_rule(char) let searchlimit = max([0, line('.') - 20]) let rules = lexima#insmode#get_map_rules(a:char) for rule in rules - let endpos = searchpos(rule.at, 'bcWn', searchlimit) + let at_pos = searchpos(rule.at, 'bcWn', searchlimit) let excepted = has_key(rule, 'except') ? \ searchpos(rule.except, 'bcWn', searchlimit) !=# [0, 0] : 0 - if endpos !=# [0, 0] && !excepted + if at_pos !=# [0, 0] && !excepted if empty(rule.syntax) - return rule + return [rule, at_pos] else for syn in syntax_chain if index(rule.syntax, syn) >=# 0 - return rule + return [rule, at_pos] endif endfor endif endif endfor - return {} + return [{}, [0, 0]] endfunction function! lexima#insmode#_priority_order(rule1, rule2) @@ -264,73 +283,133 @@ function! s:get_syntax_link_chain() return result_stack endfunction -function! s:input(input, input_after) - let curline = getline('.') +function! lexima#insmode#_input_impl(input, input_after) abort + " 'input': 'AAA', 'input_after': 'BBBCCC' + " This will be treated as the following + " input: AAABBB + " input_after: CCC + let a_input = lexima#string#to_inputtable(a:input) + let a_input_after = lexima#string#to_inputtable(a:input_after) + let [first_line; after_lines] = split(a_input_after, "\r", 1) + let input = s:input_oneline(a_input, first_line) + if len(after_lines) == 0 + " 'pass through' means it can be used with G + call s:pass_through_input_stack.push(a_input_after) + return input + endif + + " Emulate inserting with setline() (or append()). + " on AAA|BBB will be + " setline(i, AAA) + " setline(i + 1, BBB) let [bufnum, lnum, col, off] = getpos('.') - let inputs = split(a:input_after, "\r", 1) - let [precursor, _] = lexima#string#take_many(curline, col-1) - let inputs[0] = precursor . inputs[0] - let inputs[-1] = inputs[-1] . curline[col-1:-1] - call setline('.', inputs[0]) - for i in range(1, len(inputs)-1) - call append(lnum+i-1, inputs[i]) - call setpos('.', [bufnum, lnum+i, col, off]) - if &indentexpr ==# '' - if &smartindent || &cindent - let indent_depth = cindent(lnum+i) - elseif &autoindent - let indent_depth = indent(lnum) - else - let indent_depth = 0 - endif - else - call setpos('.', [0, lnum+i, 0, 0]) - let v:lnum = lnum+i - silent! let indent_depth = eval(&l:indentexpr) - endif + let curline = getline('.') + let precursor = curline[:col - 2] + let postcursor = curline[col - 1:] + call setline('.', precursor) + let after_lines[-1] .= postcursor + call append(lnum, after_lines) + + " handling indent + for i in range(0, len(after_lines) - 1) + let indent_depth = s:calc_indent_depth(lnum + i + 1) + let indent = s:get_indent_chars(indent_depth) + call setline(lnum + i + 1, indent . after_lines[i]) " fix indent + endfor + + call setpos(".", [bufnum, lnum, col, off]) + + " {|} => {|} + " input: + " input_after: } + " pass_through_input ('}' in above) will be moved to lazy_input_stack + " This will be input by lexima#escape() + let pass_through_input = s:pass_through_input_stack.pop_all() + if match(postcursor, '\V\C\^' . pass_through_input) != -1 + let input = repeat(lexima#string#to_inputtable(""), strchars(pass_through_input)) + \ . input + call s:pass_through_input_stack.push(first_line) + call s:lazy_input_stack.push(a_input_after[len(first_line):] . pass_through_input) + call setline('.', precursor . pass_through_input) + endif + + return input +endfunction - if &expandtab - let indent = repeat(' ', indent_depth) +function! s:input_oneline(input, input_after) abort + return a:input . a:input_after . repeat(lexima#string#to_inputtable("U"), strchars(a:input_after)) +endfunction + +function! s:calc_indent_depth(lnum) abort + if &indentexpr ==# '' + if &smartindent || &cindent + return cindent(a:lnum) + elseif &autoindent + return indent(a:lnum - 1) else - let indent = repeat("\t", indent_depth / &tabstop) - \ . repeat(' ', indent_depth % &tabstop) + return 0 endif + else + let v:lnum = a:lnum + silent! let indent_depth = eval(&l:indentexpr) + return indent_depth + endif +endfunction - call setline(lnum+i, indent . getline(lnum+i)) - endfor - call setpos('.', [bufnum, lnum, col, off]) - call s:input_stack.push(a:input_after) - return a:input +function! s:get_indent_chars(indent_depth) abort + if &expandtab + return repeat(' ', a:indent_depth) + else + return repeat("\t", a:indent_depth / &tabstop) . repeat(' ', a:indent_depth % &tabstop) + endif endfunction -function! lexima#insmode#leave(len, fallback) - if s:input_stack.is_empty() - return lexima#string#to_inputtable(a:fallback) +function! lexima#insmode#try_leave(len) abort + " Returns: [pass_through_input, lazy_input, is_failed] + let error = "ERROR!!!" + if s:pass_through_input_stack.is_empty() && s:lazy_input_stack.is_empty() + return [error, error, 1] endif - let input = s:input_stack.peek(a:len) + if a:len <= s:pass_through_input_stack.count() + return [s:pass_through_input_stack.pop(a:len), "", 0] + endif + let lazy_input = s:lazy_input_stack.peek(a:len - s:pass_through_input_stack.count()) let [bufnum, lnum, col, off] = getpos('.') - let cr_count = len(split(input, "\r", 1)) - 1 - let will_input = substitute(input, "\r", '\\n\\s\\*', 'g') + let cr_count = len(split(lazy_input, "\r", 1)) - 1 + let will_input = substitute( + \ substitute(s:pass_through_input_stack.peek_all() . lazy_input, '\', '\\\\', 'g'), + \ "\r", '\\n\\s\\*', 'g') let illegal = search('\V\%#' . will_input, 'bcWn') ==# 0 if illegal - return lexima#string#to_inputtable(a:fallback) + return [error, error, 1] endif for i in range(1, cr_count) - call setline(lnum+i, substitute(getline(lnum+i), '^\s*', '', '')) + call setline(lnum+i, substitute(getline(lnum+i), '\V\^\s\*', '', '')) endfor if cr_count !=# 0 execute 'join! ' . (cr_count + 1) endif call setpos('.', [bufnum, lnum, col, off]) let curline = getline('.') - let len = len(input) - cr_count - let [precursor, _, postcursor] = lexima#string#take_many(curline, col-1, len) - call setline('.', precursor . postcursor) - return s:input_stack.pop(a:len) + let leave_candidates_len = s:pass_through_input_stack.count() + let lazy_input_len = strchars(lazy_input) - cr_count + let [precursor, leave_candidates, lazy_candidates, postcursor] = lexima#string#take_many(curline, col-1, leave_candidates_len, lazy_input_len) + call setline('.', precursor . leave_candidates . postcursor) + call s:lazy_input_stack.pop(strchars(lazy_input)) + return [s:pass_through_input_stack.pop_all(), lazy_input, 0] +endfunction + +function! lexima#insmode#leave(len, fallback) + let [pass_through_input, lazy_input, is_failed] = lexima#insmode#try_leave(a:len) + if is_failed + return lexima#string#to_inputtable(a:fallback) + else + return repeat(lexima#string#to_inputtable("U"), strchars(pass_through_input)) . lazy_input + endif endfunction function! lexima#insmode#leave_till(char, fallback) - let input = s:input_stack.peek(0) + let input = s:pass_through_input_stack.peek_all() . s:lazy_input_stack.peek_all() let tilllen = match(input, a:char) if tilllen ==# -1 return lexima#string#to_inputtable(a:fallback) @@ -340,27 +419,38 @@ function! lexima#insmode#leave_till(char, fallback) endfunction function! lexima#insmode#leave_all(fallback) - return lexima#insmode#leave(s:input_stack.count(), a:fallback) + return lexima#insmode#leave(s:pass_through_input_stack.count() + s:lazy_input_stack.count(), a:fallback) endfunction function! lexima#insmode#leave_till_eol(fallback) - let input = s:input_stack.peek(0) - return lexima#insmode#leave(len(split(input, "\r")[0]), a:fallback) + return lexima#insmode#leave(s:pass_through_input_stack.count(), a:fallback) endfunction function! lexima#insmode#delete(len, fallback) - call lexima#insmode#leave(a:len, a:fallback) - return '' + let [pass_through_input, lazy_input, is_failed] = lexima#insmode#try_leave(a:len) + if is_failed + return lexima#string#to_inputtable(a:fallback) + else + return repeat(lexima#string#to_inputtable(""), strchars(pass_through_input)) + endif endfunction function! lexima#insmode#delete_till(char, fallback) - call lexima#insmode#leave_till(a:char, a:fallback) - return '' + let input = s:pass_through_input_stack.peek_all() . s:lazy_input_stack.peek_all() + let tilllen = match(input, a:char) + if tilllen ==# -1 + return lexima#string#to_inputtable(a:fallback) + else + return lexima#insmode#delete(tilllen + len(a:char), a:fallback) + endif +endfunction + +function! lexima#insmode#delete_till_eol(fallback) + return lexima#insmode#delete(s:pass_through_input_stack.count(), a:fallback) endfunction function! lexima#insmode#delete_all(fallback) - call lexima#insmode#leave_all(a:fallback) - return '' + return lexima#insmode#delete(s:pass_through_input_stack.count() + s:lazy_input_stack.count(), a:fallback) endfunction function! lexima#insmode#escape() @@ -372,17 +462,16 @@ function! lexima#insmode#escape() call setpos('.', pos_save) let ret = '' endtry + call lexima#insmode#clear_stack() return ret endfunction -function! lexima#insmode#delete_till_eol(fallback) - call lexima#insmode#leave_till_eol(a:fallback) - return '' -endfunction - function! lexima#insmode#clear_stack() - if !s:input_stack.is_empty() - call s:input_stack.pop_all() + if !s:pass_through_input_stack.is_empty() + call s:pass_through_input_stack.pop_all() + endif + if !s:lazy_input_stack.is_empty() + call s:lazy_input_stack.pop_all() endif endfunction diff --git a/.vim/pack/vendor/start/lexima/autoload/lexima/string.vim b/.vim/pack/vendor/start/lexima/autoload/lexima/string.vim index d96d2be..fd3c556 100644 --- a/.vim/pack/vendor/start/lexima/autoload/lexima/string.vim +++ b/.vim/pack/vendor/start/lexima/autoload/lexima/string.vim @@ -10,7 +10,9 @@ function! lexima#string#to_mappable(str) endfunction function! lexima#string#to_upper_specialkey(str) abort - return substitute(a:str, '\v\<\zs[A-Za-z\-]{-}\ze\>', '\=toupper(submatch(0))', 'g') + let str = substitute(a:str, ' ', '', 'g') + let str = substitute(str, '\v\<\zs[A-Za-z\-]{-}\ze\>', '\=toupper(submatch(0))', 'g') + return str endfunction " recursively take n characters diff --git a/.vim/pack/vendor/start/lexima/doc/lexima.txt b/.vim/pack/vendor/start/lexima/doc/lexima.txt index 507853b..1a7bf24 100644 --- a/.vim/pack/vendor/start/lexima/doc/lexima.txt +++ b/.vim/pack/vendor/start/lexima/doc/lexima.txt @@ -1,6 +1,6 @@ *lexima.txt* Auto close parentheses and repeat by dot dot dot... -Version : 1.2 +Version : 2.0 Author : cohama / cohama@live.jp License : MIT license {{{ Permission is hereby granted, free of charge, to any person obtaining @@ -115,8 +115,6 @@ BASIC RULES *lexima-basic-rules* ------------------------------------ """|""" " """"""| ------------------------------------ - ```|``` ` ``````| - ------------------------------------ (|) | ------------------------------------ {|} | @@ -239,9 +237,6 @@ g:lexima_enable_endwise_rules *g:lexima_enable_endwise_rules* If it is 1, |lexima-endwise-rules| are enabled by default. default value: 1 -g:lexima_nvim_accept_pum_with_enter *g:lexima_nvim_accept_pum_with_enter* - Deprecated. Use g:lexima_accept_pum_with_enter instead. - g:lexima_accept_pum_with_enter *g:lexima_accept_pum_with_enter* If it is 1, enables to be used to accept completions when the |popup-menu| is visible. @@ -259,6 +254,15 @@ g:lexima_ctrlh_as_backspace *g:lexima_ctrlh_as_backspace* If it is 1, can be used in the same manner as . default value: 0 +g:lexima_disable_on_nofile *g:lexima_disable_on_nofile* + If it is 1, all of lexima rules are disabled on buftype=nofile. + default value: 0 + +g:lexima_disable_abbrev_trigger *g:lexima_disable_abbrev_trigger* + By default, lexima input to expand an abbreviation. + If it is 1, disable this feature. + default value: 0 + b:lexima_disabled *b:lexima_disabled* If it is 1, all of lexima rules are disabled on the buffer. (local to buffer) @@ -266,6 +270,9 @@ b:lexima_disabled *b:lexima_disabled* " Disable lexima.vim in clojure buffers autocmd FileType clojure let b:lexima_disabled = 1 +b:lexima_disable_abbrev_trigger *b:lexima_disable_abbrev_trigger* + Same as |g:lexima_disable_abbrev_trigger| but only affects the + specified buffer. ------------------------------------------------------------------------------ FUNCTIONS *lexima-functions* @@ -323,28 +330,31 @@ lexima.vim provides highly customizable interface. You can define your own rule by using |lexima#add_rule()|. A rule is described as a dictionary having the following keys. -char (String) (Required) - Define the key to map. +char (String) (Required) *lexima-rules-char* + Define the key to map. This is used to lhs of |imap|. -at (Regex) (Optional) +at (Regex) (Optional) *lexima-rules-at* The rule is applied when this regular expression matches around the cursor position. '\%#' can be used to represent the cursor position. (See |/\%#|) If omitted, the rule is always applied. + Note that this type is Regex, not String. This means backslash + has a special meaning. e.g. "\sin" will be matched to " + in". -except (Regex) (Optional) +except (Regex) (Optional) *lexima-rules-except* Like "at", but the rule is not applied when this regular expression matches around the cursor position. -input (String) (Optional) +input (String) (Optional) *lexima-rules-input* Specify a string to be input when the rule is applied. - If omitted, "char" is used. + If omitted, "" used when "leave" specified simultaneously + otherwise "char" is used. -input_after (String) (Optional) +input_after (String) (Optional) *lexima-rules-input_after* Similar to "input" but this string is inserted after the cursor. This is useful to input closing character such as ), }, ]. -mode (String) (Optional) +mode (String) (Optional) *lexima-rules-mode* Specify whether the rule is enabled on Insert mode and/or Command-line mode. "mode" is String containing some following characters. @@ -355,7 +365,7 @@ mode (String) (Optional) "c": enabled on Command line mode (same as ":/?") If omitted, "i" is used (only Insert mode). -leave (Number/String) (Optional) +leave (Number/String) (Optional) *lexima-rules-leave* Specify the count to move the cursor to the right. However, it is only when there exists characters that is input automatically by lexima.vim within the same Insert mode session. @@ -376,8 +386,16 @@ leave (Number/String) (Optional) > call lexima#add_rule({'char': ')', 'at': '\%# )', 'leave': 2}) call lexima#add_rule({'char': ')', 'at': '\%# )', 'leave': ')'}) +< + From v2.0, you can use both "leave", "delete" and "input" at the same time. + lexima.vim processes "delete" first, then "leave", and finally "input". + For example, +> + call lexima#add_rule({'char': ';', 'at': '\%#)', 'leave': ')', 'input': ';'}) +< + performs like foo(bar|) => foo(bar);| by pressing ; -delete (Number/String) (Optional) +delete (Number/String) (Optional) *lexima-rules-delete* Specify the count to delete the characters at the right of the cursor. For instance, how many is input. This is useful to make a dot-repeatable rule. @@ -388,13 +406,15 @@ delete (Number/String) (Optional) < Above two rules are similar but the second one is dot-repeatable. -filetype (String/List) (Optional) + From v2.0, "delete" also can be used with "leave" and "input". + +filetype (String/List) (Optional) *lexima-rules-filetype* Specify the list of the filetype where the rule is enabled. If you want to specify only one filetype, you can specify the String value. If omitted, the rule is enabled on any filetype. -syntax (String/List) (Optional) +syntax (String/List) (Optional) *lexima-rules-syntax* Specify the list of the highlight group name where the rule is enabled. For example, > @@ -406,12 +426,32 @@ syntax (String/List) (Optional) all of above three rules are effective. This key in available only for Insert mode. -priority (Number) (Optional) +priority (Number) (Optional) *lexima-rules-priority* Specify the priority of the rule. Bigger value has the higher priority. For more details, see |lexima-priorities|. If omitted, the priority is treated as 0 +with_submatch (Number/Boolean) (Optional) *lexima-rules-with_submatch* + If set as truthy, you can include backreferences which + reference capture groups in "at" and use submatch pattern in "input" + and "input_after". + This is useful to input closing characters that include a substring + of the opening characters, such as "". + Note if this set, "input" and "input_after" work as replace + expression, which can use |sub-replace-special| such as "\1", but be + careful about using backslash. + For example, +> + call lexima#add_rule({'char': '>', + \ 'at': '<\(\w\+\)\%#>', + \ 'leave': '>', + \ 'input_after': '', + \ 'with_submatch': 1}) +< + This rule performs =>
|
with pressing ">". + + ------------------------------------------------------------------------------ PRIORITIES *lexima-priorities* @@ -463,22 +503,72 @@ TIPS *lexima-tips* > imap cmap +< +2. (or any other) key conflicts with other plugin. + +You can manually remap like bellow. Note that mapping is done at +lexima.vim's initialization process. To be overwritten correctly, you should +initialize lexima.vim manually as the followings. +> + let g:lexima_no_default_rules = 1 + call lexima#set_default_rules() + + inoremap (awesome-plugin-action)=lexima#expand('', 'i') +< +For example, if you are using ddc.vim with pum.vim and want the same behavior as +|g:lexima_accept_pum_with_enter|, recommended setting is the following. +> + inoremap pum#visible() ? "\call pum#map#confirm()\" : + \ "\=lexima#expand('CR>', 'i')\" +< +Or if you are using coc.nvim, +> + inoremap coc#pum#visible() ? coc#pum#confirm() : + \ "\u\=lexima#expand('CR>', 'i')\=coc#on_enter()\" +< + +3. key mapping causes some problems (plugin conflicts, terminal settings, etc.) + +You can disable mapping by the following. +> + let g:lexima_map_escape = "" +< +Note taht this setting disables some features of lexima.vim. For example, dot +repeat on multiline input will no longer work. ============================================================================== TODO *lexima-todo* +Avoid blinking when cmdheight=0 set on neovim. ============================================================================== CHANGELOG *lexima-changelog* +v2.1 Breaking Change: lexima.vim also works on buftype=nofile. + Set |g:lexima_disable_on_nofile| to 1 if you prefer previous behavior. + Add vim9 script rules. + Fix submatch problem. + +v2.0 Does not break undo until input . + "leave" and "delete" can be used with "input". + (See |lexima-rules-leave|, |lexima-rules-delete|) + Breaking Change: "leave" also counts . (Older version does not. This was a bug.) + Add |lexima-rules-with_submatch|. + Fix "at" pattern check in cmdline mode. + +v1.3 Add |g:lexima_accept_pum_with_enter|. + (g:lexima_nvim_accept_pum_with_enter is deprecated.) + Add backtick newline rule. + Fix delete problem. + v1.2 Add |lexima-space-rules|. Add "except" key in |lexima-rule| Add |lexima#expand()| function. Add Elixir endwise rule. - Impove rule finding perfomance. + Improve rule finding performance. Fix abbreviation problem. Fix conflict problem with auto-completion plugin e.g. neocomplete diff --git a/.vim/pack/vendor/start/lexima/doc/tags b/.vim/pack/vendor/start/lexima/doc/tags index e1b8c90..dfbf33c 100644 --- a/.vim/pack/vendor/start/lexima/doc/tags +++ b/.vim/pack/vendor/start/lexima/doc/tags @@ -1,13 +1,15 @@ +b:lexima_disable_abbrev_trigger lexima.txt /*b:lexima_disable_abbrev_trigger* b:lexima_disabled lexima.txt /*b:lexima_disabled* g:lexima_accept_pum_with_enter lexima.txt /*g:lexima_accept_pum_with_enter* g:lexima_ctrlh_as_backspace lexima.txt /*g:lexima_ctrlh_as_backspace* +g:lexima_disable_abbrev_trigger lexima.txt /*g:lexima_disable_abbrev_trigger* +g:lexima_disable_on_nofile lexima.txt /*g:lexima_disable_on_nofile* g:lexima_enable_basic_rules lexima.txt /*g:lexima_enable_basic_rules* g:lexima_enable_endwise_rules lexima.txt /*g:lexima_enable_endwise_rules* g:lexima_enable_newline_rules lexima.txt /*g:lexima_enable_newline_rules* g:lexima_enable_space_rules lexima.txt /*g:lexima_enable_space_rules* g:lexima_map_escape lexima.txt /*g:lexima_map_escape* g:lexima_no_default_rules lexima.txt /*g:lexima_no_default_rules* -g:lexima_nvim_accept_pum_with_enter lexima.txt /*g:lexima_nvim_accept_pum_with_enter* lexima#add_rule() lexima.txt /*lexima#add_rule()* lexima#expand() lexima.txt /*lexima#expand()* lexima#insmode#escape() lexima.txt /*lexima#insmode#escape()* @@ -25,6 +27,18 @@ lexima-newline-rules lexima.txt /*lexima-newline-rules* lexima-priorities lexima.txt /*lexima-priorities* lexima-repeatable-rule lexima.txt /*lexima-repeatable-rule* lexima-rules lexima.txt /*lexima-rules* +lexima-rules-at lexima.txt /*lexima-rules-at* +lexima-rules-char lexima.txt /*lexima-rules-char* +lexima-rules-delete lexima.txt /*lexima-rules-delete* +lexima-rules-except lexima.txt /*lexima-rules-except* +lexima-rules-filetype lexima.txt /*lexima-rules-filetype* +lexima-rules-input lexima.txt /*lexima-rules-input* +lexima-rules-input_after lexima.txt /*lexima-rules-input_after* +lexima-rules-leave lexima.txt /*lexima-rules-leave* +lexima-rules-mode lexima.txt /*lexima-rules-mode* +lexima-rules-priority lexima.txt /*lexima-rules-priority* +lexima-rules-syntax lexima.txt /*lexima-rules-syntax* +lexima-rules-with_submatch lexima.txt /*lexima-rules-with_submatch* lexima-space-rules lexima.txt /*lexima-space-rules* lexima-tips lexima.txt /*lexima-tips* lexima-todo lexima.txt /*lexima-todo* diff --git a/.vim/pack/vendor/start/lexima/plugin/lexima.vim b/.vim/pack/vendor/start/lexima/plugin/lexima.vim index f7b377d..a53a549 100644 --- a/.vim/pack/vendor/start/lexima/plugin/lexima.vim +++ b/.vim/pack/vendor/start/lexima/plugin/lexima.vim @@ -11,22 +11,30 @@ if !exists('g:lexima_map_escape') let g:lexima_map_escape = '' endif -" Setup workaround to be able to map `Esc` in insert mode, in combination with -" the "nowait" mapping. This is required in terminal mode, where escape codes -" are being used for cursor keys, alt/meta mappings etc. -if g:lexima_map_escape == '' && !has('gui_running') - inoremap -endif function! s:setup_insmode() if get(b:, 'lexima_disabled', 0) return endif - if v:version > 703 || (v:version == 703 && has("patch1261")) - exe 'inoremap '.g:lexima_map_escape.' =lexima#insmode#escape()' - else - exe 'inoremap '.g:lexima_map_escape.' =lexima#insmode#escape()' + if !(match(&backspace, '\v%(start|nostop)') >=0 || &backspace =~# '\v^[23]$') + echohl WarningMsg + echom "lexima: 'backspace' option does not contain 'start' or 'nostop'. (Recommendation: set backspace=indent,eol,start)" + echohl None + endif + + " Setup workaround to be able to map `Esc` in insert mode, in combination with + " the "nowait" mapping. This is required in terminal mode, where escape codes + " are being used for cursor keys, alt/meta mappings etc. + if g:lexima_map_escape == '' && !has('gui_running') + inoremap + endif + if g:lexima_map_escape !=# '' + if v:version > 703 || (v:version == 703 && has("patch1261")) + exe 'inoremap '.g:lexima_map_escape.' =lexima#insmode#escape()' + else + exe 'inoremap '.g:lexima_map_escape.' =lexima#insmode#escape()' + endif endif endfun @@ -38,11 +46,7 @@ augroup END augroup lexima autocmd! autocmd InsertEnter * call lexima#insmode#clear_stack() - if g:lexima_map_escape ==? '' - autocmd InsertEnter * call s:setup_insmode() - elseif g:lexima_map_escape !=# '' - execute 'inoremap ' . g:lexima_map_escape . ' =lexima#insmode#escape()' - endif + autocmd InsertEnter * call s:setup_insmode() augroup END let &cpo = s:save_cpo diff --git a/.vim/pack/vendor/start/lexima/test/cmdmode.vimspec b/.vim/pack/vendor/start/lexima/test/cmdmode.vimspec index 0a4237e..fa322b2 100644 --- a/.vim/pack/vendor/start/lexima/test/cmdmode.vimspec +++ b/.vim/pack/vendor/start/lexima/test/cmdmode.vimspec @@ -14,6 +14,18 @@ Describe In commandline mode, call Expect(CmdlineInput(":hoge(\")).to_change_cmdline_as("hoge") End + It works well with complex regex pattern + call lexima#add_rule({'char': '(', 'at': 'hoge\%#', 'input': '{', 'input_after': '}', 'mode': 'c'}) + call lexima#add_rule({'char': '(', 'at': 'hoge{\%#}', 'input': 'fuga', 'input_after': 'piyo', 'mode': 'c'}) + call lexima#add_rule({'char': '$', 'at': 'hoge\%#', 'input': '$', 'input_after': '$', 'mode': 'c'}) + call lexima#add_rule({'char': '{', 'at': '\V\(hoge\)$\%#$', 'input': '', 'mode': 'c'}) + call Expect(CmdlineInput(":(")).to_change_cmdline_as("(") + call Expect(CmdlineInput(":hoge(")).to_change_cmdline_as("hoge{}") + call Expect(CmdlineInput(":hoge((")).to_change_cmdline_as("hoge{fugapiyo}") + call Expect(CmdlineInput(":hoge$")).to_change_cmdline_as("hoge$$") + call Expect(CmdlineInput(":hoge${")).to_change_cmdline_as("hoge") + End + It works well when special key is input call lexima#add_rule({'at': '^\%#', 'char': '/', 'input': ':Unite line', 'mode': '/'}) call Expect(CmdlineInput("//")).to_change_cmdline_as("Unite line") @@ -56,6 +68,14 @@ Describe In commandline mode, call Expect(CmdlineInput(":hoge( :);")).to_change_cmdline_as("hoge( : );") End + It can leave at the same time as input + call lexima#add_rule({'char': '(', 'input_after': ')', 'mode': 'c'}) + call lexima#add_rule({'char': ';', 'at': '(\%#)', 'leave': ')', 'input': ';', 'mode': 'c'}) + call lexima#add_rule({'char': '#', 'at': '(\%#)', 'leave': ')', 'input_after': '#', 'mode': 'c'}) + call Expect(CmdlineInput(":hoge(;ok")).to_change_cmdline_as("hoge();ok") + call Expect(CmdlineInput(":hoge(#ok")).to_change_cmdline_as("hoge()ok#") + End + It can delete call lexima#add_rule({'char': '(', 'input_after': ')', 'mode': 'c'}) call lexima#add_rule({'char': '', 'at': '(\%#)', 'delete': 1, 'mode': 'c'}) @@ -75,4 +95,32 @@ Describe In commandline mode, End + Context abbreviation expansion + + Before each + cabbrev hoge fuga + call lexima#clear_rules() + call lexima#add_rule({'char': '(', 'at': '\%#', 'input': '(', 'input_after': ')', 'mode': 'c'}) + End + + After each + cunabbrev hoge + call lexima#clear_rules() + End + + It can be triggered after key pressed + call Expect(CmdlineInput(':hoge ')).to_change_cmdline_as('fuga ') + call Expect(CmdlineInput(':hoge(')).to_change_cmdline_as('fuga()') + call Expect(CmdlineInput(":hoge'")).to_change_cmdline_as("fuga'") + End + + It disabled by g:lexima_disable_abbrev_trigger + call Expect(CmdlineInput(':hoge(')).to_change_cmdline_as('fuga()') + let g:lexima_disable_abbrev_trigger = 1 + call Expect(CmdlineInput(':hoge(')).to_change_cmdline_as('hoge()') + let g:lexima_disable_abbrev_trigger = 0 + End + + End + End diff --git a/.vim/pack/vendor/start/lexima/test/default_rules.vimspec b/.vim/pack/vendor/start/lexima/test/default_rules.vimspec index a8ddeb7..5d1acaf 100644 --- a/.vim/pack/vendor/start/lexima/test/default_rules.vimspec +++ b/.vim/pack/vendor/start/lexima/test/default_rules.vimspec @@ -6,6 +6,7 @@ Describe default rule End After each + let g:lexima_disable_on_nofile = 0 new | only! End @@ -139,6 +140,7 @@ Describe default rule End It is disabled when buftype=nofile + let g:lexima_disable_on_nofile = 1 setlocal buftype=nofile call Expect('hoge((').to_change_input_as('hoge((') End diff --git a/.vim/pack/vendor/start/lexima/test/endwise_rules.vimspec b/.vim/pack/vendor/start/lexima/test/endwise_rules.vimspec index 47db924..21ac927 100644 --- a/.vim/pack/vendor/start/lexima/test/endwise_rules.vimspec +++ b/.vim/pack/vendor/start/lexima/test/endwise_rules.vimspec @@ -102,7 +102,7 @@ Describe endwise rule call Expect("begin\").to_change_input_as("begin\n\nend") call Expect("x = begin\").to_change_input_as("x = begin\n\nend") call Expect("@eval begin\").to_change_input_as("@eval begin\n\nend") - call Expect("eval(quote\").to_change_input_as("eval(quote\n\nend") + call Expect("ex = quote\").to_change_input_as("ex = quote\n\nend") call Expect("if x\").to_change_input_as("if x\n\nend") call Expect("x = if y\").to_change_input_as("x = if y\n\nend") call Expect("for i in 1:10\").to_change_input_as("for i in 1:10\n\nend") diff --git a/.vim/pack/vendor/start/lexima/test/insmode.vimspec b/.vim/pack/vendor/start/lexima/test/insmode.vimspec index 03b5920..5dcbc94 100644 --- a/.vim/pack/vendor/start/lexima/test/insmode.vimspec +++ b/.vim/pack/vendor/start/lexima/test/insmode.vimspec @@ -2,6 +2,7 @@ call themis#helper('command') Describe In insert mode, Before all + set backspace=indent,start,eol new | only! End @@ -9,6 +10,41 @@ Describe In insert mode, new | only! End + Context more complex rules + + Before each + setlocal nocindent smartindent sw=2 ts=2 sts=2 et + call lexima#clear_rules() + End + + Context new line with extra chars + + Before each + call lexima#clear_rules() + call lexima#add_rule({'char': '{', 'input_after': '}'}) + call lexima#add_rule({'char': '', 'at': '{\%#}', 'input': '', 'input_after': ''}) + call lexima#add_rule({'char': '', 'at': '{\%#}', 'input': '\', 'input_after': ',\'}) + call lexima#add_rule({'char': '', 'at': '{ \%# }', 'input': '\', 'input_after': ',\', 'delete': 1}) + set ft=vim + End + + It can input correctly + execute "normal olet a = {\\" + call Expect(['', 'let a = {', ' \ ,', ' \}']).to_be_displayed() + %delete + execute "normal olet a = { \\" + call Expect(['', 'let a = {', ' \ ,', ' \}']).to_be_displayed() + End + + It is dot-repeatable + execute "normal olet a = { \\" + execute "normal G." + call Expect(['', 'let a = {', ' \ ,', ' \}', 'let a = {', ' \ ,', ' \}']).to_be_displayed() + End + + End + End + Context leave rules Before each @@ -36,12 +72,18 @@ Describe In insert mode, call Expect(['{**};']).to_be_displayed() End - It can leave over cr - call lexima#add_rule({'char': '', 'at': '*[{\%#', 'input_after': ''}) + It can leave one over cr call lexima#add_rule({'char': '', 'at': '{\%#}', 'input_after': ''}) call lexima#add_rule({'char': '}', 'leave': 1}) - execute "normal i{\;}\" - call Expect(['{', "\t;", '}']).to_be_displayed() + execute "normal i{\;}a\\" + call Expect(['{', "\t;", "\ta", '}']).to_be_displayed() + End + + It can leave two over cr + call lexima#add_rule({'char': '', 'at': '{\%#}', 'input_after': ''}) + call lexima#add_rule({'char': '}', 'leave': 2}) + execute "normal i{\;}a\\" + call Expect(['{', "\t;", '}a', '']).to_be_displayed() End It can leave till specified char over cr @@ -51,7 +93,7 @@ Describe In insert mode, call Expect(['{', "\t;", '}']).to_be_displayed() End - It can leave till specified char over cr + It can leave till specified char over cr (more complex case) call lexima#add_rule({'char': '', 'at': '{\%#}', 'input_after': ''}) call lexima#add_rule({'char': '}', 'leave': '}'}) execute "normal o{\{\hoge{}}\" @@ -69,6 +111,17 @@ Describe In insert mode, call Expect(['', '{', "\t{", "\t\thoge{\"foo{}\"};", "\t}", '}', '{', "\t{", "\t\thoge{\"foo{}\"};", "\t}", '}']).to_be_displayed() End + It can use at the same time as input + call lexima#add_rule({'char': '(', 'input_after': ')'}) + call lexima#add_rule({'char': ';', 'at': '(\%#)', 'leave': ')', 'input': ';'}) + call lexima#add_rule({'char': '#', 'at': '(\%#)', 'leave': ')', 'input_after': '#'}) + execute "normal ofoo(;ok\G." + call Expect(['', 'foo();ok', 'foo();ok']).to_be_displayed() + %delete + execute "normal ofoo(#ok\G." + call Expect(['', 'foo()ok#', 'foo()ok#']).to_be_displayed() + End + End Context except rules @@ -107,18 +160,70 @@ Describe In insert mode, Before each new only! + setlocal nocindent smartindent call lexima#clear_rules() End It can delete one character call lexima#add_rule({'char': '(', 'input_after': ')'}) call lexima#add_rule({'char': '', 'at': '(\%#)', 'delete': 1}) + call lexima#add_rule({'char': '', 'at': '{{\%#}}', 'delete': 2}) execute "normal ohoge(\\" call Expect(['', 'hoge']).to_be_displayed() normal . call Expect(['', 'hoge', 'hoge']).to_be_displayed() End + It can delete many characters + call lexima#add_rule({'char': '{', 'input_after': '}'}) + call lexima#add_rule({'char': '', 'at': '{{\%#}}', 'input': '', 'delete': 2}) + execute "normal ofoo{{\\" + call Expect(['', 'foo']).to_be_displayed() + normal . + call Expect(['', 'foo', 'foo']).to_be_displayed() + End + + It can delete exsiting characters + let lines = ["foo {{}}"] + put =lines + 1delete _ + call lexima#add_rule({'char': '', 'at': '{{\%#}}', 'input': '', 'delete': 2}) + execute "normal 0f}i\\" + call Expect(['foo ']).to_be_displayed() + End + + It can delete till specified char + call lexima#add_rule({'char': '{', 'input_after': '}'}) + call lexima#add_rule({'char': '', 'at': '{\%#}', 'input': '', 'input_after': ''}) + call lexima#add_rule({'char': '', 'at': '{ \%# }', 'input': '', 'delete': '}'}) + execute "normal ifoo { \\" + call Expect(['foo ']).to_be_displayed() + End + + It can delete till end of line + let lines = ["ABCD"] + put =lines + 1delete _ + call lexima#add_rule({'char': '{', 'input_after': '}'}) + call lexima#add_rule({'char': '(', 'input_after': ')'}) + execute "normal fBa foo {({\=lexima#insmode#delete_till_eol('')\\" + call Expect(['AB foo {({CD']).to_be_displayed() + End + + It can delete all + call lexima#add_rule({'char': '{', 'input_after': '}'}) + call lexima#add_rule({'char': '', 'at': '{\%#}', 'input_after': ''}) + execute "normal ifoo {\bar {\\=lexima#insmode#delete_all('')\\" + call Expect(['foo {', "\tbar {", ""]).to_be_displayed() + End + + It can use at the same time as input + call lexima#add_rule({'char': '(', 'input_after': ')'}) + call lexima#add_rule({'char': '>', 'at': '(\%#)', 'delete': ')', 'input': '', 'input_after': '>'}) + execute "normal ofoo(>ok\G." + call Expect(['', 'foo', 'foo']).to_be_displayed() + End + End Context filetype rules @@ -234,6 +339,77 @@ Describe In insert mode, call Expect("foo\").to_change_input_as("bar\n") End + It disabled by g:lexima_disable_abbrev_trigger + call Expect('foo(').to_change_input_as('bar()') + let g:lexima_disable_abbrev_trigger = 1 + call Expect('foo(').to_change_input_as('foo()') + let g:lexima_disable_abbrev_trigger = 0 + End + + It disabled by b:lexima_disable_abbrev_trigger + call Expect('foo(').to_change_input_as('bar()') + let b:lexima_disable_abbrev_trigger = 1 + call Expect('foo(').to_change_input_as('foo()') + End + + End + + Context with submatch + + Before each + call lexima#clear_rules() + End + + It can be used with simple rule + call lexima#add_rule({'char': 'b', 'at': '\(a\+\)\%#', 'input_after': '\1', 'with_submatch': 1 }) + execute "normal ibab\" + call Expect(['baba']).to_be_displayed() + End + + It can be used on html tag + set ft=html + call lexima#add_rule({'char': '<', 'input_after': '>'}) + call lexima#add_rule({'char': '>', 'at': '<\(\w\+\)\%#>', 'leave': 1, 'input_after': '', 'with_submatch': 1}) + call Expect('
').to_change_input_as('
') + call Expect('
').to_change_input_as('
') + End + + It can be used on tex + set ft=tex + set expandtab shiftwidth=2 + call lexima#add_rule({ + \ 'filetype': 'tex', + \ 'char': '', + \ 'input': '', + \ 'input_after': '\\end{\1}', + \ 'at': '^.*\\begin{\([^}]*\)}\(\[.*\]\)*\%#$', + \ 'with_submatch': 1, + \ }) + execute "normal o\\begin{equation}\\" + call Expect([ + \ '', + \ '\begin{equation}', + \ '', + \ '\end{equation}']).to_be_displayed() + normal! G. + call Expect([ + \ '', + \ '\begin{equation}', + \ '', + \ '\end{equation}', + \ '\begin{equation}', + \ '', + \ '\end{equation}']).to_be_displayed() + %delete _ + execute "normal i\\begin{foo}\\\begin{bar}\\" + call Expect([ + \ '\begin{foo}', + \ ' \begin{bar}', + \ '', + \ ' \end{bar}', + \ '\end{foo}']).to_be_displayed() + End + End End diff --git a/.vim/pack/vendor/start/nerdtree-visual-selection/README.md b/.vim/pack/vendor/start/nerdtree-visual-selection/README.md index e94c9c1..539da35 100644 --- a/.vim/pack/vendor/start/nerdtree-visual-selection/README.md +++ b/.vim/pack/vendor/start/nerdtree-visual-selection/README.md @@ -1,20 +1,47 @@ # nerdtree-visual-selection -This plugin requires [NERDTree](https://github.com/scrooloose/nerdtree) also to be installed. **nerdtree-visual-selection** defines key mappings that will work on nodes contained in a Visual selection in **NERDTree**. +This plugin requires [NERDTree](https://github.com/preservim/nerdtree) also to be installed. **nerdtree-visual-selection** defines key mappings that will work on nodes contained in a Visual selection in **NERDTree**. + +## Installation + +Use your favorite plugin manager to install this plugin. [vim-pathogen](https://github.com/tpope/vim-pathogen), [Vundle.vim](https://github.com/VundleVim/Vundle.vim), [vim-plug](https://github.com/junegunn/vim-plug), [neobundle.vim](https://github.com/Shougo/neobundle.vim), and [dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). + +If you have no favorite, or want to manage your plugins without 3rd-party dependencies, I recommend using Vim 8 packages, as described in Greg Hurrell's excellent Youtube video: [Vim screencast #75: Plugin managers](https://www.youtube.com/watch?v=X2_R3uxDN6g) + +## Known Issue There are two kinds of NERDTree: * **TabTree** - Opened with `:NERDTree`, `:NERDTreeFocus`, `:NERDTreeFind`, or `:NERDTreeToggle` * **WindowTree** - Opened with `vim .` or `:e .`, among others. -This plugin does not work with **WindowTree** type trees, because the first file opened by it causes the NERDTree to close, and the other files in the selection to fail to open. So make sure you use the right commands to open NERDTree when using these mappings. +This plugin does not work with **WindowTree** type trees, because the first file opened by it causes the NERDTree to close, and the other files in the selection to fail to open. These commands are disabled, and an error message is printed, when trying to use them in the wrong type NERDTree. + +## Configuration + +By default, all operations ask to be confirmed with a `Yes/No/All/Cancel` prompt. `All` is a `Yes` answer, while `Cancel` is a `No`, for the remainder of the selection. Confirmation for the different operations can be turned off by setting the following aptly-named variables to `0` in your `.vimrc`. + +* `g:nerdtree_vis_confirm_open` +* `g:nerdtree_vis_confirm_delete` +* `g:nerdtree_vis_confirm_copy` +* `g:nerdtree_vis_confirm_move` + +A [mark](http://vimdoc.sourceforge.net/htmldoc/motion.html#mark-motions) is used to make your NERDTree's `Jump` mappings work while keeping your selection. By default the mark is on the `n` key, if you already use this key for a mark inside NERDTree you can change it via `g:nerdtree_vis_jumpmark` + +## Mappings -Where applicable, those keymappings match up with NERDTree settings. If not defined in the user's `.vimrc`, their default values are used. The mappings are as follows: +Where applicable, those key mappings match up with NERDTree settings. If not defined in your `.vimrc`, their default values are used. The mappings are as follows: NERDTree variable | default | Purpose ---|---|--- -NERDTreeMapActivateNode | **`o`** | Open selected files. -NERDTreeMapOpenSplit | **`i`** | Open selected files in horizontal splits. -NERDTreeMapOpenVSplit | **`s`** | Open selected files in vertical splits. -NERDTreeMapOpenInTab | **`t`** | Open selected files in tabs. -*n/a* | **`dd`** | Delete selected files from disk. If open in Vim, they remain open. -*n/a* | **`m`** | Move the selected files to another directory. If open in Vim, the buffer still points to its old location. -*n/a* | **`c`** | Copy selected files to another directory. +NERDTreeMapActivateNode | o | Open selected files. +NERDTreeMapOpenSplit | i | Open selected files in horizontal splits. +NERDTreeMapOpenVSplit | s | Open selected files in vertical splits. +NERDTreeMapOpenInTab | t | Open selected files in tabs. +*n/a* | d | Delete selected files from disk. If open in Vim, they remain open. +*n/a* | m | Move the selected files to another directory. If open in Vim, the buffer still points to its old location. +*n/a* | c | Copy selected files to another directory. +NERDTreeMapJumpRoot | P | Jump to the tree root. +NERDTreeMapJumpParent | p | Jump to the parent node of the cursor node. +NERDTreeMapJumpFirstChild | K | Jump to the first child of the cursor node's parent. +NERDTreeMapJumpLastChild | J | Jump to the last child of the cursor node's parent. +NERDTreeMapJumpPrevSibling | c-k | Jump to the previous sibling of the cursor node. +NERDTreeMapJumpNextSibling | c-j | Jump to the next sibling of the cursor node. diff --git a/.vim/pack/vendor/start/nerdtree-visual-selection/ftplugin/nerdtree.vim b/.vim/pack/vendor/start/nerdtree-visual-selection/ftplugin/nerdtree.vim index 3e8779b..a2c3027 100644 --- a/.vim/pack/vendor/start/nerdtree-visual-selection/ftplugin/nerdtree.vim +++ b/.vim/pack/vendor/start/nerdtree-visual-selection/ftplugin/nerdtree.vim @@ -1,11 +1,32 @@ -execute "vnoremap " . g:NERDTreeMapActivateNode . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['p']), '', 1, 1)" -execute "vnoremap " . g:NERDTreeMapOpenSplit . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['h']), '', 1, 1)" -execute "vnoremap " . g:NERDTreeMapOpenVSplit . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['v']), '', 1, 1)" -execute "vnoremap " . g:NERDTreeMapOpenInTab . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['t']), '', 1, 1)" -execute "vnoremap dd :call ProcessSelection('Deleting', '', function('NERDTree_Delete'), '', 0, 1)" -execute "vnoremap m :call ProcessSelection('Moving', function('PRE_MoveOrCopy'), function('NERDTree_MoveOrCopy', ['Moving']), function('POST_MoveOrCopy'), 0, 1)" -execute "vnoremap c :call ProcessSelection('Copying', function('PRE_MoveOrCopy'), function('NERDTree_MoveOrCopy', ['Copying']), function('POST_MoveOrCopy'), 0, 1)" +let g:nerdtree_vis_confirm_open = get(g:, 'nerdtree_vis_confirm_open', 1) +let g:nerdtree_vis_confirm_delete = get(g:, 'nerdtree_vis_confirm_delete', 1) +let g:nerdtree_vis_confirm_move = get(g:, 'nerdtree_vis_confirm_move', 1) +let g:nerdtree_vis_confirm_copy = get(g:, 'nerdtree_vis_confirm_copy', 1) +execute "vnoremap " . g:NERDTreeMapActivateNode . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['p']), '', 1, ".g:nerdtree_vis_confirm_open.")" +execute "vnoremap " . g:NERDTreeMapOpenSplit . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['h']), '', 1, ".g:nerdtree_vis_confirm_open.")" +execute "vnoremap " . g:NERDTreeMapOpenVSplit . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['v']), '', 1, ".g:nerdtree_vis_confirm_open.")" +execute "vnoremap " . g:NERDTreeMapOpenInTab . " :call ProcessSelection('Opening', '', function('NERDTree_Open', ['t']), '', 1, ".g:nerdtree_vis_confirm_open.")" +execute "vnoremap d :call ProcessSelection('Deleting', '', function('NERDTree_Delete'), '', 0, ".g:nerdtree_vis_confirm_delete.")" +execute "vnoremap m :call ProcessSelection('Moving', function('PRE_MoveOrCopy'), function('NERDTree_MoveOrCopy', ['Moving']), function('POST_MoveOrCopy'), 0, ".g:nerdtree_vis_confirm_move.")" +execute "vnoremap c :call ProcessSelection('Copying', function('PRE_MoveOrCopy'), function('NERDTree_MoveOrCopy', ['Copying']), function('POST_MoveOrCopy'), 0, ".g:nerdtree_vis_confirm_copy.")" + +" -------------------------------------------------------------------------------- +" Jump Support +let g:nerdtree_vis_jumpmark = "n" + +function s:NERDTree_VisRemap(key) + return "vnoremap " .eval(a:key) ." :call g:NERDTreeKeyMap.Invoke(" .a:key .")m" .g:nerdtree_vis_jumpmark ."gv'" .g:nerdtree_vis_jumpmark +endfunction + +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpNextSibling" ) +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpPrevSibling" ) +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpFirstChild" ) +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpLastChild" ) +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpParent" ) +execute s:NERDTree_VisRemap( "g:NERDTreeMapJumpRoot" ) + +" -------------------------------------------------------------------------------- if exists("g:nerdtree_visual_selection") finish endif @@ -79,6 +100,10 @@ function! s:ProcessSelection(action, setup, callback, cleanup, closeWhenDone, co while curLine <= a:lastline call cursor(curLine, 1) let node = g:NERDTreeFileNode.GetSelected() + if empty(node) + let curLine += 1 + continue + endif call nerdtree#echo(a:action . " " . node.path.str() . " (" . (curLine - a:firstline + 1) . " of " . (a:lastline - a:firstline + 1) . ")...") if a:confirmEachNode && l:response < 3 let l:response = confirm("Are you sure? ", "&Yes\n&No\n&All\n&Cancel") diff --git a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/bug.md b/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/bug.md deleted file mode 100644 index e2ce07b..0000000 --- a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/bug.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: "Bug Report" -about: "NERDTree is misbehaving? Tell us about it." -labels: bug ---- - - -#### Self-Diagnosis -Before creating an issue, take some time to search these resources for an answer. It's possible that someone else has already seen and solved your issue. -- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue) -- NERDTree documentation - `:h NERDTree` -- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki) -- Other resources: , , etc. - -#### Environment -- Operating System: -- Vim/Neovim version `:version`: -- NERDTree version, found on first line of quickhelp `?`: -- Are you using any of these NERDTree-dependent plugins? - - [ ] [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) - - [ ] [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons) - - [ ] [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) - - [ ] [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin) - - [ ] [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops) - - [ ] [PhilRunninger/nerdtree-visual-selection](https://github.com/PhilRunninger/nerdtree-visual-selection) - - [ ] [jistr/vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs) - - [ ] Others (specify): -- Provide a minimal **.vimrc** file that will reproduce the issue. -```vim -``` - -#### Steps to Reproduce the Issue -1. - -#### Current Behavior (Include screenshots where appropriate.) - -#### Expected Result - diff --git a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md b/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 35db0f6..0000000 --- a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: "Feature Request" -about: "What new feature are you requesting for NERDTree?" -labels: "feature request" ---- - -#### Description - diff --git a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/question.md b/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 7e13b7a..0000000 --- a/.vim/pack/vendor/start/nerdtree/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: "General Question" -about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here." -labels: "general question" ---- -Before creating an issue, take some time to search these resources. It's possible that someone else has already asked your question and gotten an answer. -- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue) -- NERDTree documentation - `:h NERDTree` -- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki) -- Other resource: , , etc. - -#### State Your Question - diff --git a/.vim/pack/vendor/start/nerdtree/.github/PULL_REQUEST_TEMPLATE.md b/.vim/pack/vendor/start/nerdtree/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index d2e3b7d..0000000 --- a/.vim/pack/vendor/start/nerdtree/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,22 +0,0 @@ -### Description of Changes -Closes # - - ---- -### New Version Info - -#### Author's Instructions -- [ ] Derive a new `MAJOR.MINOR.PATCH` version number. Increment the: - - `MAJOR` version when you make incompatible API changes - - `MINOR` version when you add functionality in a backwards-compatible manner - - `PATCH` version when you make backwards-compatible bug fixes -- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern. -#### Collaborator's Instructions -- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary. -- [ ] After merging, tag the commit using these (Mac-compatible) bash commands: - ```bash - git checkout master - git pull - sed -n "$(grep -n -m2 '####' CHANGELOG.md | cut -f1 -d: | sed 'N;s/\n/,/')p" CHANGELOG.md | sed '$d' - git tag -a $(read -p "Tag Name: " tag;echo $tag) -m"$(git show --quiet --pretty=%s)";git push origin --tags - ``` diff --git a/.vim/pack/vendor/start/nerdtree/.github/workflows/vint.yml b/.vim/pack/vendor/start/nerdtree/.github/workflows/vint.yml deleted file mode 100644 index 36d7258..0000000 --- a/.vim/pack/vendor/start/nerdtree/.github/workflows/vint.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Vint -on: [push, pull_request] -jobs: - vint: - strategy: - fail-fast: false - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - name: Run vint with reviewdog - uses: reviewdog/action-vint@v1.0.1 - with: - github_token: ${{ secrets.github_token }} - reporter: github-pr-review diff --git a/.vim/pack/vendor/start/nerdtree/README.markdown b/.vim/pack/vendor/start/nerdtree/README.markdown index 6b5d366..27aa314 100644 --- a/.vim/pack/vendor/start/nerdtree/README.markdown +++ b/.vim/pack/vendor/start/nerdtree/README.markdown @@ -90,7 +90,7 @@ vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q After installing NERDTree, the best way to learn it is to turn on the Quick Help. Open NERDTree with the `:NERDTree` command, and press `?` to turn on the Quick Help, which will show you all the mappings and commands available in the NERDTree. Of course, your most complete source of information is the documentation: `:help NERDTree`. ## NERDTree Plugins -NERDTree can be extended with custom mappings and functions using its built-in API. The details of this API and are described in the included documentation. Several plugins have been written, and are available on Github for installation like any other plugin. The plugins in this list are maintained (or not) by their respective owners, and certain combinations may be incompatible. +NERDTree can be extended with custom mappings and functions using its built-in API. The details of this API are described in the included documentation. Several plugins have been written, and are available on Github for installation like any other plugin. The plugins in this list are maintained (or not) by their respective owners, and certain combinations may be incompatible. * [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin): Shows Git status flags for files and folders in NERDTree. * [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons): Adds filetype-specific icons to NERDTree files and folders, diff --git a/.vim/pack/vendor/start/repeat/.github/FUNDING.yml b/.vim/pack/vendor/start/repeat/.github/FUNDING.yml deleted file mode 100644 index e2a49d1..0000000 --- a/.vim/pack/vendor/start/repeat/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: tpope -custom: ["https://www.paypal.me/vimpope"] diff --git a/.vim/pack/vendor/start/surround/.github/FUNDING.yml b/.vim/pack/vendor/start/surround/.github/FUNDING.yml deleted file mode 100644 index f9310ca..0000000 --- a/.vim/pack/vendor/start/surround/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: tpope -custom: ["https://www.paypal.me/vimpope"] \ No newline at end of file diff --git a/.vim/pack/vendor/start/surround/.gitignore b/.vim/pack/vendor/start/surround/.gitignore index 210816f..0a56e3f 100644 --- a/.vim/pack/vendor/start/surround/.gitignore +++ b/.vim/pack/vendor/start/surround/.gitignore @@ -1 +1 @@ -/doc/tags \ No newline at end of file +/doc/tags diff --git a/.vim/pack/vendor/start/surround/README.markdown b/.vim/pack/vendor/start/surround/README.markdown index 80a68a7..d2a5c29 100644 --- a/.vim/pack/vendor/start/surround/README.markdown +++ b/.vim/pack/vendor/start/surround/README.markdown @@ -70,6 +70,13 @@ support: git clone https://tpope.io/vim/surround.git vim -u NONE -c "helptags surround/doc" -c q +## FAQ + +> How do I surround without adding a space? + +Only the opening brackets—`[`, `{`, and `(`—add a space. Use a closing +bracket, or the `b` (`(`) and `B` (`{`) aliases. + ## Contributing See the contribution guidelines for @@ -88,4 +95,4 @@ Love surround.vim? Follow [tpope](http://tpo.pe/) on ## License Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. -See `:help license`. \ No newline at end of file +See `:help license`. diff --git a/.vim/pack/vendor/start/surround/doc/surround.txt b/.vim/pack/vendor/start/surround/doc/surround.txt index 28ef4f5..f39efb2 100644 --- a/.vim/pack/vendor/start/surround/doc/surround.txt +++ b/.vim/pack/vendor/start/surround/doc/surround.txt @@ -202,16 +202,4 @@ that allow you to jump to such markings. > let g:surround_insert_tail = "<++>" < -ISSUES *surround-issues* - -Vim could potentially get confused when deleting/changing occurs at the very -end of the line. Please report any repeatable instances of this. - -Do we need to use |inputsave()|/|inputrestore()| with the tag replacement? - -Indenting is handled haphazardly. Need to decide the most appropriate -behavior and implement it. Right now one can do :let b:surround_indent = 1 -(or the global equivalent) to enable automatic re-indenting by Vim via |=|; -should this be the default? - - vim:tw=78:ts=8:ft=help:norl: \ No newline at end of file + vim:tw=78:ts=8:ft=help:norl: diff --git a/.vim/pack/vendor/start/surround/plugin/surround.vim b/.vim/pack/vendor/start/surround/plugin/surround.vim index 9388cc6..8a4016e 100644 --- a/.vim/pack/vendor/start/surround/plugin/surround.vim +++ b/.vim/pack/vendor/start/surround/plugin/surround.vim @@ -1,6 +1,6 @@ " surround.vim - Surroundings " Author: Tim Pope -" Version: 2.1 +" Version: 2.2 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim if exists("g:loaded_surround") || &cp || v:version < 700 @@ -323,7 +323,7 @@ function! s:insert(...) " {{{1 let cb_save = &clipboard set clipboard-=unnamed clipboard-=unnamedplus let reg_save = @@ - call setreg('"',"\r",'v') + call setreg('"',"\032",'v') call s:wrapreg('"',char,"",linemode) " If line mode is used and the surrounding consists solely of a suffix, " remove the initial newline. This fits a use case of mine but is a @@ -354,19 +354,21 @@ function! s:insert(...) " {{{1 call s:reindent() endif norm! `] - call search('\r','bW') + call search("\032",'bW') let @@ = reg_save let &clipboard = cb_save return "\" endfunction " }}}1 -function! s:reindent() " {{{1 - if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) +function! s:reindent() abort " {{{1 + if get(b:, 'surround_indent', get(g:, 'surround_indent', 1)) && (!empty(&equalprg) || !empty(&indentexpr) || &cindent || &smartindent || &lisp) silent norm! '[='] endif endfunction " }}}1 function! s:dosurround(...) " {{{1 + let sol_save = &startofline + set startofline let scount = v:count1 let char = (a:0 ? a:1 : s:inputtarget()) let spc = "" @@ -388,6 +390,9 @@ function! s:dosurround(...) " {{{1 if a:0 > 1 let newchar = a:2 if newchar == "\" || newchar == "\" || newchar == "" + if !sol_save + set nostartofline + endif return s:beep() endif endif @@ -414,6 +419,9 @@ function! s:dosurround(...) " {{{1 if keeper == "" call setreg('"',original,otype) let &clipboard = cb_save + if !sol_save + set nostartofline + endif return "" endif let oldline = getline('.') @@ -478,6 +486,9 @@ function! s:dosurround(...) " {{{1 else silent! call repeat#set("\C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount) endif + if !sol_save + set nostartofline + endif endfunction " }}}1 function! s:changesurround(...) " {{{1 @@ -616,4 +627,4 @@ if !exists("g:surround_no_mappings") || ! g:surround_no_mappings endif endif -" vim:set ft=vim sw=2 sts=2 et: \ No newline at end of file +" vim:set ft=vim sw=2 sts=2 et: diff --git a/.vim/pack/vendor/start/unimpaired/.github/FUNDING.yml b/.vim/pack/vendor/start/unimpaired/.github/FUNDING.yml deleted file mode 100644 index e2a49d1..0000000 --- a/.vim/pack/vendor/start/unimpaired/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: tpope -custom: ["https://www.paypal.me/vimpope"] diff --git a/.vim/pack/vendor/start/unimpaired/doc/unimpaired.txt b/.vim/pack/vendor/start/unimpaired/doc/unimpaired.txt index 892b874..b03f42f 100644 --- a/.vim/pack/vendor/start/unimpaired/doc/unimpaired.txt +++ b/.vim/pack/vendor/start/unimpaired/doc/unimpaired.txt @@ -80,12 +80,13 @@ On Off Toggle Option *[ob* *]ob* *yob* 'background' (dark is off, light is on) *[oc* *]oc* *yoc* 'cursorline' *[od* *]od* *yod* 'diff' (actually |:diffthis| / |:diffoff|) -*[oe* *]oe* *yoe* 'spell' *[oh* *]oh* *yoh* 'hlsearch' *[oi* *]oi* *yoi* 'ignorecase' *[ol* *]ol* *yol* 'list' *[on* *]on* *yon* 'number' *[or* *]or* *yor* 'relativenumber' +*[os* *]os* *yos* 'spell' +*[ot* *]ot* *yot* 'colorcolumn' ("+1" or last used value) *[ou* *]ou* *you* 'cursorcolumn' *[ov* *]ov* *yov* 'virtualedit' *[ow* *]ow* *yow* 'wrap' diff --git a/.vim/pack/vendor/start/unimpaired/plugin/unimpaired.vim b/.vim/pack/vendor/start/unimpaired/plugin/unimpaired.vim index fa363ae..81e19a4 100644 --- a/.vim/pack/vendor/start/unimpaired/plugin/unimpaired.vim +++ b/.vim/pack/vendor/start/unimpaired/plugin/unimpaired.vim @@ -1,6 +1,6 @@ " unimpaired.vim - Pairs of handy bracket mappings " Maintainer: Tim Pope -" Version: 2.0 +" Version: 2.1 " GetLatestVimScripts: 1590 1 :AutoInstall: unimpaired.vim if exists("g:loaded_unimpaired") || &cp || v:version < 700 @@ -34,15 +34,16 @@ endfunction " Section: Next and previous -function! s:MapNextFamily(map,cmd) abort +function! s:MapNextFamily(map, cmd, current) abort let prefix = '(unimpaired-' . a:cmd let map = 'unimpaired'.toupper(a:map) let cmd = '".(v:count ? v:count : "")."'.a:cmd - let end = '"'.(a:cmd ==# 'l' || a:cmd ==# 'c' ? 'zv' : '') + let zv = (a:cmd ==# 'l' || a:cmd ==# 'c' ? 'zv' : '') + let end = '"'.zv execute 'nnoremap '.prefix.'previous) :exe "'.cmd.'previous'.end execute 'nnoremap '.prefix.'next) :exe "'.cmd.'next'.end - execute 'nnoremap '.prefix.'first) :exe "'.cmd.'first'.end - execute 'nnoremap '.prefix.'last) :exe "'.cmd.'last'.end + execute 'nnoremap '.prefix.'first) :=v:count ? v:count . "' . a:current . '" : "' . a:cmd . 'first"' . zv + execute 'nnoremap '.prefix.'last) :=v:count ? v:count . "' . a:current . '" : "' . a:cmd . 'last"' . zv execute 'nnoremap '.map.'Previous :exe "'.cmd.'previous'.end execute 'nnoremap '.map.'Next :exe "'.cmd.'next'.end execute 'nnoremap '.map.'First :exe "'.cmd.'first'.end @@ -68,14 +69,15 @@ function! s:MapNextFamily(map,cmd) abort endif endfunction -call s:MapNextFamily('a','') -call s:MapNextFamily('b','b') -call s:MapNextFamily('l','l') -call s:MapNextFamily('q','c') -call s:MapNextFamily('t','t') +call s:MapNextFamily('a', '' , 'argument') +call s:MapNextFamily('b', 'b', 'buffer') +call s:MapNextFamily('l', 'l', 'll') +call s:MapNextFamily('q', 'c', 'cc') +call s:MapNextFamily('t', 't', 'trewind') function! s:entries(path) abort let path = substitute(a:path,'[\\/]$','','') + let path = substitute(path, '[[$*]', '[&]', 'g') let files = split(glob(path."/.*"),"\n") let files += split(glob(path."/*"),"\n") call map(files,'substitute(v:val,"[\\/]$","","")') @@ -139,10 +141,10 @@ endfunction function! s:PreviousFileEntry(count) abort let window = s:GetWindow() - if get(window, 'quickfix') - return 'colder ' . a:count - elseif get(window, 'loclist') + if get(window, 'loclist') return 'lolder ' . a:count + elseif get(window, 'quickfix') + return 'colder ' . a:count else return 'edit ' . s:fnameescape(fnamemodify(s:FileByOffset(-v:count1), ':.')) endif @@ -151,10 +153,10 @@ endfunction function! s:NextFileEntry(count) abort let window = s:GetWindow() - if get(window, 'quickfix') - return 'cnewer ' . a:count - elseif get(window, 'loclist') + if get(window, 'loclist') return 'lnewer ' . a:count + elseif get(window, 'quickfix') + return 'cnewer ' . a:count else return 'edit ' . s:fnameescape(fnamemodify(s:FileByOffset(v:count1), ':.')) endif @@ -326,7 +328,6 @@ call s:option_map('', 'cursorcolumn', 'setlocal') nmap