From 79d57ab9f17e211d728c814d3eb39034cad4e2f6 Mon Sep 17 00:00:00 2001 From: "Andrew R. M" Date: Thu, 6 Apr 2017 10:32:46 -0400 Subject: [PATCH] Added git submodule for vim-commentary --- .gitmodules | 3 + vim/.vim/bundle/commentary | 1 + .../bundle/commentary/CONTRIBUTING.markdown | 1 - vim/.vim/bundle/commentary/README.markdown | 51 --------- vim/.vim/bundle/commentary/doc/commentary.txt | 32 ------ .../bundle/commentary/plugin/commentary.vim | 103 ------------------ 6 files changed, 4 insertions(+), 187 deletions(-) create mode 160000 vim/.vim/bundle/commentary delete mode 100644 vim/.vim/bundle/commentary/CONTRIBUTING.markdown delete mode 100644 vim/.vim/bundle/commentary/README.markdown delete mode 100644 vim/.vim/bundle/commentary/doc/commentary.txt delete mode 100644 vim/.vim/bundle/commentary/plugin/commentary.vim diff --git a/.gitmodules b/.gitmodules index 6be80c1..febc530 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "vim/.vim/bundle/eunuch"] path = vim/.vim/bundle/eunuch url = https://github.com/tpope/vim-eunuch +[submodule "vim/.vim/bundle/commentary"] + path = vim/.vim/bundle/commentary + url = https://github.com/tpope/vim-commentary diff --git a/vim/.vim/bundle/commentary b/vim/.vim/bundle/commentary new file mode 160000 index 0000000..be79030 --- /dev/null +++ b/vim/.vim/bundle/commentary @@ -0,0 +1 @@ +Subproject commit be79030b3e8c0ee3c5f45b4333919e4830531e80 diff --git a/vim/.vim/bundle/commentary/CONTRIBUTING.markdown b/vim/.vim/bundle/commentary/CONTRIBUTING.markdown deleted file mode 100644 index b3f0095..0000000 --- a/vim/.vim/bundle/commentary/CONTRIBUTING.markdown +++ /dev/null @@ -1 +0,0 @@ -See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/vim/.vim/bundle/commentary/README.markdown b/vim/.vim/bundle/commentary/README.markdown deleted file mode 100644 index 5387ba6..0000000 --- a/vim/.vim/bundle/commentary/README.markdown +++ /dev/null @@ -1,51 +0,0 @@ -# commentary.vim - -Comment stuff out. Use `gcc` to comment out a line (takes a count), -`gc` to comment out the target of a motion (for example, `gcap` to -comment out a paragraph), `gc` in visual mode to comment out the selection, -and `gc` in operator pending mode to target a comment. You can also use -it as a command, either with a range like `:7,17Commentary`, or as part of a -`:global` invocation like with `:g/TODO/Commentary`. That's it. - -I wrote this because 5 years after Vim added support for mapping an -operator, I still couldn't find a commenting plugin that leveraged that -feature (I overlooked -[tcomment.vim](https://github.com/tomtom/tcomment_vim)). Striving for -minimalism, it weighs in at under 100 lines of code. - -Oh, and it uncomments, too. The above maps actually toggle, and `gcgc` -uncomments a set of adjacent commented lines. - -## Installation - -If you don't have a preferred installation method, I recommend -installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and -then simply copy and paste: - - cd ~/.vim/bundle - git clone git://github.com/tpope/vim-commentary.git - -Once help tags have been generated, you can view the manual with -`:help commentary`. - -## FAQ - -> My favorite file type isn't supported! - -Relax! You just have to adjust `'commentstring'`: - - autocmd FileType apache setlocal commentstring=#\ %s - -## Self-Promotion - -Like commentary.vim? Follow the repository on -[GitHub](https://github.com/tpope/vim-commentary) and vote for it on -[vim.org](http://www.vim.org/scripts/script.php?script_id=3695). And if -you're feeling especially charitable, follow [tpope](http://tpo.pe/) on -[Twitter](http://twitter.com/tpope) and -[GitHub](https://github.com/tpope). - -## License - -Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. -See `:help license`. diff --git a/vim/.vim/bundle/commentary/doc/commentary.txt b/vim/.vim/bundle/commentary/doc/commentary.txt deleted file mode 100644 index b048569..0000000 --- a/vim/.vim/bundle/commentary/doc/commentary.txt +++ /dev/null @@ -1,32 +0,0 @@ -*commentary.txt* Comment stuff out - -Author: Tim Pope -License: Same terms as Vim itself (see |license|) - -Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be -correctly set, or uses b:commentary_format if it is set. - - *gc* -gc{motion} Comment or uncomment lines that {motion} moves over. - - *gcc* -gcc Comment or uncomment [count] lines. - - *v_gc* -{Visual}gc Comment or uncomment the highlighted lines. - - *o_gc* -gc Text object for a comment (operator pending mode - only.) - - *gcgc* *gcu* -gcgc Uncomment the current and adjacent commented lines. -gcu - - *:Commentary* -:[range]Commentary Comment or uncomment [range] lines - -The |User| CommentaryPost autocommand fires after a successful operation and -can be used for advanced customization. - - vim:tw=78:et:ft=help:norl: diff --git a/vim/.vim/bundle/commentary/plugin/commentary.vim b/vim/.vim/bundle/commentary/plugin/commentary.vim deleted file mode 100644 index 0bef7cc..0000000 --- a/vim/.vim/bundle/commentary/plugin/commentary.vim +++ /dev/null @@ -1,103 +0,0 @@ -" commentary.vim - Comment stuff out -" Maintainer: Tim Pope -" Version: 1.3 -" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim - -if exists("g:loaded_commentary") || &cp || v:version < 700 - finish -endif -let g:loaded_commentary = 1 - -function! s:surroundings() abort - return split(get(b:, 'commentary_format', substitute(substitute( - \ &commentstring, '\S\zs%s',' %s','') ,'%s\ze\S', '%s ', '')), '%s', 1) -endfunction - -function! s:strip_white_space(l,r,line) abort - let [l, r] = [a:l, a:r] - if stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0 && a:line[strlen(a:line)-strlen(r[1:]):-1] == r[1:] - return [l[0:-2], r[1:]] - endif - return [l, r] -endfunction - -function! s:go(type,...) abort - if a:0 - let [lnum1, lnum2] = [a:type, a:1] - else - let [lnum1, lnum2] = [line("'["), line("']")] - endif - - let [l_, r_] = s:surroundings() - let uncomment = 2 - for lnum in range(lnum1,lnum2) - let line = matchstr(getline(lnum),'\S.*\s\@ 2 && l.r !~# '\\' - let line = substitute(line, - \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], - \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') - endif - if uncomment - let line = substitute(line,'\S.*\s\@ Commentary :call go(line("'<"),line("'>")) -nnoremap Commentary :set opfunc=gog@ -nnoremap CommentaryLine :set opfunc=goexe 'norm! 'v:count1.'g@_' -onoremap Commentary :call textobject(0) -nnoremap ChangeCommentary c:call textobject(1) -nmap CommentaryUndo CommentaryCommentary -command! -range -bar Commentary call s:go(,) - -if !hasmapto('Commentary') || maparg('gc','n') ==# '' - xmap gc Commentary - nmap gc Commentary - omap gc Commentary - nmap gcc CommentaryLine - nmap cgc ChangeCommentary - nmap gcu CommentaryCommentary -endif - -" vim:set et sw=2: