1
0
mirror of https://github.com/amix/vimrc synced 2025-02-28 14:12:51 +08:00
This commit is contained in:
plrectco 2019-03-12 16:06:06 -07:00
parent 96b46f56ae
commit f4275cdd43
54 changed files with 1462 additions and 2627 deletions

View File

@ -137,9 +137,7 @@ function! ale_linters#elm#make#ParseMessageItem(item) abort
endif
endfunction
" Return the command to execute the linter in the projects directory.
" If it doesn't, then this will fail when imports are needed.
function! ale_linters#elm#make#GetCommand(buffer) abort
function! ale_linters#elm#make#GetPackageFile(buffer) abort
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
if empty(l:elm_json)
@ -147,10 +145,55 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
endif
return l:elm_json
endfunction
function! ale_linters#elm#make#IsVersionGte19(buffer) abort
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
if l:elm_json =~# '-package'
return 0
else
return 1
endif
endfunction
function! ale_linters#elm#make#GetRootDir(buffer) abort
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
if empty(l:elm_json)
return ''
else
return fnamemodify(l:elm_json, ':p:h')
endif
endfunction
function! ale_linters#elm#make#IsTest(buffer) abort
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
if empty(l:root_dir)
return 0
endif
let l:tests_dir = join([l:root_dir, 'tests', ''], has('win32') ? '\' : '/')
let l:buffer_path = fnamemodify(bufname(a:buffer), ':p')
if stridx(l:buffer_path, l:tests_dir) == 0
return 1
else
return 0
endif
endfunction
" Return the command to execute the linter in the projects directory.
" If it doesn't, then this will fail when imports are needed.
function! ale_linters#elm#make#GetCommand(buffer) abort
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
if empty(l:root_dir)
let l:dir_set_cmd = ''
else
let l:root_dir = fnamemodify(l:elm_json, ':p:h')
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
endif
@ -161,11 +204,24 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
return l:dir_set_cmd . '%e make --report=json --output=/dev/null %t'
endfunction
function! ale_linters#elm#make#GetExecutable(buffer) abort
let l:is_test = ale_linters#elm#make#IsTest(a:buffer)
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
if l:is_test && l:is_v19
return ale#node#FindExecutable(
\ a:buffer,
\ 'elm_make',
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
\ )
else
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
endif
endfunction
call ale#linter#Define('elm', {
\ 'name': 'make',
\ 'executable_callback': ale#node#FindExecutableFunc('elm_make', [
\ 'node_modules/.bin/elm',
\ ]),
\ 'executable_callback': 'ale_linters#elm#make#GetExecutable',
\ 'output_stream': 'both',
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
\ 'callback': 'ale_linters#elm#make#Handle'

View File

@ -1,9 +1,15 @@
" Author: Michiel Westerbeek <happylinks@gmail.com>
" Description: Linter for GraphQL Schemas
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . 'gqlint'
\ . ' --reporter=simple %t'
endfunction
call ale#linter#Define('graphql', {
\ 'name': 'gqlint',
\ 'executable': 'gqlint',
\ 'command': 'gqlint --reporter=simple %t',
\ 'command_callback': 'ale_linters#graphql#gqlint#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@ -18,7 +18,7 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
return []
endif
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:pattern = '\(..\{-}\) at \(..\{-}\) line \(\d\+\)'
let l:output = []
let l:basename = expand('#' . a:buffer . ':t')

View File

@ -48,26 +48,38 @@ endfunction
function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
let l:cflags_list = []
let l:previous_options = []
let l:previous_options = ''
let l:split_lines = split(a:cflag_line, '-')
let l:split_lines = split(a:cflag_line, ' ')
let l:option_index = 0
while l:option_index < len(l:split_lines)
let l:option = l:split_lines[l:option_index]
let l:option = l:previous_options . l:split_lines[l:option_index]
let l:option_index = l:option_index + 1
call add(l:previous_options, l:option)
" Check if cflag contained a '-' and should not have been splitted
let l:option_list = split(l:option, '\zs')
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' && l:option_index < len(l:split_lines)
" Check if cflag contained an unmatched characters and should not have been splitted
let l:option_special = substitute(l:option, '\\"', '', 'g')
let l:option_special = substitute(l:option_special, '[^"''()`]', '', 'g')
let l:option_special = substitute(l:option_special, '""', '', 'g')
let l:option_special = substitute(l:option_special, '''''', '', 'g')
let l:option_special = substitute(l:option_special, '``', '', 'g')
let l:option_special = substitute(l:option_special, '((', '(', 'g')
let l:option_special = substitute(l:option_special, '))', ')', 'g')
let l:option_special = substitute(l:option_special, '()', '', 'g')
if len(l:option_special) > 0 && l:option_index < len(l:split_lines)
let l:previous_options = l:option . ' '
continue
endif
let l:option = join(l:previous_options, '-')
let l:previous_options = []
" Check if there was spaces after -D/-I and the flag should not have been splitted
if l:option is# '-D' || l:option is# '-I'
let l:previous_options = l:option
continue
endif
let l:previous_options = ''
let l:option = '-' . substitute(l:option, '^\s*\(.\{-}\)\s*$', '\1', '')
" Fix relative paths if needed
if stridx(l:option, '-I') >= 0 &&

View File

@ -86,7 +86,7 @@ function! s:OnReady(linter, lsp_details, line, column, options, ...) abort
let l:request_id = ale#lsp#Send(l:id, l:message)
let s:go_to_definition_map[l:request_id] = {
\ 'open_in_tab': get(a:options, 'open_in_tab', 0),
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
\}
endfunction

View File

@ -315,10 +315,10 @@ function! s:RunFixer(options) abort
\ ? call(l:Function, [l:buffer, a:options.output])
\ : call(l:Function, [l:buffer, a:options.output, copy(l:input)])
else
" Chained commands accept (buffer, [input])
" Chained commands accept (buffer, [done, input])
let l:result = ale#util#FunctionArgCount(l:Function) == 1
\ ? call(l:Function, [l:buffer])
\ : call(l:Function, [l:buffer, copy(l:input)])
\ : call(l:Function, [l:buffer, v:null, copy(l:input)])
endif
if type(l:result) is v:t_number && l:result == 0

View File

@ -4,22 +4,28 @@
call ale#Set('python_black_executable', 'black')
call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_black_options', '')
call ale#Set('python_black_auto_pipenv', 0)
function! ale#fixers#black#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_black_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
endfunction
function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_black',
\ ['black'],
\)
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run black'
\ : ''
let l:options = ale#Var(a:buffer, 'python_black_options')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}

View File

@ -1,7 +1,7 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Generic functions for fixing files with.
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, done, lines) abort
let l:end_index = len(a:lines) - 1
while l:end_index > 0 && empty(a:lines[l:end_index])
@ -12,7 +12,7 @@ function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
endfunction
" Remove all whitespaces at the end of lines
function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort
function! ale#fixers#generic#TrimWhitespace(buffer, done, lines) abort
let l:index = 0
let l:lines_new = range(len(a:lines))

View File

@ -2,7 +2,7 @@
" Description: Generic fixer functions for Python.
" Add blank lines before control statements.
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, lines) abort
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, done, lines) abort
let l:new_lines = []
let l:last_indent_size = 0
let l:last_line_is_blank = 0
@ -41,7 +41,7 @@ endfunction
" This function breaks up long lines so that autopep8 or other tools can
" fix the badly-indented code which is produced as a result.
function! ale#fixers#generic_python#BreakUpLongLines(buffer, lines) abort
function! ale#fixers#generic_python#BreakUpLongLines(buffer, done, lines) abort
" Default to a maximum line length of 79
let l:max_line_length = 79
let l:conf = ale#path#FindNearestFile(a:buffer, 'setup.cfg')

View File

@ -1,7 +1,7 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Generic fixer functions for Vim help documents.
function! ale#fixers#help#AlignTags(buffer, lines) abort
function! ale#fixers#help#AlignTags(buffer, done, lines) abort
let l:new_lines = []
for l:line in a:lines

View File

@ -14,9 +14,11 @@ endfunction
function! ale#fixers#standard#Fix(buffer) abort
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --fix %t',
\ 'read_temporary_file': 1,
\}

View File

@ -173,10 +173,6 @@ endfunction
function! ale#job#PrepareCommand(buffer, command) abort
let l:wrapper = ale#Var(a:buffer, 'command_wrapper')
let l:command = !empty(l:wrapper)
\ ? s:PrepareWrappedCommand(l:wrapper, a:command)
\ : a:command
" The command will be executed in a subshell. This fixes a number of
" issues, including reading the PATH variables correctly, %PATHEXT%
" expansion on Windows, etc.
@ -184,6 +180,17 @@ function! ale#job#PrepareCommand(buffer, command) abort
" NeoVim handles this issue automatically if the command is a String,
" but we'll do this explicitly, so we use the same exact command for both
" versions.
let l:command = !empty(l:wrapper)
\ ? s:PrepareWrappedCommand(l:wrapper, a:command)
\ : a:command
" If a custom shell is specified, use that.
if exists('g:ale_shell')
let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
return split(g:ale_shell) + split(l:shell_arguments) + [l:command]
endif
if has('win32')
return 'cmd /s/c "' . l:command . '"'
endif

View File

@ -27,6 +27,7 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort
\ 'filename': l:response_item.file,
\ 'line': l:response_item.start.line,
\ 'column': l:response_item.start.offset,
\ 'match': substitute(l:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', ''),
\})
endfor

View File

@ -87,12 +87,25 @@ function! ale#util#GetFunction(string_or_ref) abort
return a:string_or_ref
endfunction
" Open the file (at the given line).
" options['open_in'] can be:
" current-buffer (default)
" tab
" vertical-split
" horizontal-split
function! ale#util#Open(filename, line, column, options) abort
if get(a:options, 'open_in_tab', 0)
call ale#util#Execute('tabedit +' . a:line . ' ' . fnameescape(a:filename))
let l:open_in = get(a:options, 'open_in', 'current-buffer')
let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename)
if l:open_in is# 'tab'
call ale#util#Execute('tabedit ' . l:args_to_open)
elseif l:open_in is# 'horizontal-split'
call ale#util#Execute('split ' . l:args_to_open)
elseif l:open_in is# 'vertical-split'
call ale#util#Execute('vsplit ' . l:args_to_open)
elseif bufnr(a:filename) isnot bufnr('')
" Open another file only if we need to.
call ale#util#Execute('edit +' . a:line . ' ' . fnameescape(a:filename))
call ale#util#Execute('edit ' . l:args_to_open)
else
normal! m`
endif

View File

@ -7,7 +7,7 @@ Integration Information
The `gometalinter` linter is disabled by default. ALE enables `gofmt`,
`golint` and `go vet` by default. It also supports `staticcheck`, `go
build`, `gosimple`, and `golangserver`.
build`, `gosimple`, `golangserver`.
To enable `gometalinter`, update |g:ale_linters| as appropriate:
>
@ -195,5 +195,21 @@ g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package*
current file.
===============================================================================
bingo *ale-go-bingo*
g:ale_go_bingo_executable *g:ale_go_bingo_executable*
*b:ale_go_bingo_executable*
Type: |String|
Default: `'go-bingo'`
Location of the go-bingo binary file.
g:ale_go_bingo_options *g:ale_go_bingo_options*
*b:ale_go_bingo_options*
Type: |String|
Default: `''`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -75,7 +75,7 @@ g:ale_python_black_executable *g:ale_python_black_executable*
See |ale-integrations-local-executables|
autopep8
g:ale_python_black_options *g:ale_python_black_options*
*b:ale_python_black_options*
Type: |String|
@ -92,6 +92,15 @@ g:ale_python_black_use_global *g:ale_python_black_use_global*
See |ale-integrations-local-executables|
g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv*
*b:ale_python_black_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
===============================================================================
flake8 *ale-python-flake8*

View File

