1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins. Added vim-golang as a mode

This commit is contained in:
amix
2014-03-11 21:10:50 +01:00
parent 2b82c75631
commit 8f0740e307
125 changed files with 4121 additions and 2440 deletions

View File

@ -0,0 +1 @@
See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown).

View File

@ -1,5 +1,4 @@
commentary.vim
==============
# 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
@ -15,10 +14,9 @@ minimalism, it weighs in at under 100 lines of code.
Oh, and it uncomments, too. The above maps actually toggle, and `gcu`
uncomments a set of adjacent commented lines. Install
[repeat.vim](https://github.com/tpope/vim-repeat) to enable
repeating `gcu` with `.` (the other maps are repeatable without it).
repeating `gcu` with `.`. (The other maps are repeatable without it.)
Installation
------------
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
@ -30,8 +28,7 @@ then simply copy and paste:
Once help tags have been generated, you can view the manual with
`:help commentary`.
FAQ
---
## FAQ
> My favorite file type isn't supported!
@ -39,14 +36,7 @@ Relax! You just have to adjust `'commentstring'`:
autocmd FileType apache set commentstring=#\ %s
Contributing
------------
See the contribution guidelines for
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).
Self-Promotion
--------------
## Self-Promotion
Like commentary.vim? Follow the repository on
[GitHub](https://github.com/tpope/vim-commentary) and vote for it on
@ -55,8 +45,7 @@ you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
[Twitter](http://twitter.com/tpope) and
[GitHub](https://github.com/tpope).
License
-------
## License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.

View File

@ -4,7 +4,7 @@ Author: Tim Pope <http://tpo.pe/>
License: Same terms as Vim itself (see |license|)
Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be
correctly set.
correctly set, or uses b:commentary_format if it is set.
The gc mappings are preferred, while the \\ mappings are provided for
backwards compatibility.
@ -25,4 +25,7 @@ gcc Comment or uncomment [count] lines.
gcu Uncomment the current and adjacent commented lines.
\\u
The |User| CommentaryPost autocommand fires after a successful operation and
can be used for advanced customization.
vim:tw=78:et:ft=help:norl:

View File

@ -1,6 +1,6 @@
" commentary.vim - Comment stuff out
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.1
" Version: 1.2
" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim
if exists("g:loaded_commentary") || &cp || v:version < 700
@ -8,6 +8,12 @@ if exists("g:loaded_commentary") || &cp || v:version < 700
endif
let g:loaded_commentary = 1
function! s:surroundings() abort
return split(substitute(substitute(
\ get(b:, 'commentary_format', &commentstring)
\ ,'\S\zs%s',' %s','') ,'%s\ze\S', '%s ', ''), '%s', 1)
endfunction
function! s:go(type,...) abort
if a:0
let [lnum1, lnum2] = [a:type, a:1]
@ -15,7 +21,7 @@ function! s:go(type,...) abort
let [lnum1, lnum2] = [line("'["), line("']")]
endif
let [l, r] = split(substitute(substitute(&commentstring,'\S\zs%s',' %s',''),'%s\ze\S','%s ',''),'%s',1)
let [l, r] = s:surroundings()
let uncomment = 2
for lnum in range(lnum1,lnum2)
let line = matchstr(getline(lnum),'\S.*\s\@<!')
@ -38,10 +44,11 @@ function! s:go(type,...) abort
endif
call setline(lnum,line)
endfor
silent doautocmd User CommentaryPost
endfunction
function! s:undo()
let [l, r] = split(substitute(substitute(&commentstring,'\S\zs%s',' %s',''),'%s\ze\S','%s ',''),'%s',1)
function! s:undo() abort
let [l, r] = s:surroundings()
let lnums = [line('.')+1, line('.')-2]
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)
@ -65,7 +72,7 @@ if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
nmap gcu <Plug>CommentaryUndo
endif
if maparg('\\','n') ==# '' && maparg('\','n') ==# ''
if maparg('\\','n') ==# '' && maparg('\','n') ==# '' && get(g:, 'commentary_map_backslash', 1)
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
nmap \\\ <Plug>CommentaryLine