aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt25
-rw-r--r--runtime/autoload/phpcomplete.vim74
-rw-r--r--runtime/autoload/provider/clipboard.vim14
-rw-r--r--runtime/autoload/provider/script_host.py25
-rw-r--r--runtime/autoload/tutor.vim346
-rw-r--r--runtime/doc/editing.txt26
-rw-r--r--runtime/doc/eval.txt109
-rw-r--r--runtime/doc/indent.txt2
-rw-r--r--runtime/doc/nvim.txt24
-rw-r--r--runtime/doc/nvim_from_vim.txt49
-rw-r--r--runtime/doc/nvim_intro.txt26
-rw-r--r--runtime/doc/nvim_python.txt2
-rw-r--r--runtime/doc/options.txt35
-rw-r--r--runtime/doc/pi_tutor.txt50
-rw-r--r--runtime/doc/syntax.txt3
-rw-r--r--runtime/doc/todo.txt97
-rw-r--r--runtime/doc/usr_01.txt42
-rw-r--r--runtime/doc/usr_02.txt2
-rw-r--r--runtime/doc/windows.txt10
-rw-r--r--runtime/filetype.vim9
-rw-r--r--runtime/ftplugin/tutor.vim43
-rw-r--r--runtime/indent/php.vim87
-rw-r--r--runtime/macros/editexisting.vim4
-rw-r--r--runtime/plugin/tutor.vim6
-rw-r--r--runtime/syntax/tutor.vim83
-rw-r--r--runtime/syntax/vimnormal.vim16
-rw-r--r--runtime/syntax/zimbu.vim64
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor955
-rw-r--r--runtime/tutor/tutor.tutor259
29 files changed, 2257 insertions, 230 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 6efd876d4f..4e39fcfbe5 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -39,6 +39,7 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
-u NONE
-i NONE
-esX
+ --headless
-c "helptags ++t ."
-c quit
DEPENDS
@@ -61,18 +62,30 @@ add_custom_target(
# If it's preexisting, leave it alone.
install_helper(
- DIRECTORY ${PROJECT_SOURCE_DIR}/runtime
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim)
+ FILES ${GENERATED_HELP_TAGS} ${BUILDDOCFILES}
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/doc)
+
install_helper(
- DIRECTORY ${GENERATED_RUNTIME_DIR}
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim)
+ FILES ${GENERATED_SYN_VIM}
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/syntax/vim)
file(GLOB_RECURSE RUNTIME_PROGRAMS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- *.awk *.sh)
+ *.awk *.sh *.bat)
foreach(PROG ${RUNTIME_PROGRAMS})
get_filename_component(BASEDIR ${PROG} PATH)
install_helper(PROGRAMS ${PROG}
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/${BASEDIR})
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
+endforeach()
+
+file(GLOB_RECURSE RUNTIME_FILES
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ *.vim *.dict *.py *.ps *.tutor)
+list(APPEND RUNTIME_FILES macros/dvorak)
+
+foreach(F ${RUNTIME_FILES})
+ get_filename_component(BASEDIR ${F} PATH)
+ install_helper(FILES ${F}
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
endforeach()
diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim
index b014b4cdcf..5ddad88873 100644
--- a/runtime/autoload/phpcomplete.vim
+++ b/runtime/autoload/phpcomplete.vim
@@ -3,7 +3,7 @@
" Maintainer: Dávid Szabó ( complex857 AT gmail DOT com )
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" URL: https://github.com/shawncplus/phpcomplete.vim
-" Last Change: 2014 Oct 02
+" Last Change: 2014 Dec 01
"
" OPTIONS:
"
@@ -1172,11 +1172,11 @@ function! phpcomplete#GetCurrentInstruction(line_number, col_number, phpbegin) "
" break if we are on a "naked" stop_char (operators, colon, openparent...)
if index(stop_chars, current_char) != -1
let do_break = 1
- " dont break does not look like a "->"
+ " dont break if it does look like a "->"
if (prev_char == '-' && current_char == '>') || (current_char == '-' && next_char == '>')
let do_break = 0
endif
- " dont break if its looks like a "::"
+ " dont break if it does look like a "::"
if (prev_char == ':' && current_char == ':') || (current_char == ':' && next_char == ':')
let do_break = 0
endif
@@ -1356,8 +1356,12 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat
endif
" make @return self, static, $this the same way
" (not exactly what php means by these)
- if returnclass == 'self' || returnclass == 'static' || returnclass == '$this'
- let classname_candidate = a:classname_candidate
+ if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' || returnclass == 'self[]' || returnclass == 'static[]' || returnclass == '$this[]'
+ if returnclass =~ '\[\]$'
+ let classname_candidate = a:classname_candidate.'[]'
+ else
+ let classname_candidate = a:classname_candidate
+ endif
let class_candidate_namespace = a:class_candidate_namespace
else
let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(returnclass, fullnamespace, a:imports)
@@ -1527,7 +1531,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
let function_boundary = phpcomplete#GetCurrentFunctionBoundaries()
let search_end_line = max([1, function_boundary[0][0]])
" -1 makes us ignore the current line (where the completion was invoked
- let lines = reverse(getline(search_end_line, line('.') - 1))
+ let lines = reverse(getline(search_end_line, a:start_line - 1))
" check Constant lookup
let constant_object = matchstr(a:context, '\zs'.class_name_pattern.'\ze::')
@@ -1638,9 +1642,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
" assignment for the variable in question with a variable on the right hand side
if line =~# '^\s*'.object.'\s*=&\?\s*'.variable_name_pattern
- let tailing_semicolon = match(line, ';\s*$')
- let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i))
- let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin)
+
+ " try to find the next non-comment or string ";" char
+ let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s*'.variable_name_pattern)
+ let filelines = reverse(lines)
+ let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col])
+ let chars_read = 1
+ " read while end of the file
+ while char != 'EOF' && chars_read < 1000
+ let last_pos = pos
+ let [pos, char] = s:getNextCharWithPos(filelines, pos)
+ let chars_read += 1
+ " we got a candidate
+ if char == ';'
+ let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name')
+ " it's not a comment or string, end search
+ if synIDName !~? 'comment\|string'
+ break
+ endif
+ endif
+ endwhile
+
+ let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin)
+ if prev_context == ''
+ " cannot get previous context give up
+ return
+ endif
let prev_class = phpcomplete#GetClassName(a:start_line - i, prev_context, a:current_namespace, a:imports)
if stridx(prev_class, '\') != -1
@@ -1656,9 +1683,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
" assignment for the variable in question with a function on the right hand side
if line =~# '^\s*'.object.'\s*=&\?\s*'.function_invocation_pattern
- let tailing_semicolon = match(line, ';\s*$')
- let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i))
- let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin)
+
+ " try to find the next non-comment or string ";" char
+ let start_col = match(line, '\C^\s*'.object.'\s*=\zs&\?\s*'.function_invocation_pattern)
+ let filelines = reverse(lines)
+ let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col])
+ let chars_read = 1
+ " read while end of the file
+ while char != 'EOF' && chars_read < 1000
+ let last_pos = pos
+ let [pos, char] = s:getNextCharWithPos(filelines, pos)
+ let chars_read += 1
+ " we got a candidate
+ if char == ';'
+ let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name')
+ " it's not a comment or string, end search
+ if synIDName !~? 'comment\|string'
+ break
+ endif
+ endif
+ endwhile
+
+ let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin)
+ if prev_context == ''
+ " cannot get previous context give up
+ return
+ endif
let function_name = matchstr(prev_context, '^'.function_invocation_pattern.'\ze')
let function_name = matchstr(function_name, '^\zs.\+\ze\s*($') " strip the trailing (
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index d20b3a9bf1..5d1ce7896d 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -55,13 +55,21 @@ endif
let s:clipboard = {}
function! s:clipboard.get(reg)
- if s:selections[a:reg].owner > 0
- return s:selections[a:reg].data
+ let reg = a:reg == '"' ? '+' : a:reg
+ if s:selections[reg].owner > 0
+ return s:selections[reg].data
end
- return s:try_cmd(s:paste[a:reg])
+ return s:try_cmd(s:paste[reg])
endfunction
function! s:clipboard.set(lines, regtype, reg)
+ if a:reg == '"'
+ call s:clipboard.set(a:lines,a:regtype,'+')
+ if s:copy['*'] != s:copy['+']
+ call s:clipboard.set(a:lines,a:regtype,'*')
+ end
+ return 0
+ end
if s:cache_enabled == 0
call s:try_cmd(s:copy[a:reg], a:lines)
return 0
diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py
index 0a7eb53a0e..96d70e0330 100644
--- a/runtime/autoload/provider/script_host.py
+++ b/runtime/autoload/provider/script_host.py
@@ -17,6 +17,9 @@ IS_PYTHON3 = sys.version_info >= (3, 0)
if IS_PYTHON3:
basestring = str
+ if sys.version_info >= (3, 4):
+ from importlib.machinery import PathFinder
+
@neovim.plugin
class ScriptHost(object):
@@ -190,31 +193,35 @@ def path_hook(nvim):
name = oldtail[:idx]
tail = oldtail[idx+1:]
fmr = imp.find_module(name, path)
- module = imp.load_module(fullname[:-len(oldtail)] + name, *fmr)
+ module = imp.find_module(fullname[:-len(oldtail)] + name, *fmr)
return _find_module(fullname, tail, module.__path__)
else:
- fmr = imp.find_module(fullname, path)
- return imp.load_module(fullname, *fmr)
+ return imp.find_module(fullname, path)
class VimModuleLoader(object):
def __init__(self, module):
self.module = module
def load_module(self, fullname, path=None):
- return self.module
+ # Check sys.modules, required for reload (see PEP302).
+ if fullname in sys.modules:
+ return sys.modules[fullname]
+ return imp.load_module(fullname, *self.module)
class VimPathFinder(object):
- @classmethod
- def find_module(cls, fullname, path=None):
+ @staticmethod
+ def find_module(fullname, path=None):
+ "Method for Python 2.7 and 3.3."
try:
return VimModuleLoader(
_find_module(fullname, fullname, path or _get_paths()))
except ImportError:
return None
- @classmethod
- def load_module(cls, fullname, path=None):
- return _find_module(fullname, fullname, path or _get_paths())
+ @staticmethod
+ def find_spec(fullname, path=None, target=None):
+ "Method for Python 3.4+."
+ return PathFinder.find_spec(fullname, path or _get_paths(), target)
def hook(path):
if path == nvim.VIM_SPECIAL_PATH:
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
new file mode 100644
index 0000000000..d2881f7f34
--- /dev/null
+++ b/runtime/autoload/tutor.vim
@@ -0,0 +1,346 @@
+" vim: fdm=marker et ts=4 sw=4
+
+" Setup: {{{1
+function! tutor#SetupVim()
+ if has('syntax')
+ if !exists('g:syntax_on') || g:syntax_on == 0
+ syntax on
+ endif
+ endif
+endfunction
+
+" Mappings: {{{1
+
+function! s:CheckMaps()
+ nmap
+endfunction
+
+function! s:MapKeyWithRedirect(key, cmd)
+ if maparg(a:key) !=# ''
+ redir => l:keys
+ silent call s:CheckMaps()
+ redir END
+ let l:key_list = split(l:keys, '\n')
+
+ let l:raw_map = filter(copy(l:key_list), "v:val =~# '\\* ".a:key."'")
+ if len(l:raw_map) == 0
+ exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd
+ return
+ endif
+ let l:map_data = split(l:raw_map[0], '\s*')
+
+ exe "nnoremap <buffer> <expr> ".l:map_data[0]." ".a:cmd
+ else
+ exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd
+ endif
+endfunction
+
+function! tutor#MouseDoubleClick()
+ if foldclosed(line('.')) > -1
+ normal! zo
+ else
+ if match(getline('.'), '^#\{1,} ') > -1
+ normal! zc
+ else
+ call tutor#FollowLink(0)
+ endif
+ endif
+endfunction
+
+function! tutor#InjectCommand()
+ let l:cmd = substitute(getline('.'), '^\s*', '', '')
+ exe l:cmd
+ redraw | echohl WarningMsg | echon "tutor: ran" | echohl None | echon " " | echohl Statement | echon l:cmd
+endfunction
+
+function! tutor#SetNormalMappings()
+ call s:MapKeyWithRedirect('l', 'tutor#ForwardSkipConceal(v:count1)')
+ call s:MapKeyWithRedirect('h', 'tutor#BackwardSkipConceal(v:count1)')
+ call s:MapKeyWithRedirect('<right>', 'tutor#ForwardSkipConceal(v:count1)')
+ call s:MapKeyWithRedirect('<left>', 'tutor#BackwardSkipConceal(v:count1)')
+
+ nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr>
+ nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr>
+ nnoremap <buffer> >> :call tutor#InjectCommand()<cr>
+endfunction
+
+function! tutor#SetSampleTextMappings()
+ noremap <silent> <buffer> A :if match(getline('.'), '^--->') > -1 \| call search('\s{\@=', 'Wc') \| startinsert \| else \| startinsert! \| endif<cr>
+ noremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr>
+ onoremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr>
+ noremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr>
+ onoremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr>
+ nmap <silent> <buffer> 0 ^<esc>
+ nmap <silent> <buffer> <Home> ^<esc>
+ nmap <silent> <buffer> <End> $
+ imap <silent> <buffer> <Home> <esc>^<esc>:startinsert<cr>
+ imap <silent> <buffer> <End> <esc>$:startinsert<cr>
+ noremap <silent> <buffer> I :exe "normal! 0" \| startinsert<cr>
+endfunction
+
+" Navigation: {{{1
+
+" taken from http://stackoverflow.com/a/24224578
+
+function! tutor#ForwardSkipConceal(count)
+ let cnt=a:count
+ let mvcnt=0
+ let c=col('.')
+ let l=line('.')
+ let lc=col('$')
+ let line=getline('.')
+ while cnt
+ if c>=lc
+ let mvcnt+=cnt
+ break
+ endif
+ if stridx(&concealcursor, 'n')==-1
+ let isconcealed=0
+ else
+ let [isconcealed, cchar, group] = synconcealed(l, c)
+ endif
+ if isconcealed
+ let cnt-=strchars(cchar)
+ let oldc=c
+ let c+=1
+ while c < lc
+ let [isconcealed2, cchar2, group2] = synconcealed(l, c)
+ if !isconcealed2 || cchar2 != cchar
+ break
+ endif
+ let c+= 1
+ endwhile
+ let mvcnt+=strchars(line[oldc-1:c-2])
+ else
+ let cnt-=1
+ let mvcnt+=1
+ let c+=len(matchstr(line[c-1:], '.'))
+ endif
+ endwhile
+ return mvcnt.'l'
+endfunction
+
+function! tutor#BackwardSkipConceal(count)
+ let cnt=a:count
+ let mvcnt=0
+ let c=col('.')
+ let l=line('.')
+ let lc=0
+ let line=getline('.')
+ while cnt
+ if c<=1
+ let mvcnt+=cnt
+ break
+ endif
+ if stridx(&concealcursor, 'n')==-1 || c == 0
+ let isconcealed=0
+ else
+ let [isconcealed, cchar, group]=synconcealed(l, c-1)
+ endif
+ if isconcealed
+ let cnt-=strchars(cchar)
+ let oldc=c
+ let c-=1
+ while c>1
+ let [isconcealed2, cchar2, group2] = synconcealed(l, c-1)
+ if !isconcealed2 || cchar2 != cchar
+ break
+ endif
+ let c-=1
+ endwhile
+ let c = max([c, 1])
+ let mvcnt+=strchars(line[c-1:oldc-2])
+ else
+ let cnt-=1
+ let mvcnt+=1
+ let c-=len(matchstr(line[:c-2], '.$'))
+ endif
+ endwhile
+ return mvcnt.'h'
+endfunction
+
+" Hypertext: {{{1
+
+function! tutor#FollowLink(force)
+ let l:stack_s = join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '')
+ if l:stack_s =~# 'tutorLink'
+ let l:link_start = searchpairpos('\[', '', ')', 'nbcW')
+ let l:link_end = searchpairpos('\[', '', ')', 'ncW')
+ if l:link_start[0] == l:link_end[0]
+ let l:linkData = getline(l:link_start[0])[l:link_start[1]-1:l:link_end[1]-1]
+ else
+ return
+ endif
+ let l:target = matchstr(l:linkData, '(\@<=.*)\@=')
+ if a:force != 1 && match(l:target, '\*.\+\*') > -1
+ call cursor(l:link_start[0], l:link_end[1])
+ call search(l:target, '')
+ normal! ^
+ elseif a:force != 1 && match(l:target, '^@tutor:') > -1
+ let l:tutor = matchstr(l:target, '@tutor:\zs.*')
+ exe "Tutor ".l:tutor
+ else
+ exe "help ".l:target
+ endif
+ endif
+endfunction
+
+" Folding And Info: {{{1
+
+function! tutor#TutorFolds()
+ if getline(v:lnum) =~# '^#\{1,6}'
+ return ">". len(matchstr(getline(v:lnum), '^#\{1,6}'))
+ else
+ return "="
+ endif
+endfunction
+
+function! tutor#InfoText()
+ let l:info_parts = []
+ if exists('b:tutor_infofunc')
+ call add(l:info_parts, eval(b:tutor_infofunc.'()'))
+ endif
+ return join(l:info_parts, " ")
+endfunction
+
+" Marks {{{1
+function! tutor#PlaceXMarks()
+ call cursor(1, 1)
+ let b:tutor_sign_id = 1
+ while search('^--->', 'W') > 0
+ call tutor#CheckText(getline('.'))
+ let b:tutor_sign_id+=1
+ endwhile
+ call cursor(1, 1)
+endfunction
+
+function! tutor#CheckText(text)
+ if match(a:text, '{expect:ANYTHING}\s*$') == -1
+ if match(getline('.'), '^--->\s*$') > -1
+ exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%')
+ else
+ if match(getline('.'), '|expect:.\+|') == -1
+ let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze {expect:')
+ let l:expected_text = matchstr(a:text, '{expect:\zs.*\ze}\s*$')
+ else
+ let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze |expect:')
+ let l:expected_text = matchstr(a:text, '|expect:\zs.*\ze|\s*$')
+ endif
+ if l:cur_text ==# l:expected_text
+ exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorok buffer=".bufnr('%')
+ else
+ exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%')
+ endif
+ endif
+ endif
+endfunction
+
+function! tutor#OnTextChanged()
+ let l:text = getline('.')
+ if match(l:text, '^--->') > -1
+ call tutor#CheckText(l:text)
+ endif
+endfunction
+
+" Tutor Cmd: {{{1
+
+function! s:Locale()
+ let l:lang = ""
+ if exists('v:lang') && v:lang =~ '\a\a'
+ let l:lang = v:lang
+ elseif $LC_ALL =~ '\a\a'
+ let l:lang = $LC_ALL
+ elseif $LANG =~ '\a\a'
+ let l:lang = $LANG
+ endif
+ return split(l:lang, '_')
+endfunction
+
+function! s:GlobPath(lp, pat)
+ if version >= 704 && has('patch279')
+ return globpath(a:lp, a:pat, 1, 1)
+ else
+ return split(globpath(a:lp, a:pat, 1), '\n')
+ endif
+endfunction
+
+function! s:Sort(a, b)
+ let mod_a = fnamemodify(a:a, ':t')
+ let mod_b = fnamemodify(a:b, ':t')
+ if mod_a == mod_b
+ let retval = 0
+ elseif mod_a > mod_b
+ if match(mod_a, '^vim-') > -1 && match(mod_b, '^vim-') == -1
+ let retval = -1
+ else
+ let retval = 1
+ endif
+ else
+ if match(mod_b, '^vim-') > -1 && match(mod_a, '^vim-') == -1
+ let retval = 1
+ else
+ let retval = -1
+ endif
+ endif
+ return retval
+endfunction
+
+function! s:GlobTutorials(name)
+ " search for tutorials:
+ " 1. non-localized
+ let l:tutors = s:GlobPath(&rtp, 'tutor/'.a:name.'.tutor')
+ " 2. localized for current locale
+ let l:locale_tutors = s:GlobPath(&rtp, 'tutor/'.s:Locale()[0].'/'.a:name.'.tutor')
+ " 3. fallback to 'en'
+ if len(l:locale_tutors) == 0
+ let l:locale_tutors = s:GlobPath(&rtp, 'tutor/en/'.a:name.'.tutor')
+ endif
+ call extend(l:tutors, l:locale_tutors)
+ return uniq(sort(l:tutors, 's:Sort'), 's:Sort')
+endfunction
+
+function! tutor#TutorCmd(tutor_name)
+ if match(a:tutor_name, '[[:space:]]') > 0
+ echom "Only one argument accepted (check spaces)"
+ return
+ endif
+
+ if a:tutor_name == ''
+ let l:tutor_name = 'vim-01-beginner.tutor'
+ else
+ let l:tutor_name = a:tutor_name
+ endif
+
+ if match(l:tutor_name, '\.tutor$') > 0
+ let l:tutor_name = fnamemodify(l:tutor_name, ':r')
+ endif
+
+ let l:tutors = s:GlobTutorials(l:tutor_name)
+
+ if len(l:tutors) == 0
+ echom "No tutorial with that name found"
+ return
+ endif
+
+ if len(l:tutors) == 1
+ let l:to_open = l:tutors[0]
+ else
+ let l:idx = 0
+ let l:candidates = ['Several tutorials with that name found. Select one:']
+ for candidate in map(copy(l:tutors),
+ \'fnamemodify(v:val, ":h:h:t")."/".s:Locale()[0]."/".fnamemodify(v:val, ":t")')
+ let l:idx += 1
+ call add(l:candidates, l:idx.'. '.candidate)
+ endfor
+ let l:tutor_to_open = inputlist(l:candidates)
+ let l:to_open = l:tutors[l:tutor_to_open-1]
+ endif
+
+ exe "edit ".l:to_open
+endfunction
+
+function! tutor#TutorCmdComplete(lead,line,pos)
+ let l:tutors = s:GlobTutorials('*')
+ let l:names = uniq(sort(map(l:tutors, 'fnamemodify(v:val, ":t:r")'), 's:Sort'))
+ return join(l:names, "\n")
+endfunction
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 63c27b2ff2..bb3d89e4ac 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -569,7 +569,10 @@ list of the current window.
Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
- Add the {name}s to the argument list.
+:[count]arga[dd]
+ Add the {name}s to the argument list. When {name} is
+ omitted add the current buffer name to the argument
+ list.
If [count] is omitted, the {name}s are added just
after the current entry in the argument list.
Otherwise they are added after the [count]'th file.
@@ -579,7 +582,8 @@ list of the current window.
:argadd x a b x c
:0argadd x x a b c
:1argadd x a x b c
- :99argadd x a b c x
+ :$argadd x a b c x
+ :+2argadd y a b c x y
There is no check for duplicates, it is possible to
add a file to the argument list twice.
The currently edited file is not changed.
@@ -597,11 +601,19 @@ list of the current window.
Example: >
:argdel *.obj
-:{range}argd[elete] Delete the {range} files from the argument list.
+:[range]argd[elete] Delete the {range} files from the argument list.
+ Example: >
+ :10,$argdel
+< Deletes arguments 10 and further, keeping 1-9. >
+ :$argd
+< Deletes just the last one. >
+ :argd
+ :.argd
+< Deletes the current argument. >
+ :%argd
+< Removes all the files from the arglist.
When the last number in the range is too high, up to
- the last argument is deleted. Example: >
- :10,1000argdel
-< Deletes arguments 10 and further, keeping 1-9.
+ the last argument is deleted.
*:argu* *:argument*
:[count]argu[ment] [count] [++opt] [+cmd]
@@ -1018,7 +1030,7 @@ The names can be in upper- or lowercase.
:q[uit]! Quit without writing, also when currently visible
buffers have changes. Does not exit when this is the
- last window and there are is a changed hidden buffer.
+ last window and there is a changed hidden buffer.
In this case, the first changed hidden buffer becomes
the current buffer.
Use ":qall!" to exit always.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 61b23b7e03..5c2b570695 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2014 Nov 15
+*eval.txt* For Vim version 7.4. Last change: 2014 Nov 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1517,6 +1517,12 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|.
This is the screen column number, like with |virtcol()|. The
value is zero when there was no mouse button click.
+ *v:msgpack_types* *msgpack_types-variable*
+v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()|
+ and |msgpackdump()|. All types inside dictionary are fixed
+ (not editable) empty lists. To check whether some list is one
+ of msgpack types, use |is| operator.
+
*v:oldfiles* *oldfiles-variable*
v:oldfiles List of file names that is loaded from the |viminfo| file on
startup. These are the files that Vim remembers marks for.
@@ -1904,6 +1910,8 @@ min( {list}) Number minimum value of items in {list}
mkdir( {name} [, {path} [, {prot}]])
Number create directory {name}
mode( [expr]) String current editing mode
+msgpackdump( {list}) List dump a list of objects to msgpack
+msgpackparse( {list}) List parse msgpack to a list of objects
nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
or( {expr}, {expr}) Number bitwise OR
@@ -3303,6 +3311,17 @@ getchar([expr]) *getchar()*
: endif
: endwhile
:endfunction
+<
+ You may also receive syntetic characters, such as
+ |<CursorHold>|. Often you will want to ignore this and get
+ another character: >
+ :function GetKey()
+ : let c = getchar()
+ : while c == "\<CursorHold>"
+ : let c = getchar()
+ : endwhile
+ : return c
+ :endfunction
getcharmod() *getcharmod()*
The result is a Number which is the state of the modifiers for
@@ -3513,7 +3532,7 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr}
This can be used to save and restore the position of a mark: >
let save_a_mark = getpos("'a")
...
- call setpos(''a', save_a_mark
+ call setpos("'a", save_a_mark)
< Also see |getcurpos()| and |setpos()|.
@@ -4614,6 +4633,92 @@ mode([expr]) Return a string that indicates the current mode.
"c" or "n".
Also see |visualmode()|.
+msgpackdump({list}) {Nvim} *msgpackdump()*
+ Convert a list of VimL objects to msgpack. Returned value is
+ |readfile()|-style list. Example: >
+ call writefile(msgpackdump([{}]), 'fname.mpack', 'b')
+< This will write the single 0x80 byte to `fname.mpack` file
+ (dictionary with zero items is represented by 0x80 byte in
+ messagepack).
+
+ Limitations:
+ 1. |Funcref|s cannot be dumped.
+ 2. Containers that reference themselves cannot be dumped.
+ 3. Dictionary keys are always dumped as STR strings.
+ 4. Other strings are always dumped as BIN strings.
+ 5. Points 3. and 4. do not apply to |msgpack-special-dict|s.
+
+msgpackparse({list}) {Nvim} *msgpackparse()*
+ Convert a |readfile()|-style list to a list of VimL objects.
+ Example: >
+ let fname = expand('~/.nvim/shada/main.shada')
+ let mpack = readfile(fname, 'b')
+ let shada_objects = msgpackparse(mpack)
+< This will read ~/.nvim/shada/main.shada file to
+ `shada_objects` list.
+
+ Limitations:
+ 1. Mapping ordering is not preserved unless messagepack
+ mapping is dumped using generic mapping
+ (|msgpack-special-map|).
+ 2. Since the parser aims to preserve all data untouched
+ (except for 1.) some strings are parsed to
+ |msgpack-special-dict| format which is not convenient to
+ use.
+ *msgpack-special-dict*
+ Some messagepack strings may be parsed to special
+ dictionaries. Special dictionaries are dictionaries which
+
+ 1. Contain exactly two keys: `_TYPE` and `_VAL`.
+ 2. `_TYPE` key is one of the types found in |v:msgpack_types|
+ variable.
+ 3. Value for `_VAL` has the following format (Key column
+ contains name of the key from |v:msgpack_types|):
+
+ Key Value ~
+ nil Zero, ignored when dumping.
+ boolean One or zero. When dumping it is only checked that
+ value is a |Number|.
+ integer |List| with four numbers: sign (-1 or 1), highest two
+ bits, number with bits from 62nd to 31st, lowest 31
+ bits. I.e. to get actual number one will need to use
+ code like >
+ _VAL[0] * ((_VAL[1] << 62)
+ & (_VAL[2] << 31)
+ & _VAL[3])
+< Special dictionary with this type will appear in
+ |msgpackparse()| output under one of the following
+ circumstances:
+ 1. |Number| is 32-bit and value is either above
+ INT32_MAX or below INT32_MIN.
+ 2. |Number| is 64-bit and value is above INT64_MAX. It
+ cannot possibly be below INT64_MIN because msgpack
+ C parser does not support such values.
+ float |Float|. This value cannot possibly appear in
+ |msgpackparse()| output.
+ string |readfile()|-style list of strings. This value will
+ appear in |msgpackparse()| output if string contains
+ zero byte or if string is a mapping key and mapping is
+ being represented as special dictionary for other
+ reasons.
+ binary |readfile()|-style list of strings. This value will
+ appear in |msgpackparse()| output if binary string
+ contains zero byte.
+ array |List|. This value cannot appear in |msgpackparse()|
+ output.
+ *msgpack-special-map*
+ map |List| of |List|s with two items (key and value) each.
+ This value will appear in |msgpackparse()| output if
+ parsed mapping contains one of the following keys:
+ 1. Any key that is not a string (including keys which
+ are binary strings).
+ 2. String with NUL byte inside.
+ 3. Duplicate key.
+ 4. Empty key.
+ ext |List| with two values: first is a signed integer
+ representing extension type. Second is
+ |readfile()|-style list of strings.
+
nextnonblank({lnum}) *nextnonblank()*
Return the line number of the first line at or below {lnum}
that is not blank. Example: >
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index fc16b1a7e7..3f61e28651 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -1,4 +1,4 @@
-*indent.txt* For Vim version 7.4. Last change: 2014 Apr 23
+*indent.txt* For Vim version 7.4. Last change: 2014 Dec 06
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/nvim.txt b/runtime/doc/nvim.txt
new file mode 100644
index 0000000000..a7c512d1dc
--- /dev/null
+++ b/runtime/doc/nvim.txt
@@ -0,0 +1,24 @@
+*nvim.txt* For Nvim. {Nvim}
+
+
+ NVIM REFERENCE MANUAL *nvim*
+
+
+Introduction to Nvim *nvim-intro*
+
+This is an introduction for Vim users who are just getting started with Nvim.
+It is not meant for Vim beginners. For a basic introduction to Vim,
+see |help.txt|.
+
+1. Transitioning from Vim |nvim-from-vim|
+2. Differences from Vim |vim-differences|
+3. Msgpack-RPC |msgpack-rpc|
+4. Job control |job-control|
+5. Python plugins |nvim-python|
+6. Clipboard integration |nvim-clipboard|
+7. Remote plugins |remote-plugin|
+8. Provider infrastructure |nvim-provider|
+9. Integrated terminal emulator |nvim-terminal-emulator|
+
+==============================================================================
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/nvim_from_vim.txt b/runtime/doc/nvim_from_vim.txt
new file mode 100644
index 0000000000..220e67d0e7
--- /dev/null
+++ b/runtime/doc/nvim_from_vim.txt
@@ -0,0 +1,49 @@
+*nvim_from_vim.txt* For Nvim. {Nvim}
+
+
+ NVIM REFERENCE MANUAL
+
+
+Transitioning from Vim *nvim-from-vim*
+
+Nvim is emphatically a fork of Vim, so compatibility to Vim should be pretty
+good.
+
+To start the transition, link your previous configuration so Nvim can use
+it:
+>
+ ln -s ~/.vimrc ~/.nvimrc
+ ln -s ~/.vim ~/.nvim
+<
+See |nvim-intro|, especially |nvim-python| and |nvim-clipboard|, for
+additional software you might need to install to use all of Nvim's features.
+
+Your Vim configuration might not be entirely compatible with Nvim. For a
+full list of differences between Vim and Nvim, see |vim-differences|.
+
+The |'ttymouse'| option, for example, was removed from Nvim (mouse support
+should work without it). If you use the same |vimrc| for Vim and Nvim,
+consider guarding |'ttymouse'| in your configuration like so:
+>
+ if !has('nvim')
+ set ttymouse=xterm2
+ endif
+<
+Conversely, if you have Nvim specific configuration items, you could do
+this:
+>
+ if has('nvim')
+ tnoremap <Esc> <C-\><C-n>
+ endif
+<
+For a more granular approach, use |exists()|:
+>
+ if exists(':tnoremap')
+ tnoremap <Esc> <C-\><C-n>
+ endif
+<
+Now you should be able to explore Nvim more comfortably. Check |nvim| for more
+information.
+
+==============================================================================
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/nvim_intro.txt b/runtime/doc/nvim_intro.txt
deleted file mode 100644
index 40f65620af..0000000000
--- a/runtime/doc/nvim_intro.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-*nvim_intro.txt* For Nvim. {Nvim}
-
-
- NVIM REFERENCE MANUAL by Thiago de Arruda
-
-
-Introduction to Nvim *nvim* *nvim-intro*
-
-This is an introduction for Vim users who are just getting started with Nvim.
-It is not meant for Vim beginners. For a basic introduction to Vim,
-see |help.txt|.
-
-For now, it is just an index with the most relevant topics/features that
-differentiate Nvim from Vim:
-
-1. Differences from Vim |vim-differences|
-2. Msgpack-RPC |msgpack-rpc|
-3. Job control |job-control|
-4. Python plugins |nvim-python|
-5. Clipboard integration |nvim-clipboard|
-6. Remote plugins |remote-plugin|
-7. Provider infrastructure |nvim-provider|
-8. Integrated terminal emulator |nvim-terminal-emulator|
-
-==============================================================================
- vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/nvim_python.txt b/runtime/doc/nvim_python.txt
index a93e89303c..1c345b4532 100644
--- a/runtime/doc/nvim_python.txt
+++ b/runtime/doc/nvim_python.txt
@@ -70,7 +70,7 @@ To disable Python 2 interface, set `g:loaded_python_provider` to 1:
<
*g:loaded_python3_provider*
-To disable Python 3 interface, set `g:loaded_python3_provider` to 0:
+To disable Python 3 interface, set `g:loaded_python3_provider` to 1:
>
let g:loaded_python3_provider = 1
<
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index fea8a59a74..e8c844f7d2 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1402,8 +1402,8 @@ A jump table for the options with a short description can be found at |Q_op|.
register '*' for all yank, delete, change and put
operations which would normally go to the unnamed
register. When "unnamed" is also included to the
- option, yank operations (but not delete, change or
- put) will additionally copy the text into register
+ option, yank and delete operations (but not put)
+ will additionally copy the text into register
'*'. See |nvim-clipboard|.
<
*clipboard-autoselect*
@@ -1427,35 +1427,6 @@ A jump table for the options with a short description can be found at |Q_op|.
autoselectml Like "autoselect", but for the modeless selection
only. Compare to the 'A' flag in 'guioptions'.
- *clipboard-html*
- html When the clipboard contains HTML, use this when
- pasting. When putting text on the clipboard, mark it
- as HTML. This works to copy rendered HTML from
- Firefox, paste it as raw HTML in Vim, select the HTML
- in Vim and paste it in a rich edit box in Firefox.
- You probably want to add this only temporarily,
- possibly use BufEnter autocommands.
- Only supported for GTK version 2 and later.
- Only available with the |+multi_byte| feature.
-
- *clipboard-exclude*
- exclude:{pattern}
- Defines a pattern that is matched against the name of
- the terminal 'term'. If there is a match, no
- connection will be made to the X server. This is
- useful in this situation:
- - Running Vim in a console.
- - $DISPLAY is set to start applications on another
- display.
- - You do not want to connect to the X server in the
- console, but do want this in a terminal emulator.
- To never connect to the X server use: >
- exclude:.*
- The value of 'magic' is ignored, {pattern} is
- interpreted as if 'magic' was on.
- The rest of the option value will be used for
- {pattern}, this must be the last entry.
-
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global
@@ -5192,7 +5163,7 @@ A jump table for the options with a short description can be found at |Q_op|.
print/ files for printing |postscript-print-encoding|
spell/ spell checking files |spell|
syntax/ syntax files |mysyntaxfile|
- tutor/ files for vimtutor |tutor|
+ tutor/ tutorial files |:Tutor|
And any other file searched for with the |:runtime| command.
diff --git a/runtime/doc/pi_tutor.txt b/runtime/doc/pi_tutor.txt
new file mode 100644
index 0000000000..7ed47b24dd
--- /dev/null
+++ b/runtime/doc/pi_tutor.txt
@@ -0,0 +1,50 @@
+*pi_tutor.txt* Interactive tutorials.
+*vim-tutor-mode*
+
+vim-tutor-mode provides a system to follow and create interactive tutorials
+for vim and third party plugins. It replaces the venerable `vimtutor` system.
+
+==============================================================================
+1. Usage *vim-tutor-usage*
+
+vim-tutor-mode tutorials are hypertext documents, they have rich text and
+contain links. To stand out from the rest of the text, links are underlined.
+You can follow them by placing the cursor over them and pressing <Enter>, or
+by double-clicking them.
+
+1.1 Commands
+------------
+ *:Tutor*
+:Tutor {tutorial} Opens a tutorial. Command-line completion for
+ {tutorial} is provided, the candidates are a list of
+ '.tutor' files found in the 'tutor/' folder in
+ the 'runtimepath'. Tutorials prefixed with 'vim-' will
+ always be shown first.
+
+ If no {tutorial} is provided, the command starts the
+ 'vim-01-beginner' tutorial, which is equivalent to
+ Vim's `vimtutor`.
+
+=============================================================================
+2. Creating tutorials *vim-tutor-create*
+
+Writing vim-tutor-mode tutorials is easy. For an overview of the format used,
+please consult the 'tutor.tutor' file: >
+
+ :Tutor tutor
+<
+New tutorials must be placed in the 'tutor/' folder in the 'runtimepath'
+to be detected by the :Tutor command.
+
+It is recommended to use a less formal style when writing tutorials than in
+regular documentation (unless the content requires it).
+
+============================================================================
+3. Contributing
+
+Development of the plugin is done over at github [1]. Feel free to report
+issues and make suggestions.
+
+[1]: https://github.com/fmoralesc/vim-tutor-mode
+
+" vim: set ft=help :
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 6bc1b2873c..88f23e6c76 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 27
+*syntax.txt* For Vim version 7.4. Last change: 2014 Nov 19
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5055,6 +5055,7 @@ This will set the "w:current_syntax" variable to "foo". The value of
restoring "b:current_syntax", since the syntax files do set
"b:current_syntax". The value set by the syntax file is assigned to
"w:current_syntax".
+Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options.
Once a window has its own syntax, syntax commands executed from other windows
on the same buffer (including :syntax clear) have no effect. Conversely,
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 88c277ef43..78ae536c5a 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.4. Last change: 2014 Nov 19
+*todo.txt* For Vim version 7.4. Last change: 2014 Dec 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,9 +34,23 @@ not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
+Patch to fix list range assign crash. (Yukihiro Nakadaira, 2014 Dec 1)
+
+Patch to fix range with user command. (Marcin Szamotulski, 2014 Dec 2)
+Update Dec 6, with support for user commands.
+
+When window number in Ex range is too high, give an error?
+Only when backwards compatible.
+
+:s/\n// doesn't change anything. Since 7.4.232? (Eliseo Martínez, 2014 Nov
+28) Patch on Issue 287
+
+Using vim_snprintf() in window.c can be in a function.
+
Regexp problems:
- The NFA engine does not implement the time limit passed to
nfa_regexec_multi()
+- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4)
- Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$'
(Lech Lorens, 2014 Feb 3)
- Issue 164: freeze on regexp search.
@@ -64,17 +78,11 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed?
Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28)
+Patch to fix recognizing function name. (Ozaki Kiichi, 2014 Nov 28)
+
":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29)
-Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug
-14, Aug 30)
- Make ":1close" close the first window.
- Make ":+1close" close the next window.
- Make ":-1close" close the previous window.
-Doesn't look right, asked for updates.
-Update 2014 Nov 8. Replied with suggestions.
-
The entries added by matchaddpos() are returned by getmatches() but can't be
set with setmatches(). (lcd47, 2014 Jun 29)
@@ -84,34 +92,34 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
-Patch to fix issue 78. (Christian Brabandt, 2014 Oct 8)
-
-Patch to fix leak in map() with error. (Christian Brabandt, 2014 Oct 11)
-
-Patch to fix incsearch for "2/pattern/e".
-
-Patch to fix memory leak in :hardcopy. (Christian Brabandt, 2014 Nov 16)
-
-Patch to fix warnings in if_ruby.c. (Ken Takata, 2014 Nov 17)
-
-Patch to make test 63 pass when in a B&W terminal. (Christian Brabandt, 2014
-Nov 15) Other patch (better) on Nov 17.
-
Change behavior of v:hlsearch? Patch from Christian, 2014 Oct 22.
+Patch to recover from X server restart: hint on Issue 203 (2014 Nov 21 18:44)
+
MS-Windows: When editing a file with a leading space, writing it uses the
wrong name. (Aram, 2014 Nov 7) Vim 7.4.
+Add LessCss support. (Jenoma / Alessandro Vioni, 2014 Nov 24)
+Now with updated license, Nov 24.
+
patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12)
Value returned by virtcol() changes depending on how lines wrap. This is
inconsistent with the documentation.
-Patch to fix relatie numbers. (Christian Brabandt, 2014 Nov 17)
+Ukrainian vimtutor. (Issue 288)
+
+Regenerate the Unicode tables in mbyte.c.
+Diff from ZyX, 2014 Dec 6.
+
+Patch to fix relative numbers. (Christian Brabandt, 2014 Nov 17)
+Update Nov 26.
Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014
Nov 12)
+Patch to avoid recognizing polkit as hog files. (Issue 292)
+
Patch to support hex values for setting option value.
(Zyx, 2015 Nov 6)
@@ -122,17 +130,29 @@ Update Nov 5.
MS-Windows: Crash opening very long file name starting with "\\".
(Christian Brock, 2012 Jun 29)
+Cursorline background color not mixed with character highlight.
+Patch by Yasuhiro Matsumoto, 2014 Dec 3.
+
Problem using diff syntax with cp932 encoding. Idea from Yasuhiro Matsumoto,
patch from Ken Takata (2014 Nov 6)
ml_updatechunk() is slow when retrying for another encoding. (John Little,
2014 Sep 11)
+Patch to add a different escape sequence for replace mode.
+(Omar Sandoval, 2014 Nov 30)
+
+Patch to allow values greater than 255 for ctermfg/ctermbg on Windows.
+(Yasuhiro Matsumoto, 2014 Dec 5)
+
When 'balloonexpr' returns a list the result has a trailing newline.
Just remove one trailing newline. (lcd, 2014 Oct 17)
Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24)
+Result of systemlist() does not show whether text ended in line break.
+(Bjorn Linse, 2014 Nov 27)
+
When in 'comments' "n:x" follows after three-part comment directly it repeats
any one-character from the previous line. (Kartik Agaram, 2014 Sep 19)
@@ -147,6 +167,15 @@ Plugins need to make a lot of effort, lots of mappings, to know what happened
before pressing the key that triggers a plugin action. How about keeping the
last N pressed keys, so that they do not need to be mapped?
+":q!" should reset modified flag for current buffer, if another buffer is
+modified no need to abandon it again.
+Patch from Yasuhiro Matsumoto, 2014 Nov 21.
+Update from Hirohito Higashi, 2014 Nov 21.
+With test, Nov 23.
+
+Wrong scrolling when using incsearch. Patch by Christian Brabandt, 2014 Dec 4.
+Is this a good solution?
+
Can assign to s:type when a function s:type has been defined.
Also the other way around: define a function while a variable with that name
was already defined.
@@ -175,6 +204,7 @@ Bug: Autocompleting ":tag/pat" replaces "/pat" with a match but does not
insert a space. (Micha Mos, 2014 Nov 7)
Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12)
+Update Dec 6.
Patch to add argument to :cquit. (Thinca, 2014 Oct 12)
@@ -287,6 +317,10 @@ Yasuhiro Matsumoto, 2013 May 31.
Or should we add a more general mechanism, like a lambda() function?
Patch by Yasuhiro Matsumoto, 2014 Sep 16.
+Patch to fix display of listchars on the cursorline. (Nayuri Aohime, 2013)
+Update suggested by Yasuhiro Matsumoto, 2014 Nov 25:
+https://gist.github.com/presuku/d3d6b230b9b6dcfc0477
+
Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4)
Remark on the docs. Should not be a compile time feature. But then what?
@@ -537,6 +571,14 @@ MS-Windows resizing problems:
causes the window to move unnecessarily. (William E. Skeith III, 2012 Jan
12) Patch: 2012 Jan 13 Needs more work (2012 Feb 2)
+Patch to use Modern UI 2.0 for the Nsis installer. (Guopeng Wen, 2010 Jul 30)
+Latest version: 2011 May 18
+8 Windows install with NSIS: make it possible to do a silent install, see
+ http://nsis.sourceforge.net/Docs/Chapter4.html#4.12
+ Version from Guopeng Wen that does this (2010 Dec 27)
+Alternative: MSI installer: https://github.com/petrkle/vim-msi/
+Or the one on Issue 279
+
'iminsert' global value set when using ":setlocal iminsert"? (Wu, 2012 Jun 23)
Patch to append regexp to tag commands to make it possible to select one out
@@ -847,7 +889,7 @@ Assume the system converts between the actual encoding of the filesystem to
the system encoding (usually utf-8).
Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan
-26, update 2013 Dec 14)
+26, update 2013 Dec 14, another 2014 Nov 22)
Problem producing tags file when hebrew.frx is present. It has a BOM.
Results in E670. (Tony Mechelynck, 2010 May 2)
@@ -1479,13 +1521,6 @@ with "gvim -nb:localhost:55555:foo". From nc do: '1:editFile!0 "foo"'. Then
go to Insert mode and add a few lines. Then backspacing every other time
moves the cursor instead of deleting. (Chris Kaiser, 2007 Sep 25)
-Patch to use Modern UI 2.0 for the Nsis installer. (Guopeng Wen, 2010 Jul 30)
-Latest version: 2011 May 18
-8 Windows install with NSIS: make it possible to do a silent install, see
- http://nsis.sourceforge.net/Docs/Chapter4.html#4.12
- Version from Guopeng Wen that does this (2010 Dec 27)
-Alternative: MSI installer: https://github.com/petrkle/vim-msi/
-
Windows installer should install 32-bit version of right-click handler also on
64-bit systems. (Brian Cunningham, 2011 Dec 28)
diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt
index cdb3035a40..c6d363ad5f 100644
--- a/runtime/doc/usr_01.txt
+++ b/runtime/doc/usr_01.txt
@@ -70,52 +70,18 @@ If the file already exists you probably want to keep it.
For more info see |vimrc|.
==============================================================================
-*01.3* Using the Vim tutor *tutor* *vimtutor*
+*01.3* Using the Vim tutor *tutor* *vimtutor*
Instead of reading the text (boring!) you can use the vimtutor to learn your
first Vim commands. This is a 30 minute tutorial that teaches the most basic
Vim functionality hands-on.
-On Unix, if Vim has been properly installed, you can start it from the shell:
->
- vimtutor
+To start the tutorial, execute >
-On MS-Windows you can find it in the Program/Vim menu. Or execute
-vimtutor.bat in the $VIMRUNTIME directory.
-
-This will make a copy of the tutor file, so that you can edit it without
-the risk of damaging the original.
- There are a few translated versions of the tutor. To find out if yours is
-available, use the two-letter language code. For French: >
-
- vimtutor fr
-
-On Unix, if you prefer using the GUI version of Vim, use "gvimtutor" or
-"vimtutor -g", optionally with a two-letter language code.
-
-
-On other systems, you have to do a little work:
-
-1. Copy the tutor file. You can do this with Vim (it knows where to find it):
->
- vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q'
-<
- This will write the file "TUTORCOPY" in the current directory. To use a
-translated version of the tutor, append the two-letter language code to the
-filename. For French:
->
- vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q'
+ :Tutor
<
-2. Edit the copied file with Vim:
->
- vim -u NONE TUTORCOPY
-<
- The extra arguments make sure Vim is started in a good mood.
+from within nvim. The tutorial will lead you from that point. Have fun!
-3. Delete the copied file when you are finished with it:
->
- del TUTORCOPY
-<
==============================================================================
*01.4* Copyright *manual-copyright*
diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt
index ebb918d7ec..cd25b14e32 100644
--- a/runtime/doc/usr_02.txt
+++ b/runtime/doc/usr_02.txt
@@ -164,7 +164,7 @@ right and j points down. In a picture: >
The best way to learn these commands is by using them. Use the "i" command to
insert some more lines of text. Then use the hjkl keys to move around and
insert a word somewhere. Don't forget to press <Esc> to go back to Normal
-mode. The |vimtutor| is also a nice way to learn by doing.
+mode. |:Tutor| is also a nice way to learn by doing.
For Japanese users, Hiroshi Iwatani suggested using this:
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index ba69b7cf2f..39d3c43d97 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -1,4 +1,4 @@
-*windows.txt* For Vim version 7.4. Last change: 2014 Sep 23
+*windows.txt* For Vim version 7.4. Last change: 2014 Dec 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -280,7 +280,7 @@ CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
" if there are less than 9 windows opened
:-quit " quit the previous window
:+quit " quit the next window
- :+2quit " will also work as expected
+ :+2quit " quit the second next window
<
:q[uit]!
:{count}q[uit]!
@@ -324,9 +324,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
screen. For {count} see |:quit|.
The buffer becomes hidden (unless there is another window
- editing it or 'bufhidden' is `unload` or `delete`). If the
- window is the last one in the current tab page the tab page is
- closed. |tab-page|
+ editing it or 'bufhidden' is `unload`, `delete` or `wipe`).
+ If the window is the last one in the current tab page the tab
+ page is closed. |tab-page|
The value of 'hidden' is irrelevant for this command.
Changes to the buffer are not written and won't get lost, so
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index d7bac1bdcf..66e747a06f 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Nov 05
+" Last Change: 2014 Dec 06
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -1852,7 +1852,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
" Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts
-au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash")
+au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash")
au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
@@ -2259,6 +2259,9 @@ au BufNewFile,BufReadPost *.tssop setf tssop
" TSS - Command Line (temporary)
au BufNewFile,BufReadPost *.tsscl setf tsscl
+" Tutor mode
+au BufNewFile,BufReadPost *.tutor setf tutor
+
" TWIG files
au BufNewFile,BufReadPost *.twig setf twig
@@ -2506,6 +2509,8 @@ au BufNewFile,BufRead */etc/yum.conf setf dosini
" Zimbu
au BufNewFile,BufRead *.zu setf zimbu
+" Zimbu Templates
+au BufNewFile,BufRead *.zut setf zimbutempl
" Zope
" dtml (zope dynamic template markup language), pt (zope page template),
diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim
new file mode 100644
index 0000000000..237176f5eb
--- /dev/null
+++ b/runtime/ftplugin/tutor.vim
@@ -0,0 +1,43 @@
+" vim: fdm=marker
+
+" Base: {{{1
+call tutor#SetupVim()
+
+" Buffer Settings: {{{1
+if !exists('g:tutor_debug') || g:tutor_debug == 0
+ setlocal buftype=nofile
+ setlocal concealcursor+=inv
+ setlocal conceallevel=2
+else
+ setlocal buftype=
+ setlocal concealcursor&
+ setlocal conceallevel=0
+endif
+setlocal noundofile
+
+setlocal keywordprg=:help
+setlocal iskeyword=@,-,_
+
+setlocal foldmethod=expr
+setlocal foldexpr=tutor#TutorFolds()
+setlocal foldcolumn=3
+setlocal foldlevel=4
+
+setlocal statusline=%{toupper(expand('%:t:r'))}\ tutorial%=
+setlocal statusline+=%{tutor#InfoText()}
+
+" Mappings: {{{1
+
+call tutor#SetNormalMappings()
+call tutor#SetSampleTextMappings()
+
+" Checks: {{{1
+
+sign define tutorok text=✓ texthl=tutorOK
+sign define tutorbad text=✗ texthl=tutorX
+
+if !exists('g:tutor_debug') || g:tutor_debug == 0
+ call tutor#PlaceXMarks()
+ autocmd! TextChanged <buffer> call tutor#OnTextChanged()
+ autocmd! TextChangedI <buffer> call tutor#OnTextChanged()
+endif
diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim
index b83a1923ed..1bffa7f195 100644
--- a/runtime/indent/php.vim
+++ b/runtime/indent/php.vim
@@ -3,8 +3,8 @@
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
" URL: http://www.2072productions.com/vim/indent/php.vim
" Home: https://github.com/2072/PHP-Indenting-for-VIm
-" Last Change: 2014 April 3rd
-" Version: 1.49
+" Last Change: 2014 November 26th
+" Version: 1.57
"
"
" Type :help php-indent for available options
@@ -48,7 +48,7 @@ endif
let b:did_indent = 1
-let php_sync_method = 0
+let g:php_sync_method = 0
@@ -112,7 +112,7 @@ setlocal nocindent
setlocal nolisp
setlocal indentexpr=GetPhpIndent()
-setlocal indentkeys=0{,0},0),:,!^F,o,O,e,*<Return>,=?>,=<?,=*/
+setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=?>,=<?,=*/
@@ -128,11 +128,14 @@ if exists("*GetPhpIndent")
endif
+let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)'
let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)'
-let s:functionDecl = '\<function\>\%(\s\+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\)\=\s*(.*'
+let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*'
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
-let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
+
+
+let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
@@ -140,7 +143,7 @@ let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
let s:escapeDebugStops = 0
function! DebugPrintReturn(scriptLine)
- if ! s:escapeDebugStops
+ if ! s:escapeDebugStops
echo "debug:" . a:scriptLine
let c = getchar()
if c == "\<Del>"
@@ -158,8 +161,6 @@ function! GetLastRealCodeLNum(startline) " {{{
let lnum = b:GetLastRealCodeLNum_ADD
endif
- let old_lnum = lnum
-
while lnum > 1
let lnum = prevnonblank(lnum)
let lastline = getline(lnum)
@@ -217,7 +218,7 @@ function! GetLastRealCodeLNum(startline) " {{{
let lnum=0
endif
- if b:InPHPcode_and_script && !b:InPHPcode
+ if b:InPHPcode_and_script && 1 > b:InPHPcode
let b:InPHPcode_and_script = 0
endif
@@ -237,7 +238,7 @@ endfun
function! Skippmatch() " {{{
let synname = synIDattr(synID(line("."), col("."), 0), "name")
- if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# "^phpComment" && b:UserIsTypingComment
+ if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# '^php\%(Doc\)\?Comment' && b:UserIsTypingComment
return 0
else
return 1
@@ -249,7 +250,7 @@ function! FindOpenBracket(lnum, blockStarter) " {{{
let line = searchpair('{', '', '}', 'bW', 'Skippmatch()')
if a:blockStarter == 1
- while line > 1
+ while line > 1
let linec = getline(line)
if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline
@@ -310,7 +311,6 @@ let s:defaultORcase = '^\s*\%(default\|case\).*:'
function! FindTheSwitchIndent (lnum) " {{{
-
let test = GetLastRealCodeLNum(a:lnum - 1)
if test <= 1
@@ -353,7 +353,7 @@ function! IslinePHP (lnum, tofind) " {{{
if synname == 'phpStringSingle' || synname == 'phpStringDouble' || synname == 'phpBacktick'
if cline !~ '^\s*[''"`]'
- return ""
+ return "SpecStringEntrails"
else
return synname
end
@@ -372,7 +372,7 @@ if ! s:autoresetoptions
endif
function! ResetPhpOptions()
- if ! b:optionsset && &filetype == "php"
+ if ! b:optionsset && &filetype =~ "php"
if b:PHP_autoformatcomment
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
@@ -418,7 +418,7 @@ function! GetPhpIndent()
let b:PHP_indentinghuge = 0
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
endif
- let b:PHP_lastindented = v:lnum
+ let real_PHP_lastindented = v:lnum
let b:PHP_LastIndentedWasComment=0
let b:PHP_InsideMultilineComment=0
let b:PHP_indentbeforelast = 0
@@ -430,9 +430,12 @@ function! GetPhpIndent()
elseif v:lnum > b:PHP_lastindented
let real_PHP_lastindented = b:PHP_lastindented
- let b:PHP_lastindented = v:lnum
+ else
+ let real_PHP_lastindented = v:lnum
endif
+ let b:PHP_lastindented = v:lnum
+
if !b:InPHPcode_checked " {{{ One time check
let b:InPHPcode_checked = 1
@@ -443,11 +446,15 @@ function! GetPhpIndent()
endif
if synname!=""
- if synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
+ if synname == "SpecStringEntrails"
+ let b:InPHPcode = -1 " thumb down
+ let b:UserIsTypingComment = 0
+ let b:InPHPcode_tofind = ""
+ elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
let b:InPHPcode = 1
let b:InPHPcode_tofind = ""
- if synname =~# "^phpComment"
+ if synname =~# '^php\%(Doc\)\?Comment'
let b:UserIsTypingComment = 1
else
let b:UserIsTypingComment = 0
@@ -483,9 +490,16 @@ function! GetPhpIndent()
if b:InPHPcode_tofind!=""
if cline =~? b:InPHPcode_tofind
- let b:InPHPcode = 1
let b:InPHPcode_tofind = ""
let b:UserIsTypingComment = 0
+
+ if b:InPHPcode == -1
+ let b:InPHPcode = 1
+ return -1
+ end
+
+ let b:InPHPcode = 1
+
if cline =~ '\*/'
call cursor(v:lnum, 1)
if cline !~ '^\*/'
@@ -510,7 +524,7 @@ function! GetPhpIndent()
endif
endif
- if b:InPHPcode
+ if 1 == b:InPHPcode
if !b:InPHPcode_and_script && last_line =~ '\%(<?.*\)\@<!?>\%(.*<?\)\@!' && IslinePHP(lnum, '?>')=~"Delimiter"
if cline !~? s:PHP_startindenttag
@@ -520,8 +534,8 @@ function! GetPhpIndent()
let b:InPHPcode_and_script = 1
endif
- elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before
- let b:InPHPcode = 0
+ elseif last_line =~ '^[^''"`]\+[''"`]$'
+ let b:InPHPcode = -1
let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
elseif last_line =~? '<<<''\=\a\w*''\=$'
let b:InPHPcode = 0
@@ -538,7 +552,7 @@ function! GetPhpIndent()
endif " }}}
- if !b:InPHPcode && !b:InPHPcode_and_script
+ if 1 > b:InPHPcode && !b:InPHPcode_and_script
return -1
endif
@@ -568,7 +582,7 @@ function! GetPhpIndent()
endif
endif
- if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*' && cline !~ '\*/\s*$'
+ if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*\%(.*\*/\)\@!'
if getline(v:lnum + 1) !~ '^\s*\*'
return -1
endif
@@ -669,17 +683,17 @@ function! GetPhpIndent()
endwhile
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
- let ind = ind + &sw " we indent one level further when the preceding line is not stated
+ let ind = ind + &sw
return ind + addSpecial
- elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things)
+ elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
let previous_line = last_line
let last_line_num = lnum
let LastLineClosed = 1
let isSingleLineBlock = 0
while 1
- if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX
+ if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline
call cursor(last_line_num, 1)
if previous_line !~ '^}'
@@ -740,14 +754,19 @@ function! GetPhpIndent()
endif
endif
- let plinnum = GetLastRealCodeLNum(lnum - 1)
+ if (last_line !~ '^\s*}\%(}}\)\@!')
+ let plinnum = GetLastRealCodeLNum(lnum - 1)
+ else
+ let plinnum = GetLastRealCodeLNum(FindOpenBracket(lnum, 1) - 1)
+ endif
+
let AntepenultimateLine = getline(plinnum)
let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','')
if ind == b:PHP_default_indenting
- if last_line =~ terminated
+ if last_line =~ terminated && last_line !~# s:defaultORcase
let LastLineClosed = 1
endif
endif
@@ -755,10 +774,10 @@ function! GetPhpIndent()
if !LastLineClosed
- if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
+ if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline
let dontIndent = 0
- if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline
+ if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*)\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline
let dontIndent = 1
endif
@@ -774,7 +793,7 @@ function! GetPhpIndent()
elseif last_line =~ '\S\+\s*),'.endline
call cursor(lnum, 1)
- call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag
+ call search('),'.endline, 'W')
let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()')
if openedparent != lnum
let ind = indent(openedparent)
@@ -784,7 +803,7 @@ function! GetPhpIndent()
let ind = ind + &sw
- elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
+ elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
let ind = ind + &sw
endif
diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim
index c18f22569f..3530e29dc4 100644
--- a/runtime/macros/editexisting.vim
+++ b/runtime/macros/editexisting.vim
@@ -1,6 +1,6 @@
" Vim Plugin: Edit the file with an existing Vim if possible
" Maintainer: Bram Moolenaar
-" Last Change: 2013 Feb 24
+" Last Change: 2014 Dec 06
" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
" $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
@@ -112,7 +112,7 @@ func! EditExisting(fname, command)
endif
if a:command != ''
- exe "normal " . a:command
+ exe "normal! " . a:command
endif
redraw
diff --git a/runtime/plugin/tutor.vim b/runtime/plugin/tutor.vim
new file mode 100644
index 0000000000..1411b1ac63
--- /dev/null
+++ b/runtime/plugin/tutor.vim
@@ -0,0 +1,6 @@
+if exists('g:loaded_tutor_mode_plugin') || &compatible
+ finish
+endif
+let g:loaded_tutor_mode_plugin = 1
+
+command! -nargs=? -complete=custom,tutor#TutorCmdComplete Tutor call tutor#TutorCmd(<q-args>)
diff --git a/runtime/syntax/tutor.vim b/runtime/syntax/tutor.vim
new file mode 100644
index 0000000000..99bcb78270
--- /dev/null
+++ b/runtime/syntax/tutor.vim
@@ -0,0 +1,83 @@
+if exists("b:current_syntax")
+ finish
+endif
+
+syn include @VIM syntax/vim.vim
+unlet b:current_syntax
+syn include @TUTORSHELL syntax/sh.vim
+unlet b:current_syntax
+syn include @VIMNORMAL syntax/vimnormal.vim
+
+syn match tutorLink /\[.\{-}\](.\{-})/ contains=tutorInlineNormal
+syn match tutorLinkBands /\[\|\]\|(\|)/ contained containedin=tutorLink,tutorLinkAnchor conceal
+syn match tutorLinkAnchor /(.\{-})/ contained containedin=tutorLink conceal
+syn match tutorURL /\(https\?\|file\):\/\/[[:graph:]]\+\>\/\?/
+syn match tutorEmail /\<[[:graph:]]\+@[[:graph:]]\+\>/
+syn match tutorInternalAnchor /\*[[:alnum:]-]\+\*/ contained conceal containedin=tutorSection
+
+syn match tutorSection /^#\{1,6}\s.\+$/ fold
+syn match tutorSectionBullet /#/ contained containedin=tutorSection
+
+syn match tutorTOC /\ctable of contents:/
+
+syn match tutorConcealedEscapes /\\[`*!\[\]()«»:$-]\@=/ conceal
+
+syn region tutorEmphasis matchgroup=Delimiter start=/[\*]\@<!\*\*\@!/ end=/[\*]\@<!\*\*\@!/
+ \ concealends contains=tutorInlineCommand,tutorInlineNormal
+syn region tutorBold matchgroup=Delimiter start=/\*\{2}/ end=/\*\{2}/
+ \ concealends contains=tutorInlineCommand,tutorInlineNormal
+
+syn keyword tutorMarks TODO NOTE IMPORTANT TIP ATTENTION EXERCISE
+syn keyword tutorMarks todo note tip attention exercise
+syn keyword tutorMarks Todo Note Tip Excersise
+
+syn match tutorTextMark /\\\@<!--->/ conceal cchar=→
+syn region tutorSampleText start=/^\(--->\)\@=/ end=/$/ keepend contains=@SPELL
+syn match tutorSampleTextMark /^--->/ contained containedin=tutorSampleText conceal cchar=→
+syn match tutorSampleTextExpect /\}\@<! {expect:.\+}\s*$/ contained containedin=tutorSampleText conceal
+syn match tutorSampleTextExpect /|\@<! |expect:.\+|\s*$/ contained containedin=tutorSampleText conceal
+
+syn region tutorCodeblock matchgroup=Delimiter start=/^\~\{3}.*$/ end=/^\~\{3}/
+
+syn region tutorShell matchgroup=Delimiter start=/^\~\{3} sh\s*$/ end=/^\~\{3}/ keepend contains=@TUTORSHELL concealends
+syn match tutorShellPrompt /\(^\s*\)\@<=[$#]/ contained containedin=tutorShell
+
+syn region tutorInlineCode matchgroup=Delimiter start=/\\\@<!`/ end=/\\\@<!\(`{\@!\|`\s\)/ concealends
+
+syn region tutorCommand matchgroup=Delimiter start=/^\~\{3} cmd\( :\)\?\s*$/ end=/^\~\{3}/ keepend contains=@VIM concealends
+syn region tutorInlineCommand matchgroup=Delimiter start=/\\\@<!`\(.*{vim}\)\@=/ end=/\\\@<!`\({vim}\)\@=/ nextgroup=tutorInlineType contains=@VIM concealends
+
+syn region tutorNormal matchgroup=Delimiter start=/^\~\{3} norm\(al\?\)\?\s*$/ end=/^\~\{3}/ contains=@VIMNORMAL concealends
+syn region tutorInlineNormal matchgroup=Delimiter start=/\\\@<!`\(\S*{normal}\)\@=/ end=/\\\@<!`\({normal}\)\@=/ nextgroup=tutorInlineType contains=@VIMNORMAL concealends
+
+syn match tutorInlineType /{\(normal\|vim\)}/ contained conceal
+
+syn match tutorInlineOK /✓/
+syn match tutorInlineX /✗/
+
+hi! tutorLink cterm=underline gui=underline ctermfg=lightblue guifg=#0088ff
+hi! link tutorLinkBands Delimiter
+hi! link tutorLinkAnchor Underlined
+hi! link tutorInternalAnchor Underlined
+hi! link tutorURL tutorLink
+hi! link tutorEmail tutorLink
+
+hi! link tutorSection Title
+hi! link tutorSectionBullet Delimiter
+
+hi! link tutorTOC Directory
+
+hi! tutorMarks cterm=bold gui=bold
+
+hi! tutorEmphasis gui=italic cterm=italic
+hi! tutorBold gui=bold cterm=bold
+
+hi! link tutorSampleText Special
+hi! tutorOK ctermfg=green guifg=#00ff88 cterm=bold gui=bold
+hi! tutorX ctermfg=red guifg=#ff2000 cterm=bold gui=bold
+hi! link tutorInlineOK tutorOK
+hi! link tutorInlineX tutorX
+
+hi! link tutorShellPrompt Delimiter
+
+let b:current_syntax = "tutor"
diff --git a/runtime/syntax/vimnormal.vim b/runtime/syntax/vimnormal.vim
new file mode 100644
index 0000000000..df672c5236
--- /dev/null
+++ b/runtime/syntax/vimnormal.vim
@@ -0,0 +1,16 @@
+syn match normalOp /[dcrypoaxv!"#%&.-\/:<>=?@ABCDGHIJKLMNOPQRSUVWXYZgmqstz~iu]/ nextgroup=normalMod
+syn match normalMod /m\@<![ia]/
+syn match normalObject /["'()<>BW\[\]`bstweE{}ftFT;,$]/
+syn match normalCount /[0-9]/
+syn region normalSearch start=/[/?]\@<=./ end=/.<CR>\@=/ contains=normalKey keepend
+syn region normalChange start=/\([cr][wWbBeE()\[\]{}pst]\)\@<=./ end=/.\@=/ contains=normalKey keepend
+syn match normalCharSearch /\c[ftr]\@<=\w/
+syn match normalMark /\(f\@<!m\)\@<=[a-zA-Z0-9]/
+syn match normalKey /<'\@!.\{-}>'\@!/
+
+hi! link normalOp Operator
+hi! link normalMod PreProc
+hi! link normalObject Structure
+hi! link normalCount Number
+hi! link normalMark Identifier
+hi! link normalKey Special
diff --git a/runtime/syntax/zimbu.vim b/runtime/syntax/zimbu.vim
index c859a2f815..1a7a485e6f 100644
--- a/runtime/syntax/zimbu.vim
+++ b/runtime/syntax/zimbu.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Zimbu
" Maintainer: Bram Moolenaar
-" Last Change: 2012 Jun 01
+" Last Change: 2014 Nov 23
if exists("b:current_syntax")
finish
@@ -12,7 +12,10 @@ syn include @Ccode syntax/c.vim
syn keyword zimbuTodo TODO FIXME XXX contained
syn match zimbuNoBar "|" contained
syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar
-syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,@Spell
+syn match zimbuNoBacktick "`" contained
+syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick
+syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
+syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
syn match zimbuChar "'\\\=.'"
@@ -28,27 +31,32 @@ syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6
syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12
syn keyword zimbuBasicType fixed13 fixed14 fixed15
-syn keyword zimbuCompType string stringval cstring varstring
-syn keyword zimbuCompType bytes varbytes
-syn keyword zimbuCompType tuple array list dict multiDict set multiSet
+syn keyword zimbuCompType string varString
+syn keyword zimbuCompType byteString varByteString
+syn keyword zimbuCompType tuple array list dict dictList set callback
+syn keyword zimbuCompType sortedList multiDict multiDictList multiSet
syn keyword zimbuCompType complex complex32 complex64 complex80 complex128
syn keyword zimbuCompType proc func def thread evalThread lock cond pipe
-syn keyword zimbuType VAR ANY USE GET
+syn keyword zimbuType VAR dyn type USE GET
syn match zimbuType "IO.File"
syn match zimbuType "IO.Stat"
-syn keyword zimbuStatement IF ELSE ELSEIF WHILE REPEAT FOR IN TO STEP
+syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP
syn keyword zimbuStatement DO UNTIL SWITCH WITH
syn keyword zimbuStatement TRY CATCH FINALLY
syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF
+syn keyword zimbuStatement GENERATE_ERROR
+syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF
syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE
syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL
-syn keyword zimbuStatement PART ALIAS CONNECT WRAP
+syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP
syn keyword zimbuStatement BREAK CONTINUE PROCEED
-syn keyword zimbuStatement RETURN EXIT THROW
+syn keyword zimbuStatement RETURN EXIT THROW DEFER
syn keyword zimbuStatement IMPORT AS OPTIONS MAIN
-syn keyword zimbuStatement INTERFACE MODULE ENUM BITS SHARED
+syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS
+syn keyword zimbuStatement SHARED STATIC
+syn keyword zimbuStatement LAMBDA
syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>"
syn match zimbuStatement "\<CLASS\>"
syn match zimbuStatement "}"
@@ -61,10 +69,13 @@ syn match zimbuAttribute "@default\>"
syn match zimbuAttribute "@define\>"
syn match zimbuAttribute "@replace\>"
syn match zimbuAttribute "@final\>"
+syn match zimbuAttribute "@primitive\>"
+syn match zimbuAttribute "@notOnExit\>"
syn match zimbuAttribute "@private\>"
syn match zimbuAttribute "@protected\>"
syn match zimbuAttribute "@public\>"
+syn match zimbuAttribute "@local\>"
syn match zimbuAttribute "@file\>"
syn match zimbuAttribute "@directory\>"
syn match zimbuAttribute "@read=private\>"
@@ -78,15 +89,22 @@ syn match zimbuAttribute "@items=public\>"
syn match zimbuAttribute "@items=file\>"
syn match zimbuAttribute "@items=directory\>"
-syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET
+syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT
syn keyword zimbuOperator IS ISNOT ISA ISNOTA
-syn keyword zimbuModule ARG CHECK E IO PROTO SYS HTTP ZC ZWT TIME THREAD
+syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD
-syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+
+syn match zimbuImport "\.\zsPROTO"
+syn match zimbuImport "\.\zsCHEADER"
+
+"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr
+syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr
syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+
-syn region zimbuString start=+'''+ end=+'''+
+syn region zimbuLongString start=+''"+ end=+"''+
+syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter
+syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair
+syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair
syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK
syn keyword zimbuError NULL
@@ -97,12 +115,18 @@ syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1
syn match zimbuSpaceError display " \+\t"
syn match zimbuSpaceError display "\t\+ "
-syn match zimbuUses contained "uses([a-zA-Z_ ,]*)"
+syn match zimbuUses contained "\<uses([a-zA-Z_ ,]*)"
+syn match zimbuBlockgc contained "blockgc"
syn match zimbuBlockComment contained " #.*"
-syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockComment keepend
+syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockgc,zimbuBlockComment keepend
+
+" Assume long strings and C regions don't take more than 200 lines.
+syn sync minlines=200
-syn sync minlines=2000
+" When we find the start of a long string, without a # or " before it, we are
+" sure to be inside a long string.
+syn sync match zimbuLongStringSync grouphere zimbuLongString +^[^"#]*''\"+
hi def link zimbuBasicType Type
hi def link zimbuCompType Type
@@ -111,17 +135,23 @@ hi def link zimbuStatement Statement
hi def link zimbuOperator Statement
hi def link zimbuMethod PreProc
hi def link zimbuModule PreProc
+hi def link zimbuImport PreProc
hi def link zimbuUses PreProc
+hi def link zimbuBlockgc PreProc
hi def link zimbuAttribute PreProc
hi def link zimbuString Constant
+hi def link zimbuLongString Special
hi def link zimbuChar Constant
hi def link zimbuFixed Constant
hi def link zimbuComment Comment
+hi def link zimbuCommentStart zimbuComment
hi def link zimbuBlockComment Comment
hi def link zimbuCblock Comment
hi def link zimbuTodo Todo
hi def link zimbuParam Constant
+hi def link zimbuCode Statement
hi def link zimbuNoBar Ignore
+hi def link zimbuNoBacktick Ignore
hi def link zimbuSpaceError Error
hi def link zimbuError Error
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
new file mode 100644
index 0000000000..bda4e3537e
--- /dev/null
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -0,0 +1,955 @@
+# Welcome to the VIM Tutor
+
+Vim is a very powerful editor that has many commands, too many to explain in a
+tutor such as this. This tutor is designed to describe enough of the commands
+that you will be able to easily use Vim as an all-purpose editor. It is
+IMPORTANT to remember that this tutor is set up to teach by use. That means
+that you need to do the exercises to learn them properly. If you only read
+the text, you will soon forget what is most important!
+
+NOTE: The commands in the lessons will modify the text, but those changes won't
+be saved. Don't worry about messing things up; just remember that pressing
+[<Esc>](<Esc>) and then [u](u) will undo the latest change.
+
+This tutorial is interactive, and there are a few things you should know.
+Pressing [<Enter>](<Enter>) over text highlighted [like this](holy-grail) will take you to some relevant
+help (hopefully), and pressing K over any word will try to do so too. Sometimes
+you will be required to modify text like
+---> this here {expect:this here}
+Once you have done the changes correctly, the ✗ sign at the left will change
+to ✓. I imagine you can already see how neat Vim can be ;)
+Other times, you'll be prompted to run a command (I'll explain this later):
+~~~ cmd
+ :help <Enter>
+~~~
+or press a sequence of keys
+~~~ normal
+ <Esc>0f<Space>d3wP$P
+~~~
+
+Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text
+to type.
+
+Now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal}
+key enough times to move the cursor so that Lesson 1.1 completely fills the
+screen.
+
+## Lesson 1.1: MOVING THE CURSOR
+
+** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. **
+
+ ↑
+ k Hint: The h key is at the left and moves left.
+ ← h l → The l key is at the right and moves right.
+ j The j key looks like a down arrow.
+ ↓
+
+ 1. Move the cursor around the screen until you are comfortable.
+
+ 2. Hold down the down key (j) until it repeats.
+ Now you know how to move to the next lesson.
+
+ 3. Using the down key, move to Lesson 1.2.
+
+NOTE: If you are ever unsure about something you typed, press <Esc> to place
+ you in Normal mode. Then retype the command you wanted.
+
+NOTE: The cursor keys should also work. But using hjkl you will be able to
+ move around much faster, once you get used to it. Really!
+
+# Lesson 1.2: EXITING VIM
+
+!! NOTE: Before executing any of the steps below, read this entire lesson !!
+
+ 1. Press the <Esc> key (to make sure you are in [Normal mode]().
+
+ 2. Type:
+
+ `:q!`{vim} `<Enter>`{normal}.
+
+ This exits the editor, DISCARDING any changes you have made.
+
+ 3. Open vim and get back here by executing the command that got you into this
+ tutor. That might be:
+
+ :Tutor <Enter>
+
+ 4. If you have these steps memorized and are confident, execute steps
+ 1 through 3 to exit and re-enter the editor.
+
+NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you
+ will learn how to save the changes to a file.
+
+ 5. Move the cursor down to Lesson 1.3.
+
+## Lesson 1.3: TEXT EDITING - DELETION
+
+** Press `x`{normal} to delete the character under the cursor. **
+
+1. Move the cursor to the line below marked --->.
+
+2. To fix the errors, move the cursor until it is on top of the
+ character to be deleted.
+
+3. Press [the x key](x) to delete the unwanted character.
+
+4. Repeat steps 2 through 4 until the sentence is correct.
+
+---> The ccow jumpedd ovverr thhe mooon. {expect:The cow jumped over the moon.}
+
+5. Now that the line is correct, go on to Lesson 1.4.
+
+NOTE: As you go through this tutor, do not try to memorize, learn by usage.
+
+# Lesson 1.4: TEXT EDITING: INSERTION
+
+** Press `i`{normal} to insert text. **
+
+ 1. Move the cursor to the first line below marked --->.
+
+ 2. To make the first line the same as the second, move the cursor on top
+ of the first character AFTER where the text is to be inserted.
+
+ 3. Press i and type in the necessary additions.
+
+ 4. As each error is fixed press <Esc> to return to Normal mode.
+ Repeat steps 2 through 4 to correct the sentence.
+
+---> There is text misng this . {expect:There is some text missing from this line.}
+---> There is some text missing from this line. {expect:There is some text missing from this line.}
+
+ 5. When you are comfortable inserting text move to lesson 1.5.
+
+# Lesson 1.5: TEXT EDITING: APPENDING
+
+** Press `A`{normal} to append text. **
+
+ 1. Move the cursor to the first line below marked --->.
+ It does not matter on what character the cursor is in that line.
+
+ 2. Press [A](A) and type in the necessary additions.
+
+ 3. As the text has been appended press <Esc> to return to Normal mode.
+
+ 4. Move the cursor to the second line marked ---> and repeat
+ steps 2 and 3 to correct this sentence.
+
+---> There is some text missing from th {expect:There is some text missing from this line.}
+---> There is some text missing from this line. {expect:There is some text missing from this line.}
+---> There is also some text miss {expect:There is also some text missing here.}
+---> There is also some text missing here. {expect:There is also some text missing here.}
+
+ 5. When you are comfortable appending text move to lesson 1.6.
+
+# Lesson 1.6: EDITING A FILE
+
+** Use `:wq`{vim} to save a file and exit. **
+
+!! NOTE: Before executing any of the steps below, read this entire lesson !!
+
+ 1. Exit this tutor as you did in lesson 1.2: :q!
+ Or, if you have access to another terminal, do the following there.
+
+ 2. At the shell prompt type this command:
+~~~ sh
+ $ vim tutor
+~~~
+ 'vim' is the command to start the Vim editor, 'tutor' is the name of the
+ file you wish to edit. Use a file that may be changed.
+
+ 3. Insert and delete text as you learned in the previous lessons.
+
+ 4. Save the file with changes and exit Vim with:
+~~~ cmd
+ :wq
+~~~
+
+ Note you'll need to press `<Enter>` to execute the command.
+
+ 5. If you have quit vimtutor in step 1 restart the vimtutor and move down to
+ the following summary.
+
+ 6. After reading the above steps and understanding them: do it.
+
+# Lesson 1 SUMMARY
+
+ 1. The cursor is moved using either the arrow keys or the hjkl keys.
+ h (left) j (down) k (up) l (right)
+
+ 2. To start Vim from the shell prompt type:
+
+~~~ sh
+ $ vim FILENAME
+~~~
+
+ 3. To exit Vim type: <Esc> :q! <Enter> to trash all changes.
+ OR type: <Esc> :wq <Enter> to save the changes.
+
+ 4. To delete the character at the cursor type: `x`{normal}
+
+ 5. To insert or append text type:
+ `i`{normal} type inserted text `<Esc>`{normal} insert before the cursor
+ `A`{normal} type appended text `<Esc>`{normal} append after the line
+
+NOTE: Pressing `<Esc>`{normal} will place you in Normal mode or will cancel
+ an unwanted and partially completed command.
+
+Now continue with Lesson 2.
+
+# Lesson 2.1: DELETION COMMANDS
+
+** Type `dw`{normal} to delete a word. **
+
+ 1. Press `<Esc>`{normal} to make sure you are in Normal mode.
+
+ 2. Move the cursor to the line below marked --->.
+
+ 3. Move the cursor to the beginning of a word that needs to be deleted.
+
+ 4. Type [d](d)[w](w) to make the word disappear.
+
+---> There are a some words fun that don't belong paper in this sentence. {expect:There are some words that don't belong in this sentence.}
+
+ 5. Repeat steps 3 and 4 until the sentence is correct and go to Lesson 2.2.
+
+# Lesson 2.2: MORE DELETION COMMANDS
+
+** Type `d$`{normal} to delete to the end of the line. **
+
+ 1. Press <Esc> to make sure you are in Normal mode.
+
+ 2. Move the cursor to the line below marked --->.
+
+ 3. Move the cursor to the end of the correct line (AFTER the first . ).
+
+ 4. Type `d$`{normal} to delete to the end of the line.
+
+---> Somebody typed the end of this line twice. end of this line twice. {expect:ANYTHING}
+
+ 5. Move on to Lesson 2.3 to understand what is happening.
+
+# Lesson 2.3: ON OPERATORS AND MOTIONS
+
+
+Many commands that change text are made from an [operator](operator) and a [motion](navigation).
+The format for a delete command with the [d](d) delete operator is as follows:
+
+ d motion
+
+ Where:
+ d - is the delete operator.
+ motion - is what the operator will operate on (listed below).
+
+ A short list of motions:
+ [w](w) - until the start of the next word, EXCLUDING its first character.
+ [e](e) - to the end of the current word, INCLUDING the last character.
+ [$]($) - to the end of the line, INCLUDING the last character.
+
+ Thus typing `de`{normal} will delete from the cursor to the end of the word.
+
+NOTE: Pressing just the motion while in Normal mode without an operator will
+ move the cursor as specified.
+
+# Lesson 2.4: USING A COUNT FOR A MOTION
+
+** Typing a number before a motion repeats it that many times. **
+
+ 1. Move the cursor to the start of the line marked ---> below.
+
+ 2. Type `2w`{normal} to move the cursor two words forward.
+
+ 3. Type `3e`{normal} to move the cursor to the end of the third word forward.
+
+ 4. Type `0`{normal} ([zero](0)) to move to the start of the line.
+
+ 5. Repeat steps 2 and 3 with different numbers.
+
+---> This is just a line with words you can move around in. {expect:ANYTHING}
+
+ 6. Move on to Lesson 2.5.
+
+# Lesson 2.5: USING A COUNT TO DELETE MORE
+
+** Typing a number with an operator repeats it that many times. **
+
+In the combination of the delete operator and a motion mentioned above you
+insert a count before the motion to delete more:
+ d number motion
+
+ 1. Move the cursor to the first UPPER CASE word in the line marked --->.
+
+ 2. Type `d2w`{normal} to delete the two UPPER CASE words
+
+ 3. Repeat steps 1 and 2 with a different count to delete the consecutive
+ UPPER CASE words with one command
+
+---> this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. {expect:this line of words is cleaned up.}
+
+# Lesson 2.6: OPERATING ON LINES
+
+** Type dd to delete a whole line. **
+
+ Due to the frequency of whole line deletion, the designers of Vi decided
+ it would be easier to simply type two d's to delete a line.
+
+ 1. Move the cursor to the second line in the phrase below.
+ 2. Type [dd](dd) to delete the line.
+ 3. Now move to the fourth line.
+ 4. Type `2dd`{normal} to delete two lines.
+
+---> 1) Roses are red, {expect:ANYTHING}
+---> 2) Mud is fun, {expect:ANYTHING}
+---> 3) Violets are blue, {expect:ANYTHING}
+---> 4) I have a car, {expect:ANYTHING}
+---> 5) Clocks tell time, {expect:ANYTHING}
+---> 6) Sugar is sweet {expect:ANYTHING}
+---> 7) And so are you. {expect:ANYTHING}
+
+# Lesson 2.7: THE UNDO COMMAND
+
+** Press u to undo the last commands, U to fix a whole line. **
+
+ 1. Move the cursor to the line below marked ---> and place it on the
+ first error.
+ 2. Type `x`{normal} to delete the first unwanted character.
+ 3. Now type `u`{normal} to undo the last command executed.
+ 4. This time fix all the errors on the line using the `x`{normal} command.
+ 5. Now type a capital `U`{normal} to return the line to its original state.
+ 6. Now type `u`{normal} a few times to undo the U and preceding commands.
+ 7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's).
+
+---> Fiix the errors oon thhis line and reeplace them witth undo. {expect:Fix the errors on this line and replace them with undo.}
+
+ 8. These are very useful commands. Now move on to the Lesson 2 Summary.
+
+# Lesson 2 SUMMARY
+
+ 1. To delete from the cursor up to the next word type: `dw`{normal}
+ 2. To delete from the cursor to the end of a line type: `d$`{normal}
+ 3. To delete a whole line type: `dd`{normal}
+ 4. To repeat a motion prepend it with a number: `2w`{normal}
+
+ 5. The format for a change command is:
+ operator [number] motion
+ where:
+ operator - is what to do, such as [d](d) for delete
+ [number] - is an optional count to repeat the motion
+ motion - moves over the text to operate on, such as:
+ [w](w) (word),
+ [$]($) (to the end of line), etc.
+
+ 6. To move to the start of the line use a zero: [0](0)
+
+ 7. To undo previous actions, type: `u`{normal} (lowercase u)
+ To undo all the changes on a line, type: `U`{normal} (capital U)
+ To undo the undo's, type: `<Ctrl-r>`{normal}
+
+# Lesson 3.1: THE PUT COMMAND
+
+** Type p to put previously deleted text after the cursor. **
+
+ 1. Move the cursor to the first ---> line below.
+
+ 2. Type `dd`{normal} to delete the line and store it in a Vim register.
+
+ 3. Move the cursor to the c) line, ABOVE where the deleted line should go.
+
+ 4. Type `p`{normal} to put the line below the cursor.
+
+ 5. Repeat steps 2 through 4 to put all the lines in correct order.
+
+---> d) Can you learn too? {expect:ANYTHING}
+---> b) Violets are blue, {expect:ANYTHING}
+---> c) Intelligence is learned, {expect:ANYTHING}
+---> a) Roses are red, {expect:ANYTHING}
+
+# Lesson 3.2: THE REPLACE COMMAND
+
+** Type `rx`{normal} to replace the character at the cursor with x. **
+
+ 1. Move the cursor to the first line below marked --->.
+
+ 2. Move the cursor so that it is on top of the first error.
+
+ 3. Type `r`{normal} and then the character which should be there.
+
+ 4. Repeat steps 2 and 3 until the first line is equal to the second one.
+
+---> Whan this lime was tuoed in, someone presswd some wrojg keys! {expect:When this line was typed in, someone pressed some wrong keys!}
+---> When this line was typed in, someone pressed some wrong keys! {expect:When this line was typed in, someone pressed some wrong keys!}
+
+ 5. Now move on to Lesson 3.3.
+
+NOTE: Remember that you should be learning by doing, not memorization.
+
+# Lesson 3.3: THE CHANGE OPERATOR
+
+** To change until the end of a word, type `ce`{normal} **
+
+ 1. Move the cursor to the first line below marked --->.
+
+ 2. Place the cursor on the "u" in "lubw".
+
+ 3. Type `ce`{normal} and the correct word (in this case, type "ine" ).
+
+ 4. Press `<Esc>`{normal} and move to the next character that needs to be changed.
+
+ 5. Repeat steps 3 and 4 until the first sentence is the same as the second.
+
+---> This lubw has a few wptfd that mrrf changing usf the change operator. {expect:This line has a few words that need changing using the change operator.}
+---> This line has a few words that need changing using the change operator. {expect:This line has a few words that need changing using the change operator.}
+
+Notice that [c](c)e deletes the word and places you in Insert mode.
+
+# Lesson 3.4: MORE CHANGES USING c
+
+** The change operator is used with the same motions as delete. **
+
+ 1. The change operator works in the same way as delete. The format is:
+
+ c [number] motion
+
+ 2. The motions are the same, such as `w`{normal} (word) and `$`{normal} (end of line).
+
+ 3. Move to the first line below marked --->.
+
+ 4. Move the cursor to the first error.
+
+ 5. Type `c$`{normal} and type the rest of the line like the second and press `<Esc>`{normal}.
+
+---> The end of this line needs some help to make it like the second. {expect:The end of this line needs to be corrected using the c$ command.}
+---> The end of this line needs to be corrected using the c$ command. {expect:The end of this line needs to be corrected using the c$ command.}
+
+NOTE: You can use the Backspace key to correct mistakes while typing.
+
+# Lesson 3 SUMMARY
+
+ 1. To put back text that has just been deleted, type [p](p). This puts the
+ deleted text AFTER the cursor (if a line was deleted it will go on the
+ line below the cursor).
+
+ 2. To replace the character under the cursor, type [r](r) and then the
+ character you want to have there.
+
+ 3. The [change operator](c) allows you to change from the cursor to where the
+ motion takes you. eg. Type `ce`{normal} to change from the cursor to the end of
+ the word, `c$`{normal} to change to the end of a line.
+
+ 4. The format for change is:
+
+ c [number] motion
+
+Now go on to the next lesson.
+
+# Lesson 4.1: CURSOR LOCATION AND FILE STATUS
+
+** Type `<Ctrl-g>`{normal} to show your location in the file and the file status.
+ Type `G`{normal} to move to a line in the file. **
+
+NOTE: Read this entire lesson before executing any of the steps!!
+
+ 1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<Ctrl-g>`{normal}.
+ A message will appear at the bottom of the page with the filename and the
+ position in the file. Remember the line number for Step 3.
+
+NOTE: You may see the cursor position in the lower right corner of the screen
+ This happens when the ['ruler']('ruler') option is set (see :help 'ruler' )
+
+ 2. Press [G](G) to move you to the bottom of the file.
+ Type [gg](gg) to move you to the start of the file.
+
+ 3. Type the number of the line you were on and then `G`{normal} . This will
+ return you to the line you were on when you first pressed `<Ctrl-g>`{normal}.
+
+ 4. If you feel confident to do this, execute steps 1 through 3.
+
+# Lesson 4.2: THE SEARCH COMMAND
+
+** Type `/`{normal} followed by a phrase to search for the phrase. **
+
+ 1. In Normal mode type the `/`{normal} character. Notice that it and the cursor
+ appear at the bottom of the screen as with the : command.
+
+ 2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search for.
+
+ 3. To search for the same phrase again, simply type [n](n) .
+ To search for the same phrase in the opposite direction, type [N](N) .
+
+ 4. To search for a phrase in the backward direction, use [?](?) instead of / .
+
+ 5. To go back to where you came from press `<Ctrl-o>`{normal} (Keep Ctrl down while
+ pressing the letter o). Repeat to go back further. `<Ctrl-i>`{normal} goes forward.
+
+---> "errroor" is not the way to spell error; errroor is an error. {expect:ANYTHING}
+
+NOTE: When the search reaches the end of the file it will continue at the
+ start, unless the ['wrapscan']('wrapscan') option has been reset.
+
+# Lesson 4.3: MATCHING PARENTHESES SEARCH
+
+** Type `%`{normal} to find a matching ),], or }. **
+
+ 1. Place the cursor on any (, [, or { in the line below marked --->.
+
+ 2. Now type the [%](%) character.
+
+ 3. The cursor will move to the matching parenthesis or bracket.
+
+ 4. Type `%`{normal} to move the cursor to the other matching bracket.
+
+ 5. Move the cursor to another (,),[,],{ or } and see what `%`{normal} does.
+
+---> This ( is a test line with ('s, ['s ] and {'s } in it. )) {expect:ANYTHING}
+
+NOTE: This is very useful in debugging a program with unmatched parentheses!
+
+# Lesson 4.4: THE SUBSTITUTE COMMAND
+
+** Type `:s/old/new/g` to substitute "new" for "old". **
+
+ 1. Move the cursor to the line below marked --->.
+
+ 2. Type
+~~~ cmd
+ :s/thee/the/
+~~~
+
+ NOTE that the [:s](:s) command only changed the first occurrence of "thee" in the line.
+
+ 3. Now type
+~~~ cmd
+ :s/thee/the/g
+~~~
+
+ Adding the g [flag](:s_flags) means to substitute globally in the line, change
+ all occurrences of "thee" in the line.
+
+---> thee best time to see thee flowers is in thee spring. {expect:the best time to see the flowers is in the spring.}
+
+ 4. To change every occurrence of a character string between two lines, type
+~~~ cmd
+ :#,#s/old/new/g
+~~~
+ where #,# are the line numbers of the range of lines where the substitution is to be done.
+
+ Type
+~~~ cmd
+ :%s/old/new/g
+~~~
+ to change every occurrence in the whole file.
+
+ Type
+~~~ cmd
+ :%s/old/new/gc
+~~~
+ to find every occurrence in the whole file, with a prompt whether to substitute or not.
+
+# Lesson 4 SUMMARY
+
+ 1. `<Ctrl-g>`{normal} displays your location in the file and the file status.
+ `G`{normal} moves to the end of the file.
+ number `G`{normal} moves to that line number.
+ `gg`{normal} moves to the first line.
+
+ 2. Typing `/`{normal} followed by a phrase searches FORWARD for the phrase.
+ Typing `?`{normal} followed by a phrase searches BACKWARD for the phrase.
+ After a search type `n`{normal} to find the next occurrence in the same direction
+ or `N`{normal} to search in the opposite direction.
+ `<Ctrl-o>`{normal} takes you back to older positions, `<Ctrl-i>`{normal} to newer positions.
+
+ 3. Typing `%`{normal} while the cursor is on a (,),[,],{, or } goes to its match.
+
+ 4. To substitute new for the first old in a line type
+~~~ cmd
+ :s/old/new
+~~~
+ To substitute new for all 'old's on a line type
+~~~ cmd
+ :s/old/new/g
+~~~
+ To substitute phrases between two line #'s type
+~~~ cmd
+ :#,#s/old/new/g
+~~~
+ To substitute all occurrences in the file type
+~~~ cmd
+ :%s/old/new/g
+~~~
+ To ask for confirmation each time add 'c'
+~~~ cmd
+ :%s/old/new/gc
+~~~
+
+# Lesson 5.1: HOW TO EXECUTE AN EXTERNAL COMMAND
+
+** Type `:!`{vim} followed by an external command to execute that command. **
+
+ 1. Type the familiar command `:`{normal} to set the cursor at the bottom of the
+ screen. This allows you to enter a command-line command.
+
+ 2. Now type the [!](!cmd) (exclamation point) character. This allows you to
+ execute any external shell command.
+
+ 3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This
+ will show you a listing of your directory, just as if you were at the
+ shell prompt.
+
+NOTE: It is possible to execute any external command this way, also with
+ arguments.
+
+NOTE: All : commands must be finished by hitting <Enter>
+ From here on we will not always mention it.
+
+# Lesson 5.2: MORE ON WRITING FILES
+
+** To save the changes made to the text, type `:w`{vim} FILENAME. **
+
+ 1. Type `:!ls`{vim} to get a listing of your directory.
+ You already know you must hit `<Enter>`{normal} after this.
+
+ 2. Choose a filename that does not exist yet, such as TEST.
+
+ 3. Now type:
+~~~ cmd
+ :w TEST
+~~~
+ (where TEST is the filename you chose.)
+
+ 4. This saves the whole file (the Vim Tutor) under the name TEST.
+ To verify this, type `:!ls`{vim} again to see your directory.
+
+NOTE: If you were to exit Vim and start it again with vim TEST , the file
+ would be an exact copy of the tutor when you saved it.
+
+ 5. Now remove the file by typing:
+~~~ cmd
+ :!rm TEST
+~~~
+
+# Lesson 5.3: SELECTING TEXT TO WRITE
+
+** To save part of the file, type `v`{normal} motion `:w FILENAME`{vim} **
+
+ 1. Move the cursor to this line.
+
+ 2. Press [v](v) and move the cursor to the fifth item below. Notice that the
+ text is highlighted.
+
+ 3. Press the `:`{normal} character. At the bottom of the screen
+
+ :'<,'>
+
+ will appear.
+
+ 4. Type
+
+ `:w TEST`{vim}
+
+ where TEST is a filename that does not exist yet. Verify that you see
+
+ `:'<,'>w TEST`{vim}
+
+ before you press `<Enter>`{normal}.
+
+ 5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it.
+ Do not remove it yet! We will use it in the next lesson.
+
+NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move
+ the cursor around to make the selection bigger or smaller. Then you can
+ use an operator to do something with the text. For example, `d`{normal} deletes
+ the text.
+
+# Lesson 5.4: RETRIEVING AND MERGING FILES
+
+** To insert the contents of a file, type `:r FILENAME`{vim} **
+
+ 1. Place the cursor just above this line.
+
+NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
+ DOWN to see this lesson again.
+
+ 2. Now retrieve your TEST file using the command
+
+ `:r TEST`{vim}
+
+ where TEST is the name of the file you used.
+ The file you retrieve is placed below the cursor line.
+
+ 3. To verify that a file was retrieved, cursor back and notice that there
+ are now two copies of Lesson 5.3, the original and the file version.
+
+NOTE: You can also read the output of an external command. For example,
+
+ `:r !ls`{vim}
+
+ reads the output of the `ls` command and puts it below the cursor.
+
+# Lesson 5 SUMMARY
+
+ 1. [:!command](:!cmd) executes an external command.
+
+ Some useful examples are:
+ `:!ls`{vim} - shows a directory listing
+ `:!rm FILENAME`{vim} - removes file FILENAME
+
+ 2. [:w](:w) FILENAME writes the current Vim file to disk with
+ name FILENAME.
+
+ 3. [v](v) motion :w FILENAME saves the Visually selected lines in file
+ FILENAME.
+
+ 4. [:r](:r) FILENAME retrieves disk file FILENAME and puts it
+ below the cursor position.
+
+ 5. [:r !dir](:r!) reads the output of the dir command and
+ puts it below the cursor position.
+
+# Lesson 6.1: THE OPEN COMMAND
+
+** Type `o`{normal} to open a line below the cursor and place you in Insert mode. **
+
+ 1. Move the cursor to the line below marked --->.
+
+ 2. Type the lowercase letter `o`{normal} to [open](o) up a line BELOW the cursor and place
+ you in Insert mode.
+
+ 3. Now type some text and press `<Esc>`{normal} to exit Insert mode.
+
+---> After typing o the cursor is placed on the open line in Insert mode. {expect:ANYTHING}
+
+ 4. To open up a line ABOVE the cursor, simply type a [capital O](O), rather
+ than a lowercase `o`{normal}. Try this on the line below.
+
+---> Open up a line above this by typing O while the cursor is on this line. {expect:ANYTHING}
+
+# Lesson 6.2: THE APPEND COMMAND
+
+** Type `a`{normal} to insert text AFTER the cursor. **
+
+ 1. Move the cursor to the start of the line below marked --->.
+
+ 2. Press `e`{normal} until the cursor is on the end of "li".
+
+ 3. Type an `a`{normal} (lowercase) to [append](a) text AFTER the cursor.
+
+ 4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert
+ mode.
+
+ 5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4.
+
+---> This li will allow you to pract appendi text to a line. {expect:This line will allow you to practice appending text to a line.}
+---> This line will allow you to practice appending text to a line. {expect:This line will allow you to practice appending text to a line.}
+
+NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only difference is where
+ the characters are inserted.
+
+# Lesson 6.3: ANOTHER WAY TO REPLACE
+
+** Type a capital `R`{normal} to replace more than one character. **
+
+ 1. Move the cursor to the first line below marked --->. Move the cursor to
+ the beginning of the first "xxx".
+
+ 2. Now press `R`{normal} ([capital R](R)) and type the number below it in the second line, so that it
+ replaces the "xxx".
+
+ 3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line
+ remains unmodified.
+
+ 4. Repeat the steps to replace the remaining "xxx".
+
+---> Adding 123 to xxx gives you xxx. {expect:Adding 123 to 456 gives you 579.}
+---> Adding 123 to 456 gives you 579. {expect:Adding 123 to 456 gives you 579.}
+
+NOTE: Replace mode is like Insert mode, but every typed character deletes an
+ existing character.
+
+# Lesson 6.4: COPY AND PASTE TEXT
+
+** Use the `y`{normal} operator to copy text and `p`{normal} to paste it **
+
+ 1. Go to the line marked with ---> below and place the cursor after "a)".
+
+ 2. Start Visual mode with `v`{normal} and move the cursor to just before "first".
+
+ 3. Type `y`{normal} to [yank](yank) (copy) the highlighted text.
+
+ 4. Move the cursor to the end of the next line: `j$`{normal}
+
+ 5. Type `p`{normal} to [put](put) (paste) the text. Then type: "a second"`<Esc>`{normal}.
+
+ 6. Use Visual mode to select " item.", yank it with `y`{normal}, move to the end of
+ the next line with `j$`{normal} and put the text there with `p`{normal}.
+
+---> a) this is the first item.
+---> b) {expect: b) this is the second item}
+
+ NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word.
+
+# Lesson 6.5: SET OPTION
+
+** Set an option so a search or substitute ignores case **
+
+ 1. Search for 'ignore' by entering: `/ignore`
+ Repeat several times by pressing `n`{normal}.
+
+ 2. Set the 'ic' (Ignore case) option by entering:
+~~~ cmd
+ :set ic
+~~~
+ 3. Now search for 'ignore' again by pressing n
+ Notice that Ignore and IGNORE are now also found.
+
+ 4. Set the 'hlsearch' and 'incsearch' options:
+~~~ cmd
+ :set hls is
+~~~
+ 5. Now type the search command again and see what happens: /ignore <Enter>
+
+ 6. To disable ignoring case enter:
+~~~ cmd
+ :set noic
+~~~
+ 7. To toggle the value of a setting, prepend it with "inv":
+~~~ cmd
+ :set invic
+~~~
+NOTE: To remove the highlighting of matches enter:
+~~~ cmd
+ :nohlsearch
+~~~
+NOTE: If you want to ignore case for just one search command, use [\c](/\c)
+ in the phrase: /ignore\c <Enter>
+
+# Lesson 6 SUMMARY
+
+ 1. Type `o`{normal} to open a line BELOW the cursor and start Insert mode.
+ Type `O`{normal} to open a line ABOVE the cursor.
+
+ 2. Type `a`{normal} to insert text AFTER the cursor.
+ Type `A`{normal} to insert text after the end of the line.
+
+ 3. The `e`{normal} command moves to the end of a word.
+
+ 4. The `y`{normal} operator yanks (copies) text, `p`{normal} puts (pastes) it.
+
+ 5. Typing a capital `R`{normal} enters Replace mode until `<Esc>`{normal} is pressed.
+
+ 6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are:
+
+ 'ic' 'ignorecase' ignore upper/lower case when searching
+ 'is' 'incsearch' show partial matches for a search phrase
+ 'hls' 'hlsearch' highlight all matching phrases
+
+ You can either use the long or the short option name.
+
+ 7. Prepend "no" to switch an option off:
+~~~ cmd
+ :set noic
+~~~
+ 8. Prepend "inv" to toggle an option:
+~~~ cmd
+ :set invic
+~~~
+
+# Lesson 7.1: GETTING HELP
+
+** Use the on-line help system **
+
+Vim has a comprehensive on-line help system. To get started, try one of
+these three:
+ - press the `<HELP>`{normal} key (if you have one)
+ - press the `<F1>`{normal} key (if you have one)
+ - type
+ `:help`{vim}
+
+Read the text in the help window to find out how the help works.
+Type `<Ctrl-w><Ctrl-w>`{normal} to jump from one window to another.
+Type `:q`{vim} to close the help window.
+
+You can find help on just about any subject, by giving an argument to the
+":help" command. Try these (don't forget pressing <Enter>):
+~~~ cmd
+ :help w
+ :help c_CTRL-D
+ :help insert-index
+ :help user-manual
+~~~
+# Lesson 7.2: CREATE A STARTUP SCRIPT
+
+** Enable Vim features **
+
+Vim has many more features than Vi, but most of them are disabled by
+default. To start using more features you have to create a "vimrc" file.
+
+ 1. Start editing the "vimrc" file. This depends on your system:
+ `:e ~/.vimrc`{vim} for Unix-like systems
+ `:e $VIM/_vimrc`{vim} for Microsoft Windows
+
+ 2. Now read the example "vimrc" file contents:
+ `:r $VIMRUNTIME/vimrc_example.vim`{vim}
+
+ 3. Write the file with:
+ `:w`{vim}
+
+ The next time you start Vim it will use syntax highlighting.
+ You can add all your preferred settings to this "vimrc" file.
+ For more information type :help vimrc-intro
+
+# Lesson 7.3: COMPLETION
+
+** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal} **
+
+ 1. Look what files exist in the directory: `:!ls`{vim}
+
+ 2. Type the start of a command: `:e`{vim}
+
+ 3. Press `<Ctrl-d>`{normal} and Vim will show a list of commands that start with "e".
+
+ 4. Press `<Tab>`{normal} and Vim will complete the command name to ":edit".
+
+ 5. Now add a space and the start of an existing file name: `:edit FIL`{vim}
+
+ 6. Press `<Tab>`{normal}. Vim will complete the name (if it is unique).
+
+NOTE: Completion works for many commands. It is especially useful for `:help`{vim}.
+
+# Lesson 7 SUMMARY
+
+ 1. Type `:help`{vim}
+ or press `<F1>`{normal} or `<Help>`{normal} to open a help window.
+
+ 2. Type `:help TOPIC`{vim} to find help on TOPIC.
+
+ 3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window
+
+ 4. Type `:q`{vim} to close the help window
+
+ 5. Create a vimrc startup script to keep your preferred settings.
+
+ 6. While in command mode, press `<Ctrl-d>`{normal} to see possible completions.
+ Press `<Tab>`{normal} to use one completion.
+
+# CONCLUSION
+
+This was intended to give a brief overview of the Vim editor, just enough to
+allow you to use the editor fairly easily. It is far from complete as Vim has
+many many more commands. Consult the help often.
+
+There are many resources online to learn more about vim. Here's a bunch of them:
+
+- *Learn Vim Progressively*: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
+- *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/
+- Vimcasts: http://vimcasts.org/
+- Vim Video-Tutorials by Derek Wyatt: http://derekwyatt.org/vim/tutorials/
+- *Learn Vimscript the Hard Way*: http://learnvimscriptthehardway.stevelosh.com/
+- *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html
+
+If you prefer a book, *Practival Vim* by Drew Neil is recommended often.
+
+This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
+School of Mines using ideas supplied by Charles Smith, Colorado State
+University. E-mail: bware@mines.colorado.edu.
+
+Modified for Vim by Bram Moolenaar.
+Modified for vim-tutor-mode by Felipe Morales.
diff --git a/runtime/tutor/tutor.tutor b/runtime/tutor/tutor.tutor
new file mode 100644
index 0000000000..852c1ea74a
--- /dev/null
+++ b/runtime/tutor/tutor.tutor
@@ -0,0 +1,259 @@
+# CREATING A VIM TUTORIAL WITH VIM-TUTOR-MODE
+
+This tutorial will guide you through the steps required to create a tutorial
+file for vim-tutor-mode. It is also meant as a demo of vim-tutor-mode
+capabilities.
+
+Table of contents:
+
+- [Setting up](*setting-up*)
+- [vim-tutor-mode's markup](*markup*)
+ - [emphasis](*emphasis*)
+ - [headers](*headers*)
+ - [links](*links*)
+ - [codeblocks](*codeblocks*)
+- [Interactive elements](*interactive*)
+ - [expect](*expect*)
+
+## SETTING UP *setting-up*
+
+First, you'll need to enable "debug" mode
+~~~ cmd
+ :let g:tutor_debug = 1
+~~~
+This will allow saving changes to the tutor files and will disable conceals, so
+you can more easily check your changes.
+
+After this, create a new .tutor file (we will be practicing on this very file, so you
+don't need to do this now):
+~~~ cmd
+ :e new-tutorial.tutor
+~~~
+
+## VIM-TUTOR-MODE's MARKDOWN *markup*
+
+vim-tutor-mode uses a subset of markdown's syntax to format the tutorials. The
+subset supported should be enough for most tutorials and the maintainers will
+try to keep it as small as possible (if regular markdown allows for several
+ways to do the same thing, tutor markdown will only provide the one the
+maintainers think is easier to handle).
+
+### Emphasis *emphasis*
+
+For emphasized text (italics), as in normal markdown, you use \*. E.g.:
+
+ \*text\*
+
+is displayed like
+
+ *text*
+
+Note: The underscores variant is not supported.
+
+For strong emphasis (bold), you use \*\*. E.g.:
+
+ \*\*this\*\*
+
+is displayed like
+
+ **this**
+
+1. Format the line below so it becomes a lesson description:
+
+---> This is text with importat information {expect:This is text with **important information**}
+---> This is text with **important information** {expect:This is text with **important information**}
+
+Note: Some words (e.g., NOTE, IMPORTANT, tip, ATTENTION, etc.) will also be
+highlighted. You don't need to mark them specially.
+
+2. Turn the line below into a TODO item:
+
+---> Document '&variable' {expect:TODO: Document '&variable'}
+---> TODO: Document '&variable' {expect:TODO: Document '&variable'}
+
+### Headers *headers*
+
+3. Practice fixing the lines below:
+
+---> This is a level 1 header {expect:# This is a level 1 header}
+---> # This is a level 1 header {expect:# This is a level 1 header}
+---> This is a level 3 header {expect:### This is a level 3 header}
+---> ### This is a level 3 header {expect:### This is a level 3 header}
+---> This is a header with a label {expect:# This is a header with a label {*label*}}
+---> # This is a header with a label {*label*} {expect:# This is a header with a label {*label*}}
+
+4. Now, create a 4th level section here, and add a label like in the previous
+exercise:
+
+
+
+ ATTENTION We will use this label later, so remember it.
+
+### Links *links*
+
+It is good practice to include links in your tutorials to reference materials,
+like vim's own help or external documents. You can also link to other parts of
+the document.
+
+Links have the syntax
+
+ \[label\]\(target\)
+
+#### Help links
+
+If the target of a link matches a help topic, opening it will open it.
+
+5. Fix the following line:
+
+---> A link to help for the 'breakindent' option {expect:A link to help for the ['breakindent']('breakindent') option}
+---> A link to help for the ['breakindent']('breakindent') option {expect:A link to help for the ['breakindent']('breakindent') option}
+
+#### Anchor links
+
+A link can also lead to a place in the file itself. Anchors are written
+
+ \*anchor\*
+
+and are hidden by default. Links to them look like
+
+ \[label\]\(\*anchor\*\)
+
+6. Add the appropiate link:
+
+---> A link to the Links section {expect:A link to the [Links](*links*) section}
+---> A link to the [Links](*links*) section {expect:A link to the [Links](*links*) section}
+
+7. Now, create a link to the section you created on exercise 4
+ above.
+
+
+
+# Tutorial links
+
+You can also have links to other tutorials. For this, you'll write the wnchor in the format
+
+ @tutor:TUTORIAL
+
+7. Create a link to this tutorial:
+
+---> A link to the vim-tutor-mode tutorial {expect:A link to [the vim-tutor-mode tutorial](@tutor:tutor)}
+---> A link to [the vim-tutor-mode tutorial](@tutor:tutor) {expect:A link to [the vim-tutor-mode tutorial](@tutor:tutor)}
+
+### Codeblocks *codeblocks*
+
+vim-tutor-mode tutorials can include viml sections
+
+ ~~~ cmd
+ echom "hello"
+ ~~~
+
+is displayed as
+~~~ cmd
+echom "hello"
+~~~
+
+8. Copy the viml section below
+
+---> {expect:~~~ viml}
+---> {expect:echom "the value of &number is".string(&number)}
+---> {expect:~~~}
+
+---> ~~~ viml {expect:~~~ viml}
+---> echom "the value of &number is".string(&number) {expect:echom "the value of &number is".string(&number)}
+---> ~~~ {expect:~~~}
+
+You can inline viml code using "\`" and "\`{vim}":
+
+ \`call myFunction()\`{vim}
+
+is displayed as
+
+ `call myFunction()`{vim}
+
+[normal](Normal-mode) commands can also be embedded in tutorials.
+
+ ~~~ normal
+ ftdaW
+ ~~~
+
+is displayed as
+~~~ normal
+ftdaW
+~~~
+
+Note: you can also write `norm` or `normal`.
+
+9. Copy the normal section below
+
+---> {expect:~~~ normal}
+---> {expect:d2w}
+---> {expect:~~~}
+
+---> ~~~ normal {expect:~~~ normal}
+---> d2w {expect:d2w}
+---> ~~~ {expect:~~~}
+
+You can also inline normal commands by using "\`" and "\`{normal}":
+
+ \`gq\`{normal} is very useful.
+
+is displayed:
+
+ `gq`{normal} is very useful.
+
+10. Complete the line as shown
+
+---> d {expect:«d2w»}
+---> «d2w» {expect:«d2w»}
+
+Commands to run in the system shell can be highlighted by indenting a line starting with "$".
+
+~~~ sh
+ $ vim --version
+~~~
+
+## INTERACTIVE ELEMENTS *interactive*
+
+As visible in this very document, vim-tutor-mode includes some interactive
+elements, to provide feedback to the user about his progress. These elements
+all have the syntax
+
+ \---> TEXT {CLAUSE}
+
+where \---> must start at the beginning of the line. If TEXT satisfies CLAUSE,
+a ✓ sign will appear to the left. A ✗ sign is displayed otherwise. The CLAUSE
+itself is hidden unless debug mode is set or ['conceallevel']('conceallevel')
+is 2.
+
+### expect *expect*
+
+The basic clause is "expect", which is satisfied if TEXT is the same as the
+content of the clause. For example
+
+ \---> TEXT {expect:TEXT}
+
+is satisfied, but
+
+ \---> OTHER TEXT {expect:TEXT}
+
+is not.
+
+13. Make both lines the same:
+
+---> this is not right {expect:---> this is right} |expect:---> this is right {expect:---> this is right}|
+---> ---> this is right {expect:---> this is right} |expect:---> this is right {expect:---> this is right}|
+
+
+If the content of a expect clause is ANYTHING, no checks will be performed. This is
+useful to create a line that is highlighted you want the user to play with.
+
+ \---> TEXT {expect:ANYTHING}
+
+is displayed
+
+---> this is free text {expect:ANYTHING}
+
+14. Turn the line below into free text:
+
+---> this is some text |expect:---> this is some text {expect:ANYTHING}|
+---> ---> this is some text {expect:ANYTHING} |expect:---> this is some text {expect:ANYTHING}|