@ -118,6 +118,7 @@ CONTENTS *ale-contents*
staticcheck.........................|ale-go-staticcheck|
golangserver........................|ale-go-golangserver|
golangci-lint.......................|ale-go-golangci-lint|
bingo...............................|ale-go-bingo|
graphql...............................|ale-graphql-options|
eslint..............................|ale-graphql-eslint|
gqlint..............................|ale-graphql-gqlint|
@ -438,7 +439,7 @@ Notes:
* FusionScript: `fusion-lint`
* Git Commit Messages: `gitlint`
* GLSL: glslang, `glslls`
* Go: `gofmt`, `goimports`, `go mod`!!, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!!
* Go: `gofmt`, `goimports`, `go mod`!!, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!!, `bingo`
* GraphQL: `eslint`, `gqlint`, `prettier`
* Hack: `hack`, `hackfmt`, `hhast`
* Haml: `haml-lint`
@ -675,10 +676,14 @@ The values for `g:ale_fixers` can be a list of |String|, |Funcref|, or
for a function set in the ALE fixer registry.
Each function for fixing errors must accept either one argument `(buffer)` or
two arguments `(buffer, lines)`, representing the buffer being fixed and the
lines to fix. The functions must return either `0`, for changing nothing, a
|List| for new lines to set, or a |Dictionary| for describing a command to be
run in the background.
three arguments `(buffer, done, lines)`, representing the buffer being fixed,
a function to call with results, and the lines to fix. The functions must
return either `0`, for changing nothing, a |List| for new lines to set, a
|Dictionary| for describing a command to be run in the background, or `v:true`
for indicating that results will be provided asynchronously via the `done`
callback.
NOTE: The `done` function has not been implemented yet.
Functions receiving a variable number of arguments will not receive the second
argument `lines`. Functions should name two arguments if the `lines` argument
@ -836,6 +841,8 @@ information returned by LSP servers. The following commands are supported:
|ALEGoToDefinition| - Open the definition of the symbol under the cursor.
|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab.
|ALEGoToDefinitionInSplit| - The same, but in a new split.
|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split.
-------------------------------------------------------------------------------
@ -1787,6 +1794,33 @@ g:ale_set_signs *g:ale_set_signs*
To limit the number of signs ALE will set, see |g:ale_max_signs|.
g:ale_shell *g:ale_shell*
Type: |String|
Default: not set
Override the shell used by ALE for executing commands. ALE uses 'shell' by
default, but falls back in `/bin/sh` if the default shell looks like `fish`
or `pwsh`, which are not compatible with all of the commands run by ALE. The
shell specified with this option will be used even if it might not work in
all cases.
For Windows, ALE uses `cmd` when this option isn't set. Setting this option
will apply shell escaping to the command string, even on Windows.
NOTE: Consider setting |g:ale_shell_arguments| if this option is defined.
g:ale_shell_arguments *g:ale_shell_arguments*
Type: |String|
Default: not set
This option specifies the arguments to use for executing a command with a
custom shell, per |g:ale_shell|. If this option is not set, 'shellcmdflag'
will be used instead.
g:ale_sign_column_always *g:ale_sign_column_always*
Type: |Number|
@ -2262,6 +2296,22 @@ ALEGoToDefinitionInTab *ALEGoToDefinitionInTab*
command.
ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit*
The same as |ALEGoToDefinition|, but opens results in a new split.
A plug mapping `<Plug>(ale_go_to_definition_in_split)` is defined for this
command.
ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit*
The same as |ALEGoToDefinition|, but opens results in a new vertical split.
A plug mapping `<Plug>(ale_go_to_definition_in_vsplit)` is defined for this
command.
ALEHover *ALEHover*
Print brief information about the symbol under the cursor, taken from any

View File

@ -188,7 +188,9 @@ command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
" Go to definition for tsserver and LSP
command! -bar ALEGoToDefinition :call ale#definition#GoTo({})
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1})
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'})
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'})
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'})
" Find references for tsserver and LSP
command! -bar ALEFindReferences :call ale#references#Find()
@ -222,6 +224,8 @@ nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>

View File

@ -1 +0,0 @@
doc/tags

View File

@ -1,325 +0,0 @@
Auto Pairs
==========
Insert or delete brackets, parens, quotes in pair.
Installation
------------
copy plugin/auto-pairs.vim to ~/.vim/plugin
or if you are using `pathogen`:
```git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs```
Features
--------
* Insert in pair
input: [
output: [|]
* Delete in pair
input: foo[<BS>]
output: foo
* Insert new indented line after Return
input: {|} (press <CR> at |)
output: {
|
}
* Insert spaces before closing characters, only for [], (), {}
input: {|} (press <SPACE> at |)
output: { | }
input: {|} (press <SPACE>foo} at |)
output: { foo }|
input: '|' (press <SPACE> at |)
output: ' |'
* Skip ' when inside a word
input: foo| (press ' at |)
output: foo'
* Skip closed bracket.
input: []
output: []
* Ignore auto pair when previous character is \
input: "\'
output: "\'"
* Fast Wrap
input: |'hello' (press (<M-e> at |)
output: ('hello')
wrap string, only support c style string
input: |'h\\el\'lo' (press (<M-e> at |)
output ('h\\ello\'')
input: |[foo, bar()] (press (<M-e> at |)
output: ([foo, bar()])
* Quick move char to closed pair
input: (|){["foo"]} (press <M-}> at |)
output: ({["foo"]}|)
input: |[foo, bar()] (press (<M-]> at |)
output: ([foo, bar()]|)
* Quick jump to closed pair.
input:
{
something;|
}
(press } at |)
output:
{
}|
* Support ``` ''' and """
input:
'''
output:
'''|'''
* Delete Repeated Pairs in one time
input: """|""" (press <BS> at |)
output: |
input: {{|}} (press <BS> at |)
output: |
input: [[[[[[|]]]]]] (press <BS> at |)
output: |
* Fly Mode
input: if(a[3)
output: if(a[3])| (In Fly Mode)
output: if(a[3)]) (Without Fly Mode)
input:
{
hello();|
world();
}
(press } at |)
output:
{
hello();
world();
}|
(then press <M-b> at | to do backinsert)
output:
{
hello();}|
world();
}
See Fly Mode section for details
Fly Mode
--------
Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]"
If jumps in mistake, could use AutoPairsBackInsert(Default Key: `<M-b>`) to jump back and insert closed pair.
the most situation maybe want to insert single closed pair in the string, eg ")"
Fly Mode is DISABLED by default.
add **let g:AutoPairsFlyMode = 1** .vimrc to turn it on
Default Options:
let g:AutoPairsFlyMode = 0
let g:AutoPairsShortcutBackInsert = '<M-b>'
Shortcuts
---------
System Shortcuts:
<CR> : Insert new indented line after return if cursor in blank brackets or quotes.
<BS> : Delete brackets in pair
<M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle)
<M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap)
<M-n> : Jump to next closed pair (g:AutoPairsShortcutJump)
<M-b> : BackInsert (g:AutoPairsShortcutBackInsert)
If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add
let g:AutoPairsShortcutToggle = '<another key>'
to .vimrc, if the key is empty string '', then the shortcut will be disabled.
Options
-------
* g:AutoPairs
Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
* b:AutoPairs
Default: g:AutoPairs
Buffer level pairs set.
* g:AutoPairsShortcutToggle
Default: '<M-p>'
The shortcut to toggle autopairs.
* g:AutoPairsShortcutFastWrap
Default: '<M-e>'
Fast wrap the word. all pairs will be consider as a block (include <>).
(|)'hello' after fast wrap at |, the word will be ('hello')
(|)<hello> after fast wrap at |, the word will be (<hello>)
* g:AutoPairsShortcutJump
Default: '<M-n>'
Jump to the next closed pair
* g:AutoPairsMapBS
Default : 1
Map <BS> to delete brackets, quotes in pair
execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>'
* g:AutoPairsMapCh
Default : 1
Map <C-h> to delete brackets, quotes in pair
* g:AutoPairsMapCR
Default : 1
Map <CR> to insert a new indented line if cursor in (|), {|} [|], '|', "|"
execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsReturn()<CR>'
* g:AutoPairsCenterLine
Default : 1
When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window.
* g:AutoPairsMapSpace
Default : 1
Map <space> to insert a space after the opening character and before the closing one.
execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>'
* g:AutoPairsFlyMode
Default : 0
set it to 1 to enable FlyMode.
see FlyMode section for details.
* g:AutoPairsMultilineClose
Default : 1
When you press the key for the closing pair (e.g. `)`) it jumps past it.
If set to 1, then it'll jump to the next line, if there is only whitespace.
If set to 0, then it'll only jump to a closing pair on the same line.
* g:AutoPairsShortcutBackInsert
Default : <M-b>
Work with FlyMode, insert the key at the Fly Mode jumped postion
* g:AutoPairsMoveCharacter
Default: "()[]{}\"'"
Map <M-(> <M-)> <M-[> <M-]> <M-{> <M-}> <M-"> <M-'> to
move character under the cursor to the pair.
Buffer Level Pairs Setting
--------------------------
Set b:AutoPairs before BufEnter
eg:
" When the filetype is FILETYPE then make AutoPairs only match for parenthesis
au Filetype FILETYPE let b:AutoPairs = {"(": ")"}
TroubleShooting
---------------
The script will remap keys ([{'"}]) <BS>,
If auto pairs cannot work, use :imap ( to check if the map is corrected.
The correct map should be <C-R>=AutoPairsInsert("\(")<CR>
Or the plugin conflict with some other plugins.
use command :call AutoPairsInit() to remap the keys.
* How to insert parens purely
There are 3 ways
1. use Ctrl-V ) to insert paren without trigger the plugin.
2. use Alt-P to turn off the plugin.
3. use DEL or <C-O>x to delete the character insert by plugin.
* Swedish Character Conflict
Because AutoPairs uses Meta(Alt) key as shortcut, it is conflict with some Swedish character such as å.
To fix the issue, you need remap or disable the related shortcut.
Known Issues
-----------------------
Breaks '.' - [issue #3](https://github.com/jiangmiao/auto-pairs/issues/3)
Description: After entering insert mode and inputing `[hello` then leave insert
mode by `<ESC>`. press '.' will insert 'hello' instead of '[hello]'.
Reason: `[` actually equals `[]\<LEFT>` and \<LEFT> will break '.'.
After version 7.4.849, Vim implements new keyword <C-G>U to avoid the break
Solution: Update Vim to 7.4.849+
Contributors
------------
* [camthompson](https://github.com/camthompson)
License
-------
Copyright (C) 2011-2013 Miao Jiang
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,356 +0,0 @@
*AutoPairs.txt* Insert or delete brackets, parens, quotes in pair
Author: jiangmiao
License: MIT
URL: https://github.com/jiangmiao/auto-pairs
==============================================================================
CONTENTS *autopairs-contents*
1. Installation ............................. |autopairs-installation|
2. Features ..................................... |autopairs-features|
3. Fly Mode ..................................... |autopairs-fly-mode|
4. Shortcuts ................................... |autopairs-shortcuts|
5. Options ....................................... |autopairs-options|
6. Troubleshooting ...................... |autopairs-troubleshooting|
==============================================================================
1. Introduction *autopairs-installation*
Copy `plugin/auto-pairs.vim` to `~/.vim/plugin`.
Or if you are using `pathogen`: >
git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs
==============================================================================
2. Features *autopairs-features*
Insert in pair: >
input: [
output: [|]
Delete in pair: >
input: foo[<BS>]
output: foo
Insert new indented line after Return: >
input: {|} (press <CR> at |)
output: {
|
}
Insert spaces before closing characters, only for [], (), {}: >
input: {|} (press <SPACE> at |)
output: { | }
input: {|} (press <SPACE>foo} at |)
output: { foo }|
input: '|' (press <SPACE> at |)
output: ' |'
Skip ' when inside a word: >
input: foo| (press ' at |)
output: foo'
Skip closed bracket: >
input: []
output: []
Ignore auto pair when previous character is '\': >
input: "\'
output: "\'"
Fast Wrap: >
input: |'hello' (press (<M-e> at |)
output: ('hello')
Wrap string, only support c style string.
input: |'h\\el\'lo' (press (<M-e> at |)
output ('h\\ello\'')
input: |[foo, bar()] (press (<M-e> at |)
output: ([foo, bar()])
Quick jump to closed pair: >
input:
{
something;|
}
(press } at |)
output:
{
}|
Support ```, ''' and """: >
input:
'''
output:
'''|'''
Delete Repeated Pairs in one time: >
input: """|""" (press <BS> at |)
output: |
input: {{|}} (press <BS> at |)
output: |
input: [[[[[[|]]]]]] (press <BS> at |)
output: |
Fly Mode (|autopairs-flymode|): >
input: if(a[3)
output: if(a[3])| (In Fly Mode)
output: if(a[3)]) (Without Fly Mode)
input:
{
hello();|
world();
}
(press } at |)
output:
{
hello();
world();
}|
(then press <M-b> at | to do backinsert)
output:
{
hello();}|
world();
}
See |Fly Mode| section for details
==============================================================================
3. Fly Mode *autopairs-flymode*
Fly Mode will always force closed-pair jumping instead of inserting. Only for
")", "}", "]". If jumps in mistake, you can use |g:AutoPairsBackInsert| (default
Key: <M-b>) to jump back and insert closed pair.
The most situation maybe you want to insert single closed pair in the string,
eg: >
")"
Fly Mode is DISABLED by default. To enable Fly Mode add following to your
'.vimrc': >
let g:AutoPairsFlyMode = 1
Default Options: >
let g:AutoPairsFlyMode = 0
let g:AutoPairsShortcutBackInsert = '<M-b>'
==============================================================================
4. Shortcuts *autopairs-shortcuts*
System Shortcuts:
<CR> : Insert new indented line after return if cursor in blank brackets
or quotes.
<BS> : Delete brackets in pair
<M-p>: Toggle Autopairs (|g:AutoPairsShortcutToggle|)
<M-e>: Fast Wrap (|g:AutoPairsShortcutFastWrap|)
<M-n>: Jump to next closed pair (|g:AutoPairsShortcutJump|)
<M-b>: BackInsert (|g:AutoPairsShortcutBackInsert|)
To rebind keys <M-p>, <M-e> or <M-n> or in case of conflicts with
another keys:
let g:AutoPairsShortcutToggle = '<another key>'
If the key is empty string '', then the shortcut will be disabled.
==============================================================================
5. Options *autopairs-options*
*g:AutoPairs*
|g:AutoPairs| dict
Default: >
{'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
Specifies which symbols should be automatically paired.
To append new pairs without overwriting defaults, add values in your `.vimrc`.:
let g:AutoPairs['<']='>'
This example will enable matching of `<` with `>`.
*b:AutoPairs*
|b:AutoPairs| dict
Default: |g:AutoPairs|
Buffer level pairs set.
You can set |b:AutoPairs| before |BufEnter|: >
au Filetype FILETYPE let b:AutoPairs = {"(": ")"}
This sets |AutoPairs| to only match for parenthesis for 'FILETYPE'.
*g:AutoPairsShortcutToggle*
|g:AutoPairsShortcutToggle| string
Default: <M-p>
The shortcut to toggle autopairs.
*g:AutoPairsShortcutFastWrap*
|g:AutoPairsShortcutFastWrap| string
Default: <M-e>
Fast wrap the word. All pairs will be considered as a block (including <>).
(|)'hello' after fast wrap at |, the word will be ('hello')
(|)<hello> after fast wrap at |, the word will be (<hello>)
*g:AutoPairsShortcutJump*
|g:AutoPairsShortcutJump| string
Default: <M-n>
Jump to the next closed pair.
*g:AutoPairsShortcutBackInsert*
|g:AutoPairsShortcutBackInsert| string
Default: <M-b>
Work with |autopairs-flymode|, insert the key at the Fly Mode jumped position.
*g:AutoPairsMapBS*
|g:AutoPairsMapBS| int
Default: 1
Map <BS> to delete brackets and quotes in pair, executes:
inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>
*g:AutoPairsMapCh*
|g:AutoPairsMapCh| int
Default: 1
Map <C-h> to delete brackets and quotes in pair.
*g:AutoPairsMapCR*
|g:AutoPairsMapCR| int
Default: 1
Map <CR> to insert a new indented line if cursor in (|), {|} [|], '|', "|".
Executes:
inoremap <buffer> <silent> <CR> <C-R>=AutoPairsReturn()<CR>
*g:AutoPairsCenterLine*
|g:AutoPairsCenterLine| int
Default: 1
When |g:AutoPairsMapCR| is on, center current line after return if the line
is at the bottom 1/3 of the window.
*g:AutoPairsMapSpace*
|g:AutoPairsMapSpace| int
Default: 1
Map <space> to insert a space after the opening character and before the
closing one.
Executes:
inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>
*g:AutoPairsFlyMode*
|g:AutoPairsFlyMode| int
Default: 0
Set it to 1 to enable |autopairs-flymode|.
*g:AutoPairsMultilineClose*
|g:AutoPairsMultilineClose| int
Default: 1
When you press the key for the closing pair (e.g. `)`) it jumps past it.
If set to 1, then it'll jump to the next line, if there is only 'whitespace'.
If set to 0, then it'll only jump to a closing pair on the same line.
==============================================================================
6. Troubleshooting *autopairs-troubleshooting*
This plugin remaps keys `([{'"}]) <BS>`
If auto pairs cannot work, use |:imap| to check if the map is corrected.
The correct map should be: >
<C-R>=AutoPairsInsert("\(")<CR>
Or the plugin conflicts with some other plugins. Use command: >
:call AutoPairsInit() to remap the keys.
--- How to insert parens purely? ---
There are 3 ways:
1. Use Ctrl-V ) to insert paren without trigger the plugin.
2. Use Alt-P to turn off the plugin.
3. Use DEL or <C-O>x to delete the character insert by plugin.
--- Swedish Character Conflict ---
Because AutoPairs uses Meta(Alt) key as a shortcut, it conflicts with some
Swedish character such as å. To fix the issue, you need remap or disable the
related shortcut.

View File

@ -1,582 +0,0 @@
" Insert or delete brackets, parens, quotes in pairs.
" Maintainer: JiangMiao <jiangfriend@gmail.com>
" Contributor: camthompson
" Last Change: 2017-06-17
" Version: 1.3.3
" Homepage: http://www.vim.org/scripts/script.php?script_id=3599
" Repository: https://github.com/jiangmiao/auto-pairs
" License: MIT
if exists('g:AutoPairsLoaded') || &cp
finish
end
let g:AutoPairsLoaded = 1
if !exists('g:AutoPairs')
let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
end
if !exists('g:AutoPairsParens')
let g:AutoPairsParens = {'(':')', '[':']', '{':'}'}
end
if !exists('g:AutoPairsMapBS')
let g:AutoPairsMapBS = 1
end
" Map <C-h> as the same BS
if !exists('g:AutoPairsMapCh')
let g:AutoPairsMapCh = 1
end
if !exists('g:AutoPairsMapCR')
let g:AutoPairsMapCR = 1
end
if !exists('g:AutoPairsMapSpace')
let g:AutoPairsMapSpace = 1
end
if !exists('g:AutoPairsCenterLine')
let g:AutoPairsCenterLine = 1
end
if !exists('g:AutoPairsShortcutToggle')
let g:AutoPairsShortcutToggle = '<M-p>'
end
if !exists('g:AutoPairsShortcutFastWrap')
let g:AutoPairsShortcutFastWrap = '<M-e>'
end
if !exists('g:AutoPairsMoveCharacter')
let g:AutoPairsMoveCharacter = "()[]{}\"'"
end
if !exists('g:AutoPairsShortcutJump')
let g:AutoPairsShortcutJump = '<M-n>'
endif
" Fly mode will for closed pair to jump to closed pair instead of insert.
" also support AutoPairsBackInsert to insert pairs where jumped.
if !exists('g:AutoPairsFlyMode')
let g:AutoPairsFlyMode = 0
endif
" When skipping the closed pair, look at the current and
" next line as well.
if !exists('g:AutoPairsMultilineClose')
let g:AutoPairsMultilineClose = 1
endif
" Work with Fly Mode, insert pair where jumped
if !exists('g:AutoPairsShortcutBackInsert')
let g:AutoPairsShortcutBackInsert = '<M-b>'
endif
if !exists('g:AutoPairsSmartQuotes')
let g:AutoPairsSmartQuotes = 1
endif
" 7.4.849 support <C-G>U to avoid breaking '.'
" Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3
" Vim note: https://github.com/vim/vim/releases/tag/v7.4.849
if v:version > 704 || v:version == 704 && has("patch849")
let s:Go = "\<C-G>U"
else
let s:Go = ""
endif
let s:Left = s:Go."\<LEFT>"
let s:Right = s:Go."\<RIGHT>"
" Will auto generated {']' => '[', ..., '}' => '{'}in initialize.
let g:AutoPairsClosedPairs = {}
function! AutoPairsInsert(key)
if !b:autopairs_enabled
return a:key
end
let line = getline('.')
let pos = col('.') - 1
let before = strpart(line, 0, pos)
let after = strpart(line, pos)
let next_chars = split(after, '\zs')
let current_char = get(next_chars, 0, '')
let next_char = get(next_chars, 1, '')
let prev_chars = split(before, '\zs')
let prev_char = get(prev_chars, -1, '')
let eol = 0
if col('$') - col('.') <= 1
let eol = 1
end
" Ignore auto close if prev character is \
if prev_char == '\'
return a:key
end
" The key is difference open-pair, then it means only for ) ] } by default
if !has_key(b:AutoPairs, a:key)
let b:autopairs_saved_pair = [a:key, getpos('.')]
" Skip the character if current character is the same as input
if current_char == a:key
return s:Right
end
if !g:AutoPairsFlyMode
" Skip the character if next character is space
if current_char == ' ' && next_char == a:key
return s:Right.s:Right
end
" Skip the character if closed pair is next character
if current_char == ''
if g:AutoPairsMultilineClose
let next_lineno = line('.')+1
let next_line = getline(nextnonblank(next_lineno))
let next_char = matchstr(next_line, '\s*\zs.')
else
let next_char = matchstr(line, '\s*\zs.')
end
if next_char == a:key
return "\<ESC>e^a"
endif
endif
endif
" Fly Mode, and the key is closed-pairs, search closed-pair and jump
if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key)
let n = stridx(after, a:key)
if n != -1
return repeat(s:Right, n+1)
end
if search(a:key, 'W')
" force break the '.' when jump to different line
return "\<Right>"
endif
endif
" Insert directly if the key is not an open key
return a:key
end
let open = a:key
let close = b:AutoPairs[open]
if current_char == close && open == close
return s:Right
end
" Ignore auto close ' if follows a word
" MUST after closed check. 'hello|'
if a:key == "'" && prev_char =~ '\v\w'
return a:key
end
" support for ''' ``` and """
if open == close
" The key must be ' " `
let pprev_char = line[col('.')-3]
if pprev_char == open && prev_char == open
" Double pair found
return repeat(a:key, 4) . repeat(s:Left, 3)
end
end
let quotes_num = 0
" Ignore comment line for vim file
if &filetype == 'vim' && a:key == '"'
if before =~ '^\s*$'
return a:key
end
if before =~ '^\s*"'
let quotes_num = -1
end
end
" Keep quote number is odd.
" Because quotes should be matched in the same line in most of situation
if g:AutoPairsSmartQuotes && open == close
" Remove \\ \" \'
let cleaned_line = substitute(line, '\v(\\.)', '', 'g')
let n = quotes_num
let pos = 0
while 1
let pos = stridx(cleaned_line, open, pos)
if pos == -1
break
end
let n = n + 1
let pos = pos + 1
endwhile
if n % 2 == 1
return a:key
endif
endif
return open.close.s:Left
endfunction
function! AutoPairsDelete()
if !b:autopairs_enabled
return "\<BS>"
end
let line = getline('.')
let pos = col('.') - 1
let current_char = get(split(strpart(line, pos), '\zs'), 0, '')
let prev_chars = split(strpart(line, 0, pos), '\zs')
let prev_char = get(prev_chars, -1, '')
let pprev_char = get(prev_chars, -2, '')
if pprev_char == '\'
return "\<BS>"
end
" Delete last two spaces in parens, work with MapSpace
if has_key(b:AutoPairs, pprev_char) && prev_char == ' ' && current_char == ' '
return "\<BS>\<DEL>"
endif
" Delete Repeated Pair eg: '''|''' [[|]] {{|}}
if has_key(b:AutoPairs, prev_char)
let times = 0
let p = -1
while get(prev_chars, p, '') == prev_char
let p = p - 1
let times = times + 1
endwhile
let close = b:AutoPairs[prev_char]
let left = repeat(prev_char, times)
let right = repeat(close, times)
let before = strpart(line, pos-times, times)
let after = strpart(line, pos, times)
if left == before && right == after
return repeat("\<BS>\<DEL>", times)
end
end
if has_key(b:AutoPairs, prev_char)
let close = b:AutoPairs[prev_char]
if match(line,'^\s*'.close, col('.')-1) != -1
" Delete (|___)
let space = matchstr(line, '^\s*', col('.')-1)
return "\<BS>". repeat("\<DEL>", len(space)+1)
elseif match(line, '^\s*$', col('.')-1) != -1
" Delete (|__\n___)
let nline = getline(line('.')+1)
if nline =~ '^\s*'.close
if &filetype == 'vim' && prev_char == '"'
" Keep next line's comment
return "\<BS>"
end
let space = matchstr(nline, '^\s*')
return "\<BS>\<DEL>". repeat("\<DEL>", len(space)+1)
end
end
end
return "\<BS>"
endfunction
function! AutoPairsJump()
call search('["\]'')}]','W')
endfunction
" string_chunk cannot use standalone
let s:string_chunk = '\v%(\\\_.|[^\1]|[\r\n]){-}'
let s:ss_pattern = '\v''' . s:string_chunk . ''''
let s:ds_pattern = '\v"' . s:string_chunk . '"'
func! s:RegexpQuote(str)
return substitute(a:str, '\v[\[\{\(\<\>\)\}\]]', '\\&', 'g')
endf
func! s:RegexpQuoteInSquare(str)
return substitute(a:str, '\v[\[\]]', '\\&', 'g')
endf
" Search next open or close pair
func! s:FormatChunk(open, close)
let open = s:RegexpQuote(a:open)
let close = s:RegexpQuote(a:close)
let open2 = s:RegexpQuoteInSquare(a:open)
let close2 = s:RegexpQuoteInSquare(a:close)
if open == close
return '\v'.open.s:string_chunk.close
else
return '\v%(' . s:ss_pattern . '|' . s:ds_pattern . '|' . '[^'.open2.close2.']|[\r\n]' . '){-}(['.open2.close2.'])'
end
endf
" Fast wrap the word in brackets
function! AutoPairsFastWrap()
let line = getline('.')
let current_char = line[col('.')-1]
let next_char = line[col('.')]
let open_pair_pattern = '\v[({\[''"]'
let at_end = col('.') >= col('$') - 1
normal! x
" Skip blank
if next_char =~ '\v\s' || at_end
call search('\v\S', 'W')
let line = getline('.')
let next_char = line[col('.')-1]
end
if has_key(b:AutoPairs, next_char)
let followed_open_pair = next_char
let inputed_close_pair = current_char
let followed_close_pair = b:AutoPairs[next_char]
if followed_close_pair != followed_open_pair
" TODO replace system searchpair to skip string and nested pair.
" eg: (|){"hello}world"} will transform to ({"hello})world"}
call searchpair('\V'.followed_open_pair, '', '\V'.followed_close_pair, 'W')
else
call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We')
end
return s:Right.inputed_close_pair.s:Left
else
normal! he
return s:Right.current_char.s:Left
end
endfunction
function! AutoPairsMap(key)
" | is special key which separate map command from text
let key = a:key
if key == '|'
let key = '<BAR>'
end
let escaped_key = substitute(key, "'", "''", 'g')
" use expr will cause search() doesn't work
execute 'inoremap <buffer> <silent> '.key." <C-R>=AutoPairsInsert('".escaped_key."')<CR>"
endfunction
function! AutoPairsToggle()
if b:autopairs_enabled
let b:autopairs_enabled = 0
echo 'AutoPairs Disabled.'
else
let b:autopairs_enabled = 1
echo 'AutoPairs Enabled.'
end
return ''
endfunction
function! AutoPairsMoveCharacter(key)
let c = getline(".")[col(".")-1]
let escaped_key = substitute(a:key, "'", "''", 'g')
return "\<DEL>\<ESC>:call search("."'".escaped_key."'".")\<CR>a".c."\<LEFT>"
endfunction
function! AutoPairsReturn()
if b:autopairs_enabled == 0
return ''
end
let line = getline('.')
let pline = getline(line('.')-1)
let prev_char = pline[strlen(pline)-1]
let cmd = ''
let cur_char = line[col('.')-1]
if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char
if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2
" Recenter before adding new line to avoid replacing line content
let cmd = "zz"
end
" If equalprg has been set, then avoid call =
" https://github.com/jiangmiao/auto-pairs/issues/24
if &equalprg != ''
return "\<ESC>".cmd."O"
endif
" conflict with javascript and coffee
" javascript need indent new line
" coffeescript forbid indent new line
if &filetype == 'coffeescript' || &filetype == 'coffee'
return "\<ESC>".cmd."k==o"
else
return "\<ESC>".cmd."=ko"
endif
end
return ''
endfunction
function! AutoPairsSpace()
let line = getline('.')
let prev_char = line[col('.')-2]
let cmd = ''
let cur_char =line[col('.')-1]
if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char
let cmd = "\<SPACE>".s:Left
endif
return "\<SPACE>".cmd
endfunction
function! AutoPairsBackInsert()
if exists('b:autopairs_saved_pair')
let pair = b:autopairs_saved_pair[0]
let pos = b:autopairs_saved_pair[1]
call setpos('.', pos)
return pair
endif
return ''
endfunction
function! AutoPairsInit()
let b:autopairs_loaded = 1
if !exists('b:autopairs_enabled')
let b:autopairs_enabled = 1
end
let b:AutoPairsClosedPairs = {}
if !exists('b:AutoPairs')
let b:AutoPairs = g:AutoPairs
end
if !exists('b:AutoPairsMoveCharacter')
let b:AutoPairsMoveCharacter = g:AutoPairsMoveCharacter
end
" buffer level map pairs keys
for [open, close] in items(b:AutoPairs)
call AutoPairsMap(open)
if open != close
call AutoPairsMap(close)
end
let b:AutoPairsClosedPairs[close] = open
endfor
for key in split(b:AutoPairsMoveCharacter, '\s*')
let escaped_key = substitute(key, "'", "''", 'g')
execute 'inoremap <silent> <buffer> <M-'.key."> <C-R>=AutoPairsMoveCharacter('".escaped_key."')<CR>"
endfor
" Still use <buffer> level mapping for <BS> <SPACE>
if g:AutoPairsMapBS
" Use <C-R> instead of <expr> for issue #14 sometimes press BS output strange words
execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>'
end
if g:AutoPairsMapCh
execute 'inoremap <buffer> <silent> <C-h> <C-R>=AutoPairsDelete()<CR>'
endif
if g:AutoPairsMapSpace
" Try to respect abbreviations on a <SPACE>
let do_abbrev = ""
if v:version == 703 && has("patch489") || v:version > 703
let do_abbrev = "<C-]>"
endif
execute 'inoremap <buffer> <silent> <SPACE> '.do_abbrev.'<C-R>=AutoPairsSpace()<CR>'
end
if g:AutoPairsShortcutFastWrap != ''
execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutFastWrap.' <C-R>=AutoPairsFastWrap()<CR>'
end
if g:AutoPairsShortcutBackInsert != ''
execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutBackInsert.' <C-R>=AutoPairsBackInsert()<CR>'
end
if g:AutoPairsShortcutToggle != ''
" use <expr> to ensure showing the status when toggle
execute 'inoremap <buffer> <silent> <expr> '.g:AutoPairsShortcutToggle.' AutoPairsToggle()'
execute 'noremap <buffer> <silent> '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()<CR>'
end
if g:AutoPairsShortcutJump != ''
execute 'inoremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' <ESC>:call AutoPairsJump()<CR>a'
execute 'noremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()<CR>'
end
endfunction
function! s:ExpandMap(map)
let map = a:map
let map = substitute(map, '\(<Plug>\w\+\)', '\=maparg(submatch(1), "i")', 'g')
return map
endfunction
function! AutoPairsTryInit()
if exists('b:autopairs_loaded')
return
end
" for auto-pairs starts with 'a', so the priority is higher than supertab and vim-endwise
"
" vim-endwise doesn't support <Plug>AutoPairsReturn
" when use <Plug>AutoPairsReturn will cause <Plug> isn't expanded
"
" supertab doesn't support <SID>AutoPairsReturn
" when use <SID>AutoPairsReturn will cause Duplicated <CR>
"
" and when load after vim-endwise will cause unexpected endwise inserted.
" so always load AutoPairs at last
" Buffer level keys mapping
" comptible with other plugin
if g:AutoPairsMapCR
if v:version == 703 && has('patch32') || v:version > 703
" VIM 7.3 supports advancer maparg which could get <expr> info
" then auto-pairs could remap <CR> in any case.
let info = maparg('<CR>', 'i', 0, 1)
if empty(info)
let old_cr = '<CR>'
let is_expr = 0
else
let old_cr = info['rhs']
let old_cr = s:ExpandMap(old_cr)
let old_cr = substitute(old_cr, '<SID>', '<SNR>' . info['sid'] . '_', 'g')
let is_expr = info['expr']
let wrapper_name = '<SID>AutoPairsOldCRWrapper73'
endif
else
" VIM version less than 7.3
" the mapping's <expr> info is lost, so guess it is expr or not, it's
" not accurate.
let old_cr = maparg('<CR>', 'i')
if old_cr == ''
let old_cr = '<CR>'
let is_expr = 0
else
let old_cr = s:ExpandMap(old_cr)
" old_cr contain (, I guess the old cr is in expr mode
let is_expr = old_cr =~ '\V(' && toupper(old_cr) !~ '\V<C-R>'
" The old_cr start with " it must be in expr mode
let is_expr = is_expr || old_cr =~ '\v^"'
let wrapper_name = '<SID>AutoPairsOldCRWrapper'
end
end
if old_cr !~ 'AutoPairsReturn'
if is_expr
" remap <expr> to `name` to avoid mix expr and non-expr mode
execute 'inoremap <buffer> <expr> <script> '. wrapper_name . ' ' . old_cr
let old_cr = wrapper_name
end
" Always silent mapping
execute 'inoremap <script> <buffer> <silent> <CR> '.old_cr.'<SID>AutoPairsReturn'
end
endif
call AutoPairsInit()
endfunction
" Always silent the command
inoremap <silent> <SID>AutoPairsReturn <C-R>=AutoPairsReturn()<CR>
imap <script> <Plug>AutoPairsReturn <SID>AutoPairsReturn
au BufEnter * :call AutoPairsTryInit()

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,9 @@ that are part of Git repositories).
*fugitive-:Glcd*
:Glcd [directory] |:lcd| relative to the repository.
*fugitive-:Gstatus*
:Gstatus Bring up the output of git-status in the preview
window. The following maps, which work on the cursor
*fugitive-:Gstatus* *fugitive-:G*
:Gstatus Bring up a git-status inspired summary in the preview
:G window. The following maps, which work on the cursor
line file where sensible, are provided:
g? show this help
@ -40,42 +40,48 @@ that are part of Git repositories).
<CR> |:Gedit|
- |:Git| add
- |:Git| reset (staged files)
a Show alternative format
ca |:Gcommit| --amend
cc |:Gcommit|
ce |:Gcommit| --amend --no-edit
cw |:Gcommit| --amend --only
cva |:Gcommit| --verbose --amend
cvc |:Gcommit| --verbose
cf |:Gcommit| --fixup=
cs |:Gcommit| --squash=
cA |:Gcommit| --edit --squash=
= toggle inline diff
< show inline diff
> hide inline diff
D |:Gdiff|
ds |:Gsdiff|
dp |:Git!| diff (p for patch; use :Gw to apply)
dp |:Git| add --intent-to-add (untracked files)
dv |:Gvdiff|
gO |:Gvsplit|
O |:Gtabedit|
o |:Gsplit|
P |:Git| add --patch
P |:Git| reset --patch (staged files)
s |:Git| add
u |:Git| reset
X |:Git| checkout
X |:Git| checkout HEAD (staged files)
X |:Git| clean (untracked files)
X |:Git| rm (unmerged files)
q close status
r reload status
S |:Gvsplit|
U |:Git| checkout
U |:Git| checkout HEAD (staged files)
U |:Git| clean (untracked files)
U |:Git| rm (unmerged files)
. enter |:| command line with file prepopulated
*fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. If there is nothing
to commit, |:Gstatus| is called instead. Unless the
arguments given would skip the invocation of an editor
(e.g., -m), a split window will be used to obtain a
commit message, or a new tab if -v is given. Write
and close that window (:wq or |:Gwrite|) to finish the
commit. Unlike when running the actual git-commit
command, it is possible (but unadvisable) to alter the
index with commands like git-add and git-reset while a
commit message is pending.
:Gcommit [args] A wrapper around git-commit. Unless the arguments
given would skip the invocation of an editor (e.g.,
-m), a split window will be used to obtain a commit
message, or a new tab if -v is given. Write and close
that window (:wq or |:Gwrite|) to finish the commit.
Unlike when running the actual git-commit command, it
is possible (but unadvisable) to alter the index with
commands like git-add and git-reset while a commit
message is pending.
*fugitive-:Gmerge*
:Gmerge [args] Calls git-merge and loads errors and conflicted files
@ -90,7 +96,7 @@ that are part of Git repositories).
*fugitive-:Grebase*
:Grebase [args] Like |:Gmerge|, but for git-rebase. Interactive
rebase not supported.
rebase is experimentally supported.
*fugitive-:Gpush*
:Gpush [args] Invoke git-push, load the results into the |quickfix|
@ -108,17 +114,18 @@ that are part of Git repositories).
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
*fugitive-:Glog*
:Glog [args] Load all previous revisions of the current file into
the |quickfix| list. Additional git-log arguments can
be given (for example, --reverse). If "--" appears as
an argument, no file specific filtering is done, and
previous commits rather than previous file revisions
are loaded.
:Glog [args] Load the commit history into the |quickfix| list.
Additional git-log arguments can be given (for
example, --reverse). Provide "--" in the argument
list to target all commits. Otherwise, only commits
changing the current file will be targeted. This
special casing is slated to be removed.
:{range}Glog [args] Use git-log -L to load previous revisions of the given
range of the current file into the |quickfix| list.
The cursor is positioned on the first line of the
first diff hunk for each commit.
first diff hunk for each commit. Use :0Glog to target
the entire file.
*fugitive-:Gllog*
:Gllog [args] Like |:Glog|, but use the location list instead of the
@ -284,8 +291,8 @@ These maps are available in committed Git objects.
o Jump to the |fugitive-object| under the cursor in a
new split.
*fugitive-S*
S Jump to the |fugitive-object| under the cursor in a
*fugitive-gO*
gO Jump to the |fugitive-object| under the cursor in a
new vertical split.
*fugitive-O*
@ -293,7 +300,8 @@ O Jump to the |fugitive-object| under the cursor in a
new tab.
*fugitive--*
- Go to the tree containing the current tree or blob.
- Go to the tree containing the current tree or blob
(i.e, the parent directory).
*fugitive-~*
~ Go to the current file in the [count]th first

View File

@ -72,8 +72,14 @@ function! FugitivePrepare(...) abort
return call('fugitive#Prepare', a:000)
endfunction
function! FugitiveConfig(key, ...) abort
return fugitive#Config(a:key, FugitiveGitDir(a:0 ? a:1 : -1))
function! FugitiveConfig(...) abort
if a:0 == 2 && type(a:2) != type({})
return fugitive#Config(a:1, FugitiveGitDir(a:2))
elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.'
return fugitive#Config(FugitiveGitDir(a:1))
else
return call('fugitive#Config', a:000)
endif
endfunction
function! FugitiveRemoteUrl(...) abort
@ -250,6 +256,10 @@ augroup fugitive
\ call fugitive#MapCfile() |
\ endif
autocmd FileType gitcommit
\ if exists('b:git_dir') |
\ call fugitive#MapCfile('fugitive#MessageCfile()') |
\ endif
autocmd FileType fugitive
\ if exists('b:git_dir') |
\ call fugitive#MapCfile('fugitive#StatusCfile()') |
\ endif

View File

@ -1,2 +1,5 @@
.local/
.cache/
.dlv/
.git/
.viminfo

View File

@ -1,5 +1,9 @@
## unplanned
BACKWARDS INCOMPATABILITIES:
* g:go_highlight_fuction_arguments is renamed to g:go_highlight_function_parameters
[[GH-2117]](https://github.com/fatih/vim-go/pull/2117)
IMPROVEMENTS:
* Disable `g:go_gocode_propose_source` by default.
[[GH-2050]](https://github.com/fatih/vim-go/pull/2050)
@ -15,6 +19,10 @@ IMPROVEMENTS:
* Do not require `'autowrite'` or `'autowriteall'` to be set when using
autocompletion in module mode.
[[GH-2091]](https://github.com/fatih/vim-go/pull/2091)
* Fix use of g:go_metalinter_command _and_ apply it even when autosaving.
[[GH-2101]](https://github.com/fatih/vim-go/pull/2101)
* Report errors in quickfix when Delve fails to start (e.g. compiler errors).
[[GH-2111]](https://github.com/fatih/vim-go/pull/2111)
BUG FIXES:
* Fix opening of non-existent file from `:GoDeclsDir` when the current
@ -28,6 +36,13 @@ BUG FIXES:
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
* Fix `:GoSameIdsToggle`.
[[GH-2086]](https://github.com/fatih/vim-go/pull/2086)
* Do not set fileencoding or fileformat options or populate from template when
the buffer is not modifiable.
[[GH-2097]](https://github.com/fatih/vim-go/pull/2097)
* Do not clear buffer-local autocmds of other buffers.
[[GH-2109]](https://github.com/fatih/vim-go/pull/2109)
* Highlight return parameter types when g:go_highlight_function_arguments is set.
[[GH-2116]](https://github.com/fatih/vim-go/pull/2116)
## 1.19 - (November 4, 2018)

View File

@ -26,9 +26,7 @@ endfunction
function! go#cmd#Build(bang, ...) abort
" Create our command arguments. go build discards any results when it
" compiles multiple packages. So we pass the `errors` package just as an
" placeholder with the current folder (indicated with '.'). We also pass -i
" that tries to install the dependencies, this has the side effect that it
" caches the build results, so every other build is faster.
" placeholder with the current folder (indicated with '.').
let l:args =
\ ['build', '-tags', go#config#BuildTags()] +
\ map(copy(a:000), "expand(v:val)") +
@ -63,6 +61,7 @@ function! go#cmd#Build(bang, ...) abort
redraw!
finally
execute cd . fnameescape(dir)
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
@ -72,8 +71,6 @@ function! go#cmd#Build(bang, ...) abort
else
call go#util#EchoSuccess("[build] SUCCESS")
endif
let &makeprg = default_makeprg
endif
endfunction
@ -169,11 +166,15 @@ function! go#cmd#Run(bang, ...) abort
let l:listtype = go#list#Type("GoRun")
if l:listtype == "locationlist"
exe 'lmake!'
else
exe 'make!'
endif
try
if l:listtype == "locationlist"
exe 'lmake!'
else
exe 'make!'
endif
finally
let &makeprg = default_makeprg
endtry
let items = go#list#Get(l:listtype)
let errors = go#tool#FilterValids(items)
@ -184,7 +185,6 @@ function! go#cmd#Run(bang, ...) abort
call go#list#JumpToFirst(l:listtype)
endif
let &makeprg = default_makeprg
endfunction
" Install installs the package by simple calling 'go install'. If any argument
@ -226,6 +226,7 @@ function! go#cmd#Install(bang, ...) abort
redraw!
finally
execute cd . fnameescape(dir)
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
@ -235,8 +236,6 @@ function! go#cmd#Install(bang, ...) abort
else
call go#util#EchoSuccess("installed to ". go#path#Default())
endif
let &makeprg = default_makeprg
endfunction
" Generate runs 'go generate' in similar fashion to go#cmd#Build()
@ -255,12 +254,17 @@ function! go#cmd#Generate(bang, ...) abort
let l:listtype = go#list#Type("GoGenerate")
echon "vim-go: " | echohl Identifier | echon "generating ..."| echohl None
if l:listtype == "locationlist"
silent! exe 'lmake!'
else
silent! exe 'make!'
endif
redraw!
try
if l:listtype == "locationlist"
silent! exe 'lmake!'
else
silent! exe 'make!'
endif
finally
redraw!
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
call go#list#Window(l:listtype, len(errors))
@ -272,7 +276,6 @@ function! go#cmd#Generate(bang, ...) abort
redraws! | echon "vim-go: " | echohl Function | echon "[generate] SUCCESS"| echohl None
endif
let &makeprg = default_makeprg
endfunction
" ---------------------

View File

@ -388,8 +388,9 @@ function! go#config#HighlightFunctions() abort
return get(g:, 'go_highlight_functions', 0)
endfunction
function! go#config#HighlightFunctionArguments() abort
return get(g:, 'go_highlight_function_arguments', 0)
function! go#config#HighlightFunctionParameters() abort
" fallback to highlight_function_arguments for backwards compatibility
return get(g:, 'go_highlight_function_parameters', get(g:, 'go_highlight_function_arguments', 0))
endfunction
function! go#config#HighlightFunctionCalls() abort

View File

@ -85,7 +85,7 @@ function! go#coverage#Clear() abort
" remove the autocmd we defined
augroup vim-go-coverage
autocmd!
autocmd! * <buffer>
augroup end
endfunction
@ -242,7 +242,7 @@ function! go#coverage#overlay(file) abort
" clear the matches if we leave the buffer
augroup vim-go-coverage
autocmd!
autocmd! * <buffer>
autocmd BufWinLeave <buffer> call go#coverage#Clear()
augroup end

View File

@ -30,6 +30,21 @@ function! s:groutineID() abort
endfunction
function! s:complete(job, exit_status, data) abort
let l:gotready = get(s:state, 'ready', 0)
" copy messages to a:data _only_ when dlv exited non-zero and it was never
" detected as ready (e.g. there was a compiler error).
if a:exit_status > 0 && !l:gotready
" copy messages to data so that vim-go's usual handling of errors from
" async jobs will occur.
call extend(a:data, s:state['message'])
endif
" return early instead of clearing any variables when the current job is not
" a:job
if has_key(s:state, 'job') && s:state['job'] != a:job
return
endif
if has_key(s:state, 'job')
call remove(s:state, 'job')
endif
@ -38,10 +53,11 @@ function! s:complete(job, exit_status, data) abort
call remove(s:state, 'ready')
endif
call s:clearState()
if a:exit_status > 0
call go#util#EchoError(s:state['message'])
if has_key(s:state, 'ch')
call remove(s:state, 'ch')
endif
call s:clearState()
endfunction
function! s:logger(prefix, ch, msg) abort
@ -217,8 +233,8 @@ endfunction
function! s:stop() abort
let l:res = s:call_jsonrpc('RPCServer.Detach', {'kill': v:true})
call s:clearState()
if has_key(s:state, 'job')
call go#job#Wait(s:state['job'])
call remove(s:state, 'job')
endif
@ -230,9 +246,7 @@ function! s:stop() abort
call remove(s:state, 'ch')
endif
if has_key( s:state, 'data')
call remove(s:state, 'data')
endif
call s:clearState()
endfunction
function! go#debug#Stop() abort
@ -473,7 +487,7 @@ function! s:start_cb(res) abort
exe bufwinnr(oldbuf) 'wincmd w'
augroup vim-go-debug
autocmd!
autocmd! * <buffer>
autocmd FileType go nmap <buffer> <F5> <Plug>(go-debug-continue)
autocmd FileType go nmap <buffer> <F6> <Plug>(go-debug-print)
autocmd FileType go nmap <buffer> <F9> <Plug>(go-debug-breakpoint)
@ -489,7 +503,6 @@ function! s:err_cb(ch, msg) abort
return
endif
call go#util#EchoError(a:msg)
let s:state['message'] += [a:msg]
endfunction
@ -499,7 +512,6 @@ function! s:out_cb(ch, msg) abort
return
endif
call go#util#EchoProgress(a:msg)
let s:state['message'] += [a:msg]
if stridx(a:msg, go#config#DebugAddress()) != -1
@ -572,7 +584,7 @@ function! go#debug#Start(is_test, ...) abort
" It's already running.
if has_key(s:state, 'job')
return
return s:state['job']
endif
let s:start_args = a:000
@ -634,7 +646,7 @@ function! go#debug#Start(is_test, ...) abort
let s:state['message'] = []
let l:opts = {
\ 'for': '_',
\ 'for': 'GoDebug',
\ 'statustype': 'debug',
\ 'complete': function('s:complete'),
\ }
@ -647,6 +659,8 @@ function! go#debug#Start(is_test, ...) abort
catch
call go#util#EchoError(v:exception)
endtry
return s:state['job']
endfunction
" Translate a reflect kind constant to a human string.
@ -872,7 +886,7 @@ function! go#debug#Restart() abort
call go#cmd#autowrite()
try
call go#job#Stop(s:state['job'])
call s:stop()
let l:breaks = s:state['breakpoint']
let s:state = {

View File

@ -7,11 +7,49 @@ function! Test_GoDebugStart_Empty() abort
endfunction
function! Test_GoDebugStart_RelativePackage() abort
call s:debug('./debugmain')
call s:debug('./debug/debugmain')
endfunction
function! Test_GoDebugStart_Package() abort
call s:debug('debugmain')
call s:debug('debug/debugmain')
endfunction
function! Test_GoDebugStart_Errors() abort
if !go#util#has_job()
return
endif
try
let l:expected = [
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# debug/compilerror'},
\ {'lnum': 6, 'bufnr': 7, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
\]
call setqflist([], 'r')
let l:tmp = gotest#load_fixture('debug/compilerror/main.go')
call assert_false(exists(':GoDebugStop'))
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
execute l:cd . ' debug/compilerror'
call go#debug#Start(0)
let l:actual = getqflist()
let l:start = reltime()
while len(l:actual) == 0 && reltimefloat(reltime(l:start)) < 10
sleep 100m
let l:actual = getqflist()
endwhile
call gotest#assert_quickfix(l:actual, l:expected)
call assert_false(exists(':GoDebugStop'))
finally
call delete(l:tmp, 'rf')
" clear the quickfix lists
call setqflist([], 'r')
endtry
endfunction
function! s:debug(...) abort
@ -20,7 +58,7 @@ function! s:debug(...) abort
endif
try
let l:tmp = gotest#load_fixture('debugmain/debugmain.go')
let l:tmp = gotest#load_fixture('debug/debugmain/debugmain.go')
call go#debug#Breakpoint(6)
@ -28,10 +66,10 @@ function! s:debug(...) abort
if a:0 == 0
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
execute l:cd . ' debugmain'
call go#debug#Start(0)
execute l:cd . ' debug/debugmain'
let l:job = go#debug#Start(0)
else
call go#debug#Start(0, a:1)
let l:job = go#debug#Start(0, a:1)
endif
let l:start = reltime()
@ -39,9 +77,17 @@ function! s:debug(...) abort
sleep 100m
endwhile
call assert_true(exists(':GoDebugStop'))
call gotest#assert_quickfix(getqflist(), [])
call go#debug#Stop()
if !has('nvim')
call assert_equal(job_status(l:job), 'dead')
endif
call assert_false(exists(':GoDebugStop'))
finally
call delete(l:tmp, 'rf')
endtry

View File

@ -84,7 +84,6 @@ function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort
endif
call go#def#jump_to_declaration(a:data[0], a:mode, a:bin_name)
call go#util#EchoSuccess(fnamemodify(a:data[0], ":t"))
" capture the active window so that after the exit_cb and close_cb callbacks
" can return to it when a:mode caused a split.

View File

@ -486,7 +486,7 @@ function! s:same_ids_highlight(exit_val, output, mode) abort
" re-apply SameIds at the current cursor position at the time the buffer
" is redisplayed: e.g. :edit, :GoRename, etc.
augroup vim-go-sameids
autocmd!
autocmd! * <buffer>
autocmd BufWinEnter <buffer> nested call go#guru#SameIds(0)
augroup end
endif
@ -511,7 +511,7 @@ function! go#guru#ClearSameIds() abort
" remove the autocmds we defined
augroup vim-go-sameids
autocmd!
autocmd! * <buffer>
augroup end
return 0

View File

@ -343,77 +343,19 @@ function! s:neooptions(options)
continue
endif
" dealing with the channel lines of Neovim sucks. The docs (:help
" channel-lines) say:
" stream event handlers may receive partial (incomplete) lines. For a
" given invocation of on_stdout etc, `a:data` is not guaranteed to end
" with a newline.
" - `abcdefg` may arrive as `['abc']`, `['defg']`.
" - `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`,
" `['','efg']`, or even `['ab']`, `['c','efg']`.
if key == 'callback'
let l:options['callback'] = a:options['callback']
if !has_key(a:options, 'out_cb')
function! s:callback2on_stdout(ch, data, event) dict
" a single empty string means EOF was reached.
if len(a:data) == 1 && a:data[0] == ''
" when there's nothing buffered, return early so that an
" erroneous message will not be added.
if self.stdout_buf == ''
return
endif
let l:data = [self.stdout_buf]
let self.stdout_buf = ''
else
let l:data = copy(a:data)
let l:data[0] = self.stdout_buf . l:data[0]
" The last element may be a partial line; save it for next time.
let self.stdout_buf = l:data[-1]
let l:data = l:data[:-2]
if len(l:data) == 0
return
endif
endif
for l:msg in l:data
call self.callback(a:ch, l:msg)
endfor
let self.stdout_buf = s:neocb(a:ch, self.stdout_buf, a:data, self.callback)
endfunction
let l:options['on_stdout'] = function('s:callback2on_stdout', [], l:options)
endif
if !has_key(a:options, 'err_cb')
function! s:callback2on_stderr(ch, data, event) dict
" a single empty string means EOF was reached.
if len(a:data) == 1 && a:data[0] == ''
" when there's nothing buffered, return early so that an
" erroneous message will not be added.
if self.stderr_buf == ''
return
endif
let l:data = [self.stderr_buf]
let self.stderr_buf = ''
else
let l:data = copy(a:data)
let l:data[0] = self.stderr_buf . l:data[0]
" The last element may be a partial line; save it for next time.
let self.stderr_buf = l:data[-1]
let l:data = l:data[:-2]
if len(l:data) == 0
return
endif
endif
for l:msg in l:data
call self.callback(a:ch, l:msg)
endfor
let self.stderr_buf = s:neocb(a:ch, self.stderr_buf, a:data, self.callback)
endfunction
let l:options['on_stderr'] = function('s:callback2on_stderr', [], l:options)
endif
@ -424,31 +366,7 @@ function! s:neooptions(options)
if key == 'out_cb'
let l:options['out_cb'] = a:options['out_cb']
function! s:on_stdout(ch, data, event) dict
" a single empty string means EOF was reached.
if len(a:data) == 1 && a:data[0] == ''
" when there's nothing buffered, return early so that an
" erroneous message will not be added.
if self.stdout_buf == ''
return
endif
let l:data = [self.stdout_buf]
let self.stdout_buf = ''
else
let l:data = copy(a:data)
let l:data[0] = self.stdout_buf . l:data[0]
" The last element may be a partial line; save it for next time.
let self.stdout_buf = l:data[-1]
let l:data = l:data[:-2]
if len(l:data) == 0
return
endif
endif
for l:msg in l:data
call self.out_cb(a:ch, l:msg)
endfor
let self.stdout_buf = s:neocb(a:ch, self.stdout_buf, a:data, self.out_cb)
endfunction
let l:options['on_stdout'] = function('s:on_stdout', [], l:options)
@ -458,31 +376,7 @@ function! s:neooptions(options)
if key == 'err_cb'
let l:options['err_cb'] = a:options['err_cb']
function! s:on_stderr(ch, data, event) dict
" a single empty string means EOF was reached.
if len(a:data) == 1 && a:data[0] == ''
" when there's nothing buffered, return early so that an
" erroneous message will not be added.
if self.stderr_buf == ''
return
endif
let l:data = [self.stderr_buf]
let self.stderr_buf = ''
else
let l:data = copy(a:data)
let l:data[0] = self.stderr_buf . l:data[0]
" The last element may be a partial line; save it for next time.
let self.stderr_buf = l:data[-1]
let l:data = l:data[:-2]
if len(l:data) == 0
return
endif
endif
for l:msg in l:data
call self.err_cb(a:ch, l:msg)
endfor
let self.stderr_buf = s:neocb(a:ch, self.stderr_buf, a:data, self.err_cb )
endfunction
let l:options['on_stderr'] = function('s:on_stderr', [], l:options)
@ -542,6 +436,43 @@ function! s:winjobarg(idx, val) abort
return a:val
endfunction
function! s:neocb(ch, buf, data, callback)
" dealing with the channel lines of Neovim is awful. The docs (:help
" channel-lines) say:
" stream event handlers may receive partial (incomplete) lines. For a
" given invocation of on_stdout etc, `a:data` is not guaranteed to end
" with a newline.
" - `abcdefg` may arrive as `['abc']`, `['defg']`.
" - `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`,
" `['','efg']`, or even `['ab']`, `['c','efg']`.
" a single empty string means EOF was reached.
if len(a:data) == 1 && a:data[0] == ''
" when there's nothing buffered, return early so that an
" erroneous message will not be added.
if a:buf == ''
return ''
endif
let l:data = [a:buf]
let l:buf = ''
else
let l:data = copy(a:data)
let l:data[0] = a:buf . l:data[0]
" The last element may be a partial line; save it for next time.
let l:buf = l:data[-1]
let l:data = l:data[:-2]
endif
for l:msg in l:data
call a:callback(a:ch, l:msg)
endfor
return l:buf
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -9,15 +9,22 @@ function! go#lint#Gometa(bang, autosave, ...) abort
let goargs = a:000
endif
let bin_path = go#path#CheckBinPath("gometalinter")
if empty(bin_path)
return
endif
if empty(go#config#MetalinterCommand())
let bin_path = go#path#CheckBinPath("gometalinter")
if empty(bin_path)
return
endif
let cmd = [bin_path]
let cmd += ["--disable-all"]
let cmd = [bin_path]
let cmd += ["--disable-all"]
" gometalinter has a --tests flag to tell its linters whether to run
" against tests. While not all of its linters respect this flag, for those
" that do, it means if we don't pass --tests, the linter won't run against
" test files. One example of a linter that will not run against tests if
" we do not specify this flag is errcheck.
let cmd += ["--tests"]
if a:autosave || empty(go#config#MetalinterCommand())
" linters
let linters = a:autosave ? go#config#MetalinterAutosaveEnabled() : go#config#MetalinterEnabled()
for linter in linters
@ -27,16 +34,9 @@ function! go#lint#Gometa(bang, autosave, ...) abort
for linter in go#config#MetalinterDisabled()
let cmd += ["--disable=".linter]
endfor
" gometalinter has a --tests flag to tell its linters whether to run
" against tests. While not all of its linters respect this flag, for those
" that do, it means if we don't pass --tests, the linter won't run against
" test files. One example of a linter that will not run against tests if
" we do not specify this flag is errcheck.
let cmd += ["--tests"]
else
" the user wants something else, let us use it.
let cmd += split(go#config#MetalinterCommand(), " ")
let cmd = split(go#config#MetalinterCommand(), " ")
endif
if a:autosave
@ -78,8 +78,8 @@ function! go#lint#Gometa(bang, autosave, ...) abort
echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None
else
" GoMetaLinter can output one of the two, so we look for both:
" <file>:<line>:[<column>]: <message> (<linter>)
" <file>:<line>:: <message> (<linter>)
" <file>:<line>:<column>:<severity>: <message> (<linter>)
" <file>:<line>::<severity>: <message> (<linter>)
" This can be defined by the following errorformat:
let errformat = "%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m"
@ -123,7 +123,9 @@ endfunction
function! go#lint#Vet(bang, ...) abort
call go#cmd#autowrite()
call go#util#EchoProgress('calling vet...')
if go#config#EchoCommandInfo()
call go#util#EchoProgress('calling vet...')
endif
if a:0 == 0
let [l:out, l:err] = go#util#Exec(['go', 'vet', go#package#ImportPath()])
@ -140,7 +142,6 @@ function! go#lint#Vet(bang, ...) abort
if !empty(errors) && !a:bang
call go#list#JumpToFirst(l:listtype)
endif
call go#util#EchoError('[vet] FAIL')
else
call go#list#Clean(l:listtype)
call go#util#EchoSuccess('[vet] PASS')

View File

@ -138,6 +138,7 @@ endfunction
" in g:go_list_type_commands.
let s:default_list_type_commands = {
\ "GoBuild": "quickfix",
\ "GoDebug": "quickfix",
\ "GoErrCheck": "quickfix",
\ "GoFmt": "locationlist",
\ "GoGenerate": "quickfix",

View File

@ -89,7 +89,6 @@ function s:parse_errors(exit_val, bang, out)
let l:listtype = go#list#Type("GoRename")
if a:exit_val != 0
call go#util#EchoError("FAILED")
let errors = go#tool#ParseErrors(a:out)
call go#list#Populate(l:listtype, errors, 'Rename')
call go#list#Window(l:listtype, len(errors))

View File

@ -8,39 +8,34 @@ function! go#template#create() abort
let l:go_template_use_pkg = go#config#TemplateUsePkg()
let l:root_dir = fnamemodify(s:current_file, ':h:h:h')
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
let l:package_name = -1
let l:package_name = go#tool#PackageName()
if isdirectory(expand('%:p:h'))
execute cd . fnameescape(expand('%:p:h'))
let l:package_name = go#tool#PackageName()
endif
" if we can't figure out any package name(no Go files or non Go package
" files) from the directory create the template or use the cwd
" as the name
if l:package_name == -1 && l:go_template_use_pkg != 1
let l:filename = fnamemodify(expand("%"), ':t')
if l:filename =~ "_test.go$"
let l:template_file = go#config#TemplateTestFile()
" if we can't figure out any package name (i.e. no Go files in the directory)
" from the directory create the template or use the directory as the name.
if l:package_name == -1
if l:go_template_use_pkg == 1
let l:path = fnamemodify(expand('%:p:h'), ':t')
let l:content = printf("package %s", l:path)
call append(0, l:content)
else
let l:template_file = go#config#TemplateFile()
let l:filename = expand('%:t')
if l:filename =~ "_test.go$"
let l:template_file = go#config#TemplateTestFile()
else
let l:template_file = go#config#TemplateFile()
endif
let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file)
silent exe 'keepalt 0r ' . fnameescape(l:template_path)
endif
let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file)
silent exe 'keepalt 0r ' . fnameescape(l:template_path)
elseif l:package_name == -1 && l:go_template_use_pkg == 1
" cwd is now the dir of the package
let l:path = fnamemodify(getcwd(), ':t')
let l:content = printf("package %s", l:path)
call append(0, l:content)
else
let l:content = printf("package %s", l:package_name)
call append(0, l:content)
endif
$delete _
execute cd . fnameescape(dir)
" checking that the last line is empty shouldn't be necessary, but for some
" reason the last line isn't the expected empty line when run via tests.
if getline('$') is ''
$delete _
endif
endfunction
function! go#template#ToggleAutoCreate() abort

View File

@ -1,7 +0,0 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -84,7 +84,6 @@ function! go#test#Test(bang, compile, ...) abort
" failed to parse errors, output the original content
call go#util#EchoError(out)
endif
call go#util#EchoError("[test] FAIL")
else
call go#list#Clean(l:listtype)

View File

@ -130,8 +130,8 @@ function! go#tool#ParseErrors(lines) abort
return errors
endfunction
"FilterValids filters the given items with only items that have a valid
"filename. Any non valid filename is filtered out.
" FilterValids filters the given items with only items that have a valid
" filename. Any non valid filename is filtered out.
function! go#tool#FilterValids(items) abort
" Remove any nonvalid filename from the location list to avoid opening an
" empty buffer. See https://github.com/fatih/vim-go/issues/287 for

View File

@ -1836,13 +1836,13 @@ Highlight function and method declarations.
>
let g:go_highlight_functions = 0
<
*'g:go_highlight_function_arguments'*
*'g:go_highlight_function_parameters'*
Highlight the variable names in arguments and return values in function
declarations. Setting this implies the functionality from
Highlight the variable names in parameters (including named return parameters)
in function declarations. Setting this implies the functionality from
|'g:go_highlight_functions'|.
>
let g:go_highlight_function_arguments = 0
let g:go_highlight_function_parameters = 0
<
*'g:go_highlight_function_calls'*

View File

@ -25,11 +25,11 @@ function! s:gofiletype_post()
endfunction
" Note: should not use augroup in ftdetect (see :help ftdetect)
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufNewFile *.go setfiletype go | if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif
au BufRead *.go call s:gofiletype_pre("go")
au BufReadPost *.go call s:gofiletype_post()
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
au BufNewFile *.s setfiletype asm | if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif
au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post()

View File

@ -277,7 +277,7 @@ endfunction
function! s:template_autocreate()
" create new template from scratch
if get(g:, "go_template_autocreate", 1)
if get(g:, "go_template_autocreate", 1) && &modifiable
call go#template#create()
endif
endfunction

View File

@ -48,7 +48,7 @@ redir @q
redir END
let s:tests = split(substitute(@q, 'function \(\k\+()\)', '\1', 'g'))
" log any messages that we may already accumulated.
" log any messages already accumulated.
call s:logmessages()
" Iterate over all tests and execute them.
for s:test in sort(s:tests)

View File

@ -148,14 +148,14 @@ endif
" var, const
if go#config#FoldEnable('varconst')
syn region goVar start='var (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
syn region goConst start='const (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
else
syn region goVar start='var (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
syn region goConst start='const (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
endif
" Single-line var, const, and import.
@ -263,19 +263,20 @@ endif
hi def link goOperator Operator
" Functions;
if go#config#HighlightFunctions() || go#config#HighlightFunctionArguments()
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl
if go#config#HighlightFunctions() || go#config#HighlightFunctionParameters()
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleParams skipwhite skipnl
syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
syn match goFunction /\w\+/ nextgroup=goSimpleArguments contained skipwhite skipnl
syn match goFunction /\w\+/ nextgroup=goSimpleParams contained skipwhite skipnl
syn match goReceiverType /\w\+/ contained
if go#config#HighlightFunctionArguments()
syn match goSimpleArguments /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goArgumentName nextgroup=goSimpleArguments skipwhite skipnl
syn match goArgumentName /\w\+\(\s*,\s*\w\+\)*\ze\s\+\(\w\|\.\|\*\|\[\)/ contained nextgroup=goArgumentType skipwhite skipnl
syn match goArgumentType /\([^,)]\|\_s\)\+,\?/ contained nextgroup=goArgumentName skipwhite skipnl
if go#config#HighlightFunctionParameters()
syn match goSimpleParams /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType nextgroup=goFunctionReturn skipwhite skipnl
syn match goFunctionReturn /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType skipwhite skipnl
syn match goParamName /\w\+\(\s*,\s*\w\+\)*\ze\s\+\(\w\|\.\|\*\|\[\)/ contained nextgroup=goParamType skipwhite skipnl
syn match goParamType /\([^,)]\|\_s\)\+,\?/ contained nextgroup=goParamName skipwhite skipnl
\ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock
hi def link goReceiverVar goArgumentName
hi def link goArgumentName Identifier
hi def link goReceiverVar goParamName
hi def link goParamName Identifier
endif
syn match goReceiver /(\s*\w\+\(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
else

View File

@ -1,3 +1,8 @@
if !has('patch-7.4.480')
" Before this patch, vim used modula2 for .md.
au! filetypedetect BufRead,BufNewFile *.md
endif
" markdown filetype file
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=markdown
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown

View File

@ -734,7 +734,7 @@ function! s:MarkdownHighlightSources(force)
let include = '@' . toupper(filetype)
endif
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) ? ' concealends' : '')
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
execute printf('syntax cluster mkdNonListItem add=%s', group)
let b:mkd_known_filetypes[ft] = 1

View File

@ -36,10 +36,14 @@ syn sync linebreaks=1
let s:conceal = ''
let s:concealends = ''
let s:concealcode = ''
if has('conceal') && get(g:, 'vim_markdown_conceal', 1)
let s:conceal = ' conceal'
let s:concealends = ' concealends'
endif
if has('conceal') && get(g:, 'vim_markdown_conceal_code_blocks', 1)
let s:concealcode = ' concealends'
endif
" additions to HTML groups
if get(g:, 'vim_markdown_emphasis_multiline', 1)
@ -94,13 +98,13 @@ syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
"define Markdown groups
syn match mkdLineBreak / \+$/
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!``/ skip=/[^`]`[^`]/ end=/\(\([^\\]\|^\)\\\)\@<!``/' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!\~\~/ end=/\(\([^\\]\|^\)\\\)\@<!\~\~/' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre[^>]*\\\@<!>" end="</pre>"' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code[^>]*\\\@<!>" end="</code>"' . s:concealends
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!``/ skip=/[^`]`[^`]/ end=/\(\([^\\]\|^\)\\\)\@<!``/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!\~\~/ end=/\(\([^\\]\|^\)\\\)\@<!\~\~/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre[^>]*\\\@<!>" end="</pre>"' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code[^>]*\\\@<!>" end="</code>"' . s:concealcode
syn region mkdFootnote start="\[^" end="\]"
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/

View File

@ -1,697 +0,0 @@
*SnipMate.txt* Plugin for using TextMate-style snippets in Vim.
SnipMate *snippet* *snippets* *SnipMate*
1. Description |SnipMate-description|
2. Usage |SnipMate-usage|
3. Interface and Settings |SnipMate-interface| |SnipMate-settings|
4. Snippets |SnipMate-snippets|
- Snippet files |SnipMate-snippet-files|
- Snippet syntax |SnipMate-syntax|
5. Snippet sources |SnipMate-snippet-sources|
6. Disadvantages to TextMate |SnipMate-disadvantages|
7. Contact |SnipMate-contact|
8. License |SnipMate-license|
For Vim version 7.0 or later.
This plugin only works if 'compatible' is not set.
{Vi does not have any of these features.}
SnipMate depends on vim-addon-mw-utils and tlib.
==============================================================================
DESCRIPTION *SnipMate-description*
SnipMate implements snippet features in Vim. A snippet is like a template,
reducing repetitive insertion of pieces of text. Snippets can contain
placeholders for modifying the text if necessary or interpolated code for
evaluation. For example, in C, typing "for" then pushing <Tab> could expand
to: >
for (i = 0; i < count; i++) {
/* code */
}
SnipMate is inspired by TextMate's snippet features.
==============================================================================
USAGE *SnipMate-usage*
Every snippet consists of an expansion and a trigger. Typing a trigger into
your buffer and then hitting your trigger key (<Tab> by default, see
|SnipMate-mappings|) will replace the trigger with the expansion text.
The expansion text can optionally include tab stops. When it does, upon
expansion of the snippet, the cursor is placed at the first one, and the user
can jump between each tab stop. Each of these tab stops can be represented by
default placeholder text. If such a placeholder is provided, then the text of
the placeholder can be repeated in the snippet at specified mirrors. Any edits
to the placeholder are instantly updated at every mirror.
SnipMate allows multiple snippets to use the same trigger. When triggered,
a list of all snippets with that trigger is provided and prompts for which
snippet to use.
*SnipMate-scopes*
SnipMate searches for snippets inside a directory named "snippets" inside each
entry in 'runtimepath'. Which files are loaded depends on 'filetype' and
'syntax'; see |SnipMate-syntax| for more information. Snippets are loaded and
refreshed automatically on demand.
Note: SnipMate does not ship with any snippets. In order to use it, the user
must either write their own snippets or obtain some from a repository like
https://github.com/honza/vim-snippets
==============================================================================
INTERFACE AND SETTINGS *SnipMate-interface* *SnipMate-settings*
*SnipMate-commands*
Commands~
*:SnipMateOpenSnippetFiles*
:SnipMateOpenSnippetFiles Opens a list of all valid snippet locations
based on the current scope |SnipMate-scopes|.
Only existing files and non-existing .snippets
files will be shown, with the existing files
shown first.
:SnipMateLoadScope[!] scope [scope ...]
Load snippets from additional scopes. Without
[!] the additional scopes are loaded only in
the current buffer. For example >
:SnipMateLoadScopes rails
< will load all rails.snippets in the current
buffer.
*SnipMate-options*
Options~
g:snips_author A variable used in some snippets in place of
the author's (your) name. Similar to
$TM_FULLNAME in TextMate. For example, >
snippet name
`g:snips_author`
< creates a snippet "name" that expands to your
name.
g:snipMate This |Dictionary| contains other SnipMate
options. In short add >
let g:snipMate = {}
< to your .vimrc before setting other SnipMate
options.
g:snipMate.scope_aliases A |Dictionary| associating certain filetypes
with other scopes |SnipMate-scopes|. The
entries consist of a filetype as the key and
a comma-separated list of aliases as the
value. For example, >
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['ruby']
\ = 'ruby,ruby-rails'
< tells SnipMate that "ruby-rails" snippets in
addition to "ruby" snippets should be loaded
when editing files with 'filetype' set to
"ruby" or contains "ruby" as an entry in the
case of dotted filetypes. A buffer local
variant b:snipMate_scope_aliases is merged
with the global variant.
g:snipMate_no_default_aliases Note: This has been renamed to the following.
g:snipMate.no_default_aliases
When set to 1, prevents SnipMate from loading
default scope aliases. The defaults are:
Filetype Alias ~
cpp c
cu c
eruby eruby-rails,html
html javascript
mxml actionscript
objc c
php php,html,javascript
ur html,javascript
xhtml html
Individual defaults can be disabled by setting
them to an empty value: >
let g:snipMate.scope_aliases.php = ''
< will disable the default PHP alias.
Note: Setting this option does not disable
scope aliases entirely, only those made by
SnipMate itself. Any scope aliases created by
the user or someone else will still be in
effect.
g:snipMate.snippet_version
The snippet parser version to use. The
possible values are:
0 Use the older parser
1 Use the newer parser
If unset, SnipMate defaults to version 0. The
value of this option is also used for all
.snippet files. See |SnipMate-parser-versions|
for more information.
g:snipMate.override
As detailed below, when two snippets with the
same name and description are loaded, both are
kept and differentiated by the location of the
file they were in. When this option is enabled
(set to 1), the snippet originating in the
last loaded file is kept, similar to how Vim
maps and other settings work. Note: Load order
is determined by 'runtimepath'.
g:snipMate.description_in_completion
If set to 1 (default is 0), snippet
descriptions will be included in the popup
menu used for snippet completion, like with
<Plug>snipMateShow.
g:snipMate['no_match_completion_feedkeys_chars']
A string inserted when no match for a trigger
is found. By default a tab is inserted
according to 'expandtab', 'tabstop', and
'softtabstop'. Set it to the empty string to
prevent anything from being inserted.
*SnipMate-mappings*
Mappings~
The mappings SnipMate uses can be customized with the |:map| commands. For
example, to change the key that triggers snippets and moves to the next
tab stop, >
:imap <C-J> <Plug>snipMateNextOrTrigger
:smap <C-J> <Plug>snipMateNextOrTrigger
Note: The noremap variants of the map commands must NOT be used.
The list of possible <Plug> mappings is as follows:
<Plug>snipMateNextOrTrigger Default: <Tab> Mode: Insert, Select
Jumps to the next tab stop or, if none exists,
try to expand a snippet. Use in both insert
and select modes.
<Plug>snipMateTrigger Default: unmapped Mode: Insert
Try to expand a snippet regardless of any
existing snippet expansion. If done within an
expanded snippet, the outer snippet's tab
stops are lost, unless expansion failed.
<Plug>snipMateBack Default: <S-Tab> Mode: Insert, Select
Jump to the previous tab stop, if it exists.
Use in both insert and select modes.
<Plug>snipMateShow Default: <C-R><Tab> Mode: Insert
Show all available snippets (that start with
the previous text, if it exists). Use in
insert mode.
<Plug>snipMateVisual Default: <Tab> Mode: Visual
See |SnipMate-visual|.
Additionally, <CR> is mapped in visual mode in .snippets files for retabbing
snippets.
==============================================================================
SNIPPETS *SnipMate-snippets*
*SnipMate-snippet-files*
Snippet Files ~
Note: SnipMate does not ship with any snippets.
SnipMate looks inside of each entry of 'rtp' (or |SnipMate-snippet-sources|)
for a directory named /snippets/. Based on the 'filetype' and 'syntax'
settings (dotted filetypes are parsed), the following files are read for
snippets: >
.../snippets/<scope>.snippets
.../snippets/<scope>_<name>.snippets
.../snippets/<scope>/<name>.snippets
.../snippets/<scope>/<trigger>.snippet
.../snippets/<scope>/<trigger>/<description>.snippet
where <scope> is a scope or 'filetype' or 'syntax', <name> is an arbitrary
name, <trigger> is the trigger for a snippet, and <description> is
a description used for |SnipMate-multisnip|.
A .snippet file defines a single snippet with the trigger (and description)
determined by the filename. The entire contents of the file are used as the
snippet expansion text.
Multiple snippets can be defined in *.snippets files. Each snippet definition
looks something like: >
snippet trigger optional description
expanded text
more expanded text
< *SnipMate-multisnip*
The description is optional. If it is left out, the description "default" is
used. When two snippets in the same scope have the same name and the same
description, SnipMate will try to preserve both. The g:snipMate.override
option disables this, in favor of keeping the last-loaded snippet. This can be
overridden on a per-snippet basis by defining the snippet with a bang (!): >
snippet! trigger optional description
expanded text
more expanded text
Two bangs will remove the trigger entirely from SnipMate's lookup. In this
case any snippet text is unused.
Note: Hard tabs in the expansion text are required. When the snippet is
expanded in the text and 'expandtab' is set, each tab will be replaced with
spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise.
SnipMate currently provides two versions for the snippet parser. The
differences between them can be found at |SnipMate-parser-versions|. Which
version parser the snippets in a file should be used with can be specified
with a version line, e.g.: >
version 1
Specification of a version applies to the snippets following it. Multiple
version specifications can appear in a single file to intermix version 0 and
version 1 snippets. The default is determined by the
g:snipMate.snippet_version option. |SnipMate-options|
Comments can be made in .snippets files by starting a line with a # character.
However these can't be used inside of snippet definitions: >
# this is a correct comment
snippet trigger
expanded text
snippet another_trigger
# this isn't a comment!
expanded text
This should hopefully be clear with the included syntax highlighting.
*SnipMate-extends*
Borrowing from UltiSnips, .snippets files can also contain an extends
directive, for example: >
extends html, javascript, css
will tell SnipMate to also read html, javascript, and css snippets.
SNIPPET SYNTAX *snippet-syntax* *SnipMate-syntax*
As mentioned above, there are two versions of the snippet parser. They are
selected by the g:snipMate.snippet_version option (|SnipMate-options|) or the
version directive in .snippets files. Differences will be mentioned throughout
with a summary at |SnipMate-parser-versions|.
Anywhere in a snippet, a backslash escapes the character following it,
regardless of whether that character is special or not. That is, '\a' will
always result in an 'a' in the output. A single backslash can be output by
using '\\'.
*SnipMate-tabstops*
Tab stops~
When triggering a snippet, SnipMate will by default jump to the very end of
the snippet text. This can be changed through the use of tab stops: $1, $2,
and so on. After expansion, SnipMate will jump to the first tab stop. From
then on, the <Plug>snipMateNextOrTrigger map will jump to the next higher
numbered tabs top.
In the case of an ambiguity, for example if a stop occurs just before
a literal number, braces may be placed around the stop number to resolve it:
${3}79 is the third tab stop followed by the string "79".
NOTE: In the version 0 snippet parser, the braces are mandatory.
*SnipMate-zero-tabstop*
SnipMate will always stop at the special zero tab stop $0. Once it jumps to
the zero tab stop, snippet expansion is finished. If the zero tab stop is not
present in a definition, it will be put at the end.
For example, to place the cursor first on the id of a <div> tag, then on its
class, and finally end editing its contents: >
snippet div
<div id="$1" class="$2">
$0
</div>
< *SnipMate-placeholders*
In addition to being simply a location, each tab stop contains a placeholder,
or some default text. The placeholder can be specified for every tab stop
(including the zero tab stop) with a colon after the stop ID, as in
${1:default text}. The braces are required only when specifying a placeholder.
Once a tab stop with a placeholder is reached, the placeholder will be
selected in |Select-mode|. For example, >
snippet div
<div id="${1:id}" class="${2:class}">
$0
</div>
Finally, placeholders can contain mirrors and evaluations (detailed below) and
even entire other tab stops. If the placeholder is edited, then these nested
tab stops are removed and skipped entirely. For example, >
snippet div
<div${1: id="${2:id}"}${3: class="${4:class}"}>
$0
</div>
When expanded, this snippet selects the entirety of the id attribute. If this
stop is edited, then the second tab stop is removed and the third tab stop
becomes the next one. If the first tab stop is left unedited, then SnipMate
jumps to the second tab stop. This allows the user to use a single div snippet
that can be used for instances where the id or class attributes are desired
and those where they are not.
*SnipMate-mirrors*
Mirrors~
A mirror is simply a copy of a tab stop's text, updated as the tab stop is
edited. These look like a tab stop without a placeholder; $1 for example. In
the event that no placeholder is specified for a certain tab stop--say $1--the
first instance becomes the tab stop and the rest become mirrors.
Additionally, in version 1 of the parser, substitutions similar to
|:substitute| can be performed. For instance ${1/foo/bar/g} will replace all
instances of "foo" in the $1 mirror with "bar". This uses |substitute()|
behind the scenes.
Note: Just like with tab stops, braces can be used to avoid ambiguities: ${1}2
is a mirror of the first tab stop followed by a 2. Version 0 of the snippet
parser offers no way to resolve such ambiguities. Version 0 also requires that
a tabstop have a placeholder before its mirrors work.
As an example, >
snippet for
for ($1 = ${2:start}; ${1:i} < ${3:end}; $1${4:++}) {
${0:/* code */}
}
< *SnipMate-eval*
Expression Evaluation~
Snippets can contain Vim script expressions that are evaluated as the snippet
is expanded. Expressions are specified inside backticks: >
snippet date
`strftime("%Y-%m-%d")`
If the expression results in any Vim error, the error will be displayed (or
found in :messages) and the result of the expression will be the empty string.
Filename([{expr}] [, {defaultText}]) *SnipMate-Filename()*
Since the current filename is used often in snippets, a default function
has been defined for it in SnipMate.vim, appropriately called Filename().
With no arguments, the default filename without an extension is returned;
the first argument specifies what to place before or after the filename,
and the second argument supplies the default text to be used if the file
has not been named. "$1" in the first argument is replaced with the filename;
if you only want the filename to be returned, the first argument can be left
blank. Examples: >
snippet filename
`Filename()`
snippet filename_with_default
`Filename('', 'name')`
snippet filename_foo
`Filename('$1_foo')`
The first example returns the filename if it the file has been named, and an
empty string if it hasn't. The second returns the filename if it's been named,
and "name" if it hasn't. The third returns the filename followed by "_foo" if
it has been named, and an empty string if it hasn't.
*SnipMate-visual*
The VISUAL Stop~
While tab stops have numeric IDs, a special one exists with the ID 'VISUAL'.
When a snippet is expanded, if any text had been grabbed with the
snipMateVisual mapping (see |SnipMate-mappings|), all instances of the VISUAL
stop will be replaced with it. Both transformations as well as a default
placeholder can be used with the VISUAL stop.
Note: Both $VISUAL and ${VISUAL} are valid in version 1 of the snippet parser.
In version 0, only {VISUAL} is valid (without the $), and neither
transformations nor a default placeholder can be used.
Example: >
snippet div
<div>
${0:${VISUAL:<!-- content -->}}
</div>
<
*SnipMate-parser-versions*
Parser Versions~
SnipMate provides two versions for its snippet parser. Version 0 is the legacy
regex based version and is updated sparingly. Version 1 is the revamped
version with new features. Any newly developed features will likely only be
available to version 1 users.
Which version is used is determined by version directives in snippet files
(|SnipMate-snippet-files|) and by the g:snipMate.snippet_version option
(|SnipMate-options|).
A complete list of current differences is as follows:
- Backslash escaping is guaranteed to work in version 1. In certain edge cases
this may not work in version 0.
- Certain syntactic errors, such as a missing closing brace for a tabstop, are
more gracefully handled in version 1. In most cases, the parser will either
discard the error or, as in the previous example, end an item at the end of
line. Version 0 may not be predictable in this regard.
- Braces are not mandatory in version 1. SnipMate will determine which
instance of a stop ID to use based on the presence of a placeholder, or
whichever instance occurs first. Braces can therefore be used to
disambiguate between stop 12, $12, and stop 1 followed by a 2, ${1}2. In
other words, version 0 makes a distinction between a mirror and a stop while
version 1 resolves the differences for you.
- Placeholders are not mandatory to enable mirror support in version 1.
- Version 0 uses the confusing syntax {VISUAL} to refer to visual content.
Version 1 treats it as just another stop ID, so both $VISUAL and ${VISUAL}
work. Plus version 1 allows a default value in case no visual selection has
been made.
- Transformations similar to |:substitute| can be preformed on any mirror,
including visual content.
==============================================================================
SNIPPET SOURCES *SnipMate-snippet-sources*
SnipMate is configurable.
plugin/SnipMate.vim assigns a couple important keys: >
" default implementation collecting snippets by handlers
let g:SnipMate['get_snippets'] = SnipMate#GetSnippets
" default handler:
let g:SnipMateSources['default'] = SnipMate#DefaultPool
You can override both of those settings.
You can see that the default set of snippets is determined by Vim's 'rtp'.
Example 1:~
autoload/SnipMate_python_demo.vim shows how you can register additional
sources such as creating snippets on the fly representing python function
definitions found in the current file.
Example 2:~
Add to your ~/.vimrc: For each know snippet add a second version ending in _
adding folding markers >
let g:commentChar = {
\ 'vim': '"',
\ 'c': '//',
\ 'cpp': '//',
\ 'sh': '#',
\ 'python': '#'
\ }
" url https://github.com/garbas/vim-snipmate/issues/49
fun! AddFolding(text)
return substitute(a:text,'\n'," ".g:commentChar[&ft]." {{{\n",1)."\n".g:commentChar[&ft]." }}}"
endf
fun! SnippetsWithFolding(scopes, trigger, result)
" hacky: temporarely remove this function to prevent infinite recursion:
call remove(g:SnipMateSources, 'with_folding')
" get list of snippets:
let result = SnipMate#GetSnippets(a:scopes, substitute(a:trigger,'_\(\*\)\?$','\1',''))
let g:SnipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding')
" add folding:
for k in keys(result)
let a:result[k.'_'] = map(result[k],'AddFolding(v:val)')
endfor
endf
" force setting default:
runtime plugin/SnipMate.vim
" add our own source
let g:SnipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding')
See |SnipMate-syntax| for more details about all possible relative locations
to 'rtp' can be found in.
==============================================================================
KNOWN ISSUES *SnipMate-known-issues*
SnipMate.vim currently has the following disadvantages to TextMate's snippets:
- Placeholders cannot span multiple lines.
- Activating snippets in different scopes of the same file is
not possible.
- Vim formatting with fo=t or fo=a can mess up SnipMate.
Perhaps some of these features will be added in a later release.
==============================================================================
CHANGELOG *SnipMate-changelog*
0.89 - 2016-05-29
-----------------
* Various regex updates to legacy parser Addition of double bang syntax to
* completely remove a snippet from lookup Group various SnipMate autocommands
* Support setting 'shiftwidth' to 0 Parser now operates linewise, adding some
* flexibility Mirror substitutions are more literal Mirror length is
* calculated correctly when substitutions occur
0.88 - 2015-04-04
-----------------
* Implement simple caching
* Remove expansion guards
* Add `:SnipMateLoadScope` command and buffer-local scope aliases
* Load `<scope>_*.snippets` files
* Use CursorMoved autocmd events entirely
* The nested branch has been merged
* A new snippet parser has been added. The g:snipmate.version as well as
version lines in snippet files determines which is used
* The new parser supports tab stops placed within placeholders,
substitutions, non-consecutive stop numbers, and fewer ambiguities
* The stop jumping code has been updated
* Tests have been added for the jumping code and the new parser
* The override branch has been merged
* The g:snipMate.override option is added. When enabled, if two snippets
share the same name, the later-loaded one is kept and the other discarded
* Override behavior can be enabled on a per-snippet basis with a bang (!) in
the snippet file
* Otherwise, SnipMate tries to preserve all snippets loaded
* Fix bug with mirrors in the first column
* Fix bug with tabs in indents
<http://github.com/garbas/vim-snipmate/issues/143>
* Fix bug with mirrors in placeholders
* Fix reading single snippet files
* Fix the use of the visual map at the end of a line
* Fix expansion of stops containing only the zero tab stop
* Remove select mode mappings
* Indent visual placeholder expansions and remove extraneous lines
<http://github.com/garbas/vim-snipmate/issues/177>
<http://github.com/garbas/vim-snipmate/issues/178>
0.87 - 2014-01-04
-----------------
* Stop indenting empty lines when expanding snippets
* Support extends keyword in .snippets files
* Fix visual placeholder support
* Add zero tabstop support
* Support negative 'softtabstop'
* Add g:snipMate_no_default_aliases option
* Add <Plug>snipMateTrigger for triggering an expansion inside a snippet
* Add snipMate#CanBeTriggered() function
0.86 - 2013-06-15
-----------------
* Use more idiomatic <Plug> maps
* Remove most select mode mappings
* Fix disappearing variables bug (hpesoj)
* Fix cursor position bug when a variable is on the same line as the stop
* Fix undo point creation causing problems with Supertab
* Fix bug where SnipMate would use a typed trigger as a regular expression
0.85 - 2013-04-03
-----------------
* Allow trigger key customization
* Enable undoing of snippet expansion
* Support backslash escaping in snippets
* Add support for {VISUAL}
* Expand filetype extension with scope_aliases
* Add expansion guards
* Enable per-buffer expansion of snippets
* Fix 'cpo' compatibility
* Update supertab compatibility
* Enable customization of various things through g:SnipMate
* Disable spelling in snippet files
* Highlight trigger names in .snippets files
* Update many snippets
* Separate sample snippets into separate repository
0.84
----
* Unreleased version by Michael Sanders, available on his GitHub,
<https://github.com/msanders/snipmate.vim>
0.83 - 2009-07-13
-----------------
* Last release done by Michael Sanders, available at
<http://www.vim.org/scripts/script.php?script_id=2540>
==============================================================================
CONTACT *SnipMate-contact* *SnipMate-author*
SnipMate is currently maintained by:
- Rok Garbas
- Marc Weber (marco-oweber@gmx.de)
- Adnan Zafar
For bug reports, issues, or questions, check out the Issues page on GitHub:
https://github.com/garbas/vim-snipmate/issues
The original author, Michael Sanders, can be reached at:
msanders42+snipmate <at> gmail <dot> com
==============================================================================
LICENSE *SnipMate-license*
SnipMate is released under the MIT license:
Copyright 2009-2010 Michael Sanders. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyright holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the software or the use or other dealings in the
software.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -28,7 +28,7 @@ snippet fmt "format!(..)"
format!("$1"${2/..*/, /}$2);
endsnippet
snippet it ".iter()" i
snippet .it ".iter()" i
.iter()$0
endsnippet

View File

@ -1,3 +1,7 @@
" File : basic.vim
" License: MIT
" Author : Xinyue Ou <xinyue3ou@gmail.com>
" Date : 06.01.2019
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic — @amix3k
@ -139,7 +143,7 @@ if $COLORTERM == 'gnome-terminal'
endif
try
colorscheme desert
colorscheme solarized
catch
endtry
@ -380,3 +384,12 @@ function! VisualSelection(direction, extra_filter) range
let @/ = l:pattern
let @" = l:saved_reg
endfunction
" fix meta-keys which generate <Esc>a .. <Esc>z
let c='a'
while c <= 'z'
exec "set <M-".toupper(c).">=\e".c
exec "imap \e".c." <M-".toupper(c).">"
let c = nr2char(1+char2nr(c))
endw

View File

@ -1,3 +1,7 @@
" File : extended.vim
" License: MIT
" Author : Xinyue Ou <xinyue3ou@gmail.com>
" Date : 06.01.2019
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Important:
" This requries that you install https://github.com/amix/vimrc !
@ -28,8 +32,8 @@ set guioptions-=l
set guioptions-=L
" Colorscheme
set background=dark
colorscheme peaksea
" set background=dark
" colorscheme peaksea
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""