mirror of
https://github.com/neovim/neovim.git
synced 2025-11-28 21:20:45 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -254,7 +254,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.5")
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.5")
|
||||||
# Array-bounds testing is broken in some GCC versions before 4.8.5.
|
# Array-bounds testing is broken in some GCC versions before 4.8.5.
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
|
||||||
add_definitions(-Wno-array-bounds)
|
check_c_compiler_flag(-Wno-array-bounds HAS_NO_ARRAY_BOUNDS_FLAG)
|
||||||
|
if(HAS_NO_ARRAY_BOUNDS_FLAG)
|
||||||
|
add_definitions(-Wno-array-bounds)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -344,6 +347,21 @@ if(FEAT_TUI)
|
|||||||
find_package(Unibilium REQUIRED)
|
find_package(Unibilium REQUIRED)
|
||||||
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <unibilium.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
return unibi_num_from_var(unibi_var_from_num(0));
|
||||||
|
}
|
||||||
|
" UNIBI_HAS_VAR_FROM)
|
||||||
|
if(UNIBI_HAS_VAR_FROM)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_UNIBI_HAS_VAR_FROM")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(LibTermkey REQUIRED)
|
find_package(LibTermkey REQUIRED)
|
||||||
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
|
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ foreach(DF ${DOCFILES})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_target(helptags
|
add_custom_target(helptags
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${GENERATED_RUNTIME_DIR}/doc
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc
|
${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc
|
||||||
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
|
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ endfunction
|
|||||||
|
|
||||||
function! remote#define#AutocmdOnHost(host, method, sync, name, opts)
|
function! remote#define#AutocmdOnHost(host, method, sync, name, opts)
|
||||||
let group = s:GetNextAutocmdGroup()
|
let group = s:GetNextAutocmdGroup()
|
||||||
let forward = '"doau '.group.' '.a:name.' ".'.'expand("<amatch>")'
|
let forward = '"doau '.group.' '.a:name.' ".'
|
||||||
|
\ . 'fnameescape(expand("<amatch>"))'
|
||||||
let a:opts.group = group
|
let a:opts.group = group
|
||||||
let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts)
|
let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts)
|
||||||
\ .' call remote#define#AutocmdBootstrap("'.a:host.'"'
|
\ .' call remote#define#AutocmdBootstrap("'.a:host.'"'
|
||||||
|
|||||||
@@ -1271,7 +1271,7 @@ Commands for changing the working directory can be suffixed with a bang "!"
|
|||||||
|
|
||||||
*:lcd-*
|
*:lcd-*
|
||||||
:lcd[!] - Change to the previous current directory (before the
|
:lcd[!] - Change to the previous current directory (before the
|
||||||
previous ":tcd {path}" command).
|
previous ":lcd {path}" command).
|
||||||
|
|
||||||
*:pw* *:pwd* *E187*
|
*:pw* *:pwd* *E187*
|
||||||
:pw[d] Print the current directory name.
|
:pw[d] Print the current directory name.
|
||||||
|
|||||||
@@ -3270,11 +3270,10 @@ improve screen updating rates (see |:syn-sync| for more on this). >
|
|||||||
The g:vimsyn_embed option allows users to select what, if any, types of
|
The g:vimsyn_embed option allows users to select what, if any, types of
|
||||||
embedded script highlighting they wish to have. >
|
embedded script highlighting they wish to have. >
|
||||||
|
|
||||||
g:vimsyn_embed == 0 : don't embed any scripts
|
g:vimsyn_embed == 0 : disable (don't embed any scripts)
|
||||||
g:vimsyn_embed =~ 'P' : support embedded python
|
g:vimsyn_embed == 'lPr' : support embedded lua, python and ruby
|
||||||
<
|
<
|
||||||
By default, g:vimsyn_embed is a string supporting interpreters that your vim
|
This option is disabled by default.
|
||||||
itself supports.
|
|
||||||
*g:vimsyn_folding*
|
*g:vimsyn_folding*
|
||||||
|
|
||||||
Some folding is now supported with syntax/vim.vim: >
|
Some folding is now supported with syntax/vim.vim: >
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
" #############################################################################
|
" #############################################################################
|
||||||
" #############################################################################
|
" #############################################################################
|
||||||
" Note: Be careful when merging the upstream version of this file.
|
" Note: Be careful when merging the upstream version of this file.
|
||||||
" Much of this is generated by scripts/genvimvim.lua (result is installed
|
" Much of this is generated by scripts/genvimvim.lua
|
||||||
" to: $VIMRUNTIME/syntax/vim/generated.vim)
|
" (installs to $VIMRUNTIME/syntax/vim/generated.vim)
|
||||||
" #############################################################################
|
" #############################################################################
|
||||||
" #############################################################################
|
" #############################################################################
|
||||||
|
|
||||||
@@ -128,6 +128,13 @@ if exists("g:vimsyntax_noerror")
|
|||||||
let g:vimsyn_noerror= g:vimsyntax_noerror
|
let g:vimsyn_noerror= g:vimsyntax_noerror
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Variable options {{{2
|
||||||
|
if exists("g:vim_maxlines")
|
||||||
|
let s:vimsyn_maxlines= g:vim_maxlines
|
||||||
|
else
|
||||||
|
let s:vimsyn_maxlines= 60
|
||||||
|
endif
|
||||||
|
|
||||||
" Numbers {{{2
|
" Numbers {{{2
|
||||||
" =======
|
" =======
|
||||||
syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand
|
syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand
|
||||||
@@ -601,7 +608,7 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e
|
|||||||
" g:vimsyn_embed =~# 'r' : embed ruby
|
" g:vimsyn_embed =~# 'r' : embed ruby
|
||||||
" g:vimsyn_embed =~# 't' : embed tcl
|
" g:vimsyn_embed =~# 't' : embed tcl
|
||||||
if !exists("g:vimsyn_embed")
|
if !exists("g:vimsyn_embed")
|
||||||
let g:vimsyn_embed= "lpPr"
|
let g:vimsyn_embed= 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" [-- lua --] {{{3
|
" [-- lua --] {{{3
|
||||||
@@ -744,9 +751,10 @@ if !filereadable(s:mzschemepath)
|
|||||||
endif
|
endif
|
||||||
if g:vimsyn_embed =~# 'm' && filereadable(s:mzschemepath)
|
if g:vimsyn_embed =~# 'm' && filereadable(s:mzschemepath)
|
||||||
unlet! b:current_syntax
|
unlet! b:current_syntax
|
||||||
let iskKeep= &isk
|
let s:iskKeep= &isk
|
||||||
exe "syn include @vimMzSchemeScript ".s:mzschemepath
|
exe "syn include @vimMzSchemeScript ".s:mzschemepath
|
||||||
let &isk= iskKeep
|
let &isk= s:iskKeep
|
||||||
|
unlet s:iskKeep
|
||||||
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript
|
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript
|
||||||
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript
|
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript
|
||||||
syn cluster vimFuncBodyList add=vimMzSchemeRegion
|
syn cluster vimFuncBodyList add=vimMzSchemeRegion
|
||||||
@@ -761,11 +769,7 @@ unlet s:mzschemepath
|
|||||||
if exists("g:vimsyn_minlines")
|
if exists("g:vimsyn_minlines")
|
||||||
exe "syn sync minlines=".g:vimsyn_minlines
|
exe "syn sync minlines=".g:vimsyn_minlines
|
||||||
endif
|
endif
|
||||||
if exists("g:vimsyn_maxlines")
|
exe "syn sync maxlines=".s:vimsyn_maxlines
|
||||||
exe "syn sync maxlines=".g:vimsyn_maxlines
|
|
||||||
else
|
|
||||||
syn sync maxlines=60
|
|
||||||
endif
|
|
||||||
syn sync linecont "^\s\+\\"
|
syn sync linecont "^\s\+\\"
|
||||||
syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
|
syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
|
||||||
|
|
||||||
@@ -778,7 +782,7 @@ if !exists("skip_vim_syntax_inits")
|
|||||||
hi def link vimBehaveError vimError
|
hi def link vimBehaveError vimError
|
||||||
hi def link vimCollClassErr vimError
|
hi def link vimCollClassErr vimError
|
||||||
hi def link vimErrSetting vimError
|
hi def link vimErrSetting vimError
|
||||||
hi def link vimEmbedError vimError
|
hi def link vimEmbedError Normal
|
||||||
hi def link vimFTError vimError
|
hi def link vimFTError vimError
|
||||||
hi def link vimFunctionError vimError
|
hi def link vimFunctionError vimError
|
||||||
hi def link vimFunc vimError
|
hi def link vimFunc vimError
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ relevant help (hopefully), and pressing K over any word will try to do so too.
|
|||||||
Sometimes you will be required to modify text like
|
Sometimes you will be required to modify text like
|
||||||
this here
|
this here
|
||||||
Once you have done the changes correctly, the ✗ sign at the left will change
|
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 ;)
|
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):
|
Other times, you'll be prompted to run a command (I'll explain this later):
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:help <Enter>
|
:help <Enter>
|
||||||
@@ -36,30 +36,30 @@ or press a sequence of keys
|
|||||||
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text
|
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text
|
||||||
to type.
|
to type.
|
||||||
|
|
||||||
Now, move to the next lesson (remember, use j).
|
Now, move to the next lesson (remember, use the `j`{normal} key to scroll down).
|
||||||
|
|
||||||
## Lesson 1.1: MOVING THE CURSOR
|
## Lesson 1.1: MOVING THE CURSOR
|
||||||
|
|
||||||
** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. **
|
** 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.
|
k Hint: The `h`{normal} key is at the left and moves left.
|
||||||
← h l → The l key is at the right and moves right.
|
← h l → The `l`{normal} key is at the right and moves right.
|
||||||
j The j key looks like a down arrow.
|
j The `j`{normal} key looks like a down arrow.
|
||||||
↓
|
↓
|
||||||
|
|
||||||
1. Move the cursor around the screen until you are comfortable.
|
1. Move the cursor around the screen until you are comfortable.
|
||||||
|
|
||||||
2. Hold down the down key (j) until it repeats.
|
2. Hold down the down key (`j`{normal}) until it repeats.
|
||||||
Now you know how to move to the next lesson.
|
Now you know how to move to the next lesson.
|
||||||
|
|
||||||
3. Using the down key, move to Lesson 1.2.
|
3. Using the down key, move to Lesson 1.2.
|
||||||
|
|
||||||
NOTE: If you are ever unsure about something you typed, press <Esc> to place
|
NOTE: If you are ever unsure about something you typed, press <Esc> to place
|
||||||
you in Normal mode. Then retype the command you wanted.
|
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
|
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!
|
move around much faster, once you get used to it. Really!
|
||||||
|
|
||||||
# Lesson 1.2: EXITING VIM
|
# Lesson 1.2: EXITING VIM
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
|
|||||||
4. If you have these steps memorized and are confident, execute steps
|
4. If you have these steps memorized and are confident, execute steps
|
||||||
1 through 3 to exit and re-enter the editor.
|
1 through 3 to exit and re-enter the editor.
|
||||||
|
|
||||||
NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you
|
NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you
|
||||||
will learn how to save the changes to a file.
|
will learn how to save the changes to a file.
|
||||||
|
|
||||||
5. Move the cursor down to Lesson 1.3.
|
5. Move the cursor down to Lesson 1.3.
|
||||||
@@ -90,18 +90,18 @@ NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you
|
|||||||
|
|
||||||
** Press `x`{normal} to delete the character under the cursor. **
|
** Press `x`{normal} to delete the character under the cursor. **
|
||||||
|
|
||||||
1. Move the cursor to the line below marked --->.
|
1. Move the cursor to the line below marked --->.
|
||||||
|
|
||||||
2. To fix the errors, move the cursor until it is on top of the
|
2. To fix the errors, move the cursor until it is on top of the
|
||||||
character to be deleted.
|
character to be deleted.
|
||||||
|
|
||||||
3. Press [the x key](x) to delete the unwanted character.
|
3. Press [the x key](x) to delete the unwanted character.
|
||||||
|
|
||||||
4. Repeat steps 2 through 4 until the sentence is correct.
|
4. Repeat steps 2 through 4 until the sentence is correct.
|
||||||
|
|
||||||
The ccow jumpedd ovverr thhe mooon.
|
The ccow jumpedd ovverr thhe mooon.
|
||||||
|
|
||||||
5. Now that the line is correct, go on to Lesson 1.4.
|
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.
|
NOTE: As you go through this tutor, do not try to memorize, learn by usage.
|
||||||
|
|
||||||
@@ -114,15 +114,15 @@ NOTE: As you go through this tutor, do not try to memorize, learn by usage.
|
|||||||
2. To make the first line the same as the second, move the cursor on top
|
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.
|
of the first character AFTER where the text is to be inserted.
|
||||||
|
|
||||||
3. Press i and type in the necessary additions.
|
3. Press `i`{normal} and type in the necessary additions.
|
||||||
|
|
||||||
4. As each error is fixed press <Esc> to return to Normal mode.
|
4. As each error is fixed press `<Esc>`{normal} to return to Normal mode.
|
||||||
Repeat steps 2 through 4 to correct the sentence.
|
Repeat steps 2 through 4 to correct the sentence.
|
||||||
|
|
||||||
There is text misng this .
|
There is text misng this .
|
||||||
There is some text missing from this line.
|
There is some text missing from this line.
|
||||||
|
|
||||||
5. When you are comfortable inserting text move to lesson 1.5.
|
5. When you are comfortable inserting text move to Lesson 1.5.
|
||||||
|
|
||||||
# Lesson 1.5: TEXT EDITING: APPENDING
|
# Lesson 1.5: TEXT EDITING: APPENDING
|
||||||
|
|
||||||
@@ -131,9 +131,9 @@ There is some text missing from this line.
|
|||||||
1. Move the cursor to the first line below marked --->.
|
1. Move the cursor to the first line below marked --->.
|
||||||
It does not matter on what character the cursor is in that line.
|
It does not matter on what character the cursor is in that line.
|
||||||
|
|
||||||
2. Press [A](A) and type in the necessary additions.
|
2. Press [A](A) and type in the necessary additions.
|
||||||
|
|
||||||
3. As the text has been appended press <Esc> to return to Normal mode.
|
3. As the text has been appended press `<Esc>`{normal} to return to Normal mode.
|
||||||
|
|
||||||
4. Move the cursor to the second line marked ---> and repeat
|
4. Move the cursor to the second line marked ---> and repeat
|
||||||
steps 2 and 3 to correct this sentence.
|
steps 2 and 3 to correct this sentence.
|
||||||
@@ -143,7 +143,7 @@ There is some text missing from this line.
|
|||||||
There is also some text miss
|
There is also some text miss
|
||||||
There is also some text missing here.
|
There is also some text missing here.
|
||||||
|
|
||||||
5. When you are comfortable appending text move to lesson 1.6.
|
5. When you are comfortable appending text move to Lesson 1.6.
|
||||||
|
|
||||||
# Lesson 1.6: EDITING A FILE
|
# Lesson 1.6: EDITING A FILE
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ There is also some text missing here.
|
|||||||
|
|
||||||
!! NOTE: Before executing any of the steps below, read this entire lesson !!
|
!! NOTE: Before executing any of the steps below, read this entire lesson !!
|
||||||
|
|
||||||
1. Exit this tutor as you did in lesson 1.2: :q!
|
1. Exit this tutor as you did in Lesson 1.2: `:q!`{vim}
|
||||||
Or, if you have access to another terminal, do the following there.
|
Or, if you have access to another terminal, do the following there.
|
||||||
|
|
||||||
2. At the shell prompt type this command:
|
2. At the shell prompt type this command:
|
||||||
@@ -159,7 +159,7 @@ There is also some text missing here.
|
|||||||
$ vim tutor
|
$ vim tutor
|
||||||
~~~
|
~~~
|
||||||
'vim' is the command to start the Vim editor, 'tutor' is the name of the
|
'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.
|
file you wish to edit. Use a file that may be changed.
|
||||||
|
|
||||||
3. Insert and delete text as you learned in the previous lessons.
|
3. Insert and delete text as you learned in the previous lessons.
|
||||||
|
|
||||||
@@ -186,14 +186,14 @@ There is also some text missing here.
|
|||||||
$ vim FILENAME
|
$ vim FILENAME
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
3. To exit Vim type: <Esc> :q! <Enter> to trash all changes.
|
3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
|
||||||
OR type: <Esc> :wq <Enter> to save the changes.
|
OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes.
|
||||||
|
|
||||||
4. To delete the character at the cursor type: `x`{normal}
|
4. To delete the character at the cursor type: `x`{normal}
|
||||||
|
|
||||||
5. To insert or append text type:
|
5. To insert or append text type:
|
||||||
`i`{normal} type inserted text `<Esc>`{normal} insert before the cursor
|
`i`{normal} insert text `<Esc>`{normal} insert before the cursor.
|
||||||
`A`{normal} type appended text `<Esc>`{normal} append after the line
|
`A`{normal} append text `<Esc>`{normal} append after the line.
|
||||||
|
|
||||||
NOTE: Pressing `<Esc>`{normal} will place you in Normal mode or will cancel
|
NOTE: Pressing `<Esc>`{normal} will place you in Normal mode or will cancel
|
||||||
an unwanted and partially completed command.
|
an unwanted and partially completed command.
|
||||||
@@ -210,7 +210,7 @@ Now continue with Lesson 2.
|
|||||||
|
|
||||||
3. Move the cursor to the beginning of a word that needs to be deleted.
|
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.
|
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.
|
There are a some words fun that don't belong paper in this sentence.
|
||||||
|
|
||||||
@@ -218,9 +218,9 @@ There are a some words fun that don't belong paper in this sentence.
|
|||||||
|
|
||||||
# Lesson 2.2: MORE DELETION COMMANDS
|
# Lesson 2.2: MORE DELETION COMMANDS
|
||||||
|
|
||||||
** Type `d$`{normal} to delete to the end of the line. **
|
** Type `d$`{normal} to delete to the end of the line. **
|
||||||
|
|
||||||
1. Press <Esc> to make sure you are in Normal mode.
|
1. Press `<Esc>`{normal} to make sure you are in Normal mode.
|
||||||
|
|
||||||
2. Move the cursor to the line below marked --->.
|
2. Move the cursor to the line below marked --->.
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ Somebody typed the end of this line twice. end of this line twice.
|
|||||||
|
|
||||||
|
|
||||||
Many commands that change text are made from an [operator](operator) and a [motion](navigation).
|
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:
|
The format for a delete command with the [d](d) delete operator is as follows:
|
||||||
|
|
||||||
d motion
|
d motion
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ The format for a delete command with the [d](d) delete operator is as follows:
|
|||||||
[e](e) - to the end of the current word, INCLUDING the last character.
|
[e](e) - to the end of the current word, INCLUDING the last character.
|
||||||
[$]($) - to the end of the line, 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.
|
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
|
NOTE: Pressing just the motion while in Normal mode without an operator will
|
||||||
move the cursor as specified.
|
move the cursor as specified.
|
||||||
@@ -260,11 +260,11 @@ NOTE: Pressing just the motion while in Normal mode without an operator will
|
|||||||
|
|
||||||
1. Move the cursor to the start of the line marked ---> below.
|
1. Move the cursor to the start of the line marked ---> below.
|
||||||
|
|
||||||
2. Type `2w`{normal} to move the cursor two words forward.
|
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.
|
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.
|
4. Type `0`{normal} ([zero](0)) to move to the start of the line.
|
||||||
|
|
||||||
5. Repeat steps 2 and 3 with different numbers.
|
5. Repeat steps 2 and 3 with different numbers.
|
||||||
|
|
||||||
@@ -282,22 +282,22 @@ insert a count before the motion to delete more:
|
|||||||
|
|
||||||
1. Move the cursor to the first UPPER CASE word in the line marked --->.
|
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
|
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
|
3. Repeat steps 1 and 2 with a different count to delete the consecutive
|
||||||
UPPER CASE words with one command
|
UPPER CASE words with one command
|
||||||
|
|
||||||
this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
||||||
|
|
||||||
# Lesson 2.6: OPERATING ON LINES
|
# Lesson 2.6: OPERATING ON LINES
|
||||||
|
|
||||||
** Type dd to delete a whole line. **
|
** Type `dd`{normal} to delete a whole line. **
|
||||||
|
|
||||||
Due to the frequency of whole line deletion, the designers of Vi decided
|
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.
|
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.
|
1. Move the cursor to the second line in the phrase below.
|
||||||
2. Type [dd](dd) to delete the line.
|
2. Type [dd](dd) to delete the line.
|
||||||
3. Now move to the fourth line.
|
3. Now move to the fourth line.
|
||||||
4. Type `2dd`{normal} to delete two lines.
|
4. Type `2dd`{normal} to delete two lines.
|
||||||
|
|
||||||
@@ -311,20 +311,20 @@ this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
|||||||
|
|
||||||
# Lesson 2.7: THE UNDO COMMAND
|
# Lesson 2.7: THE UNDO COMMAND
|
||||||
|
|
||||||
** Press u to undo the last commands, U to fix a whole line. **
|
** Press `u`{normal} to undo the last commands, `U`{normal} to fix a whole line. **
|
||||||
|
|
||||||
1. Move the cursor to the line below marked ---> and place it on the
|
1. Move the cursor to the line below marked ---> and place it on the
|
||||||
first error.
|
first error.
|
||||||
2. Type `x`{normal} to delete the first unwanted character.
|
2. Type `x`{normal} to delete the first unwanted character.
|
||||||
3. Now type `u`{normal} to undo the last command executed.
|
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.
|
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.
|
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.
|
6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding commands.
|
||||||
7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's).
|
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.
|
Fiix the errors oon thhis line and reeplace them witth undo.
|
||||||
|
|
||||||
8. These are very useful commands. Now move on to the Lesson 2 Summary.
|
8. These are very useful commands. Now move on to the Lesson 2 Summary.
|
||||||
|
|
||||||
# Lesson 2 SUMMARY
|
# Lesson 2 SUMMARY
|
||||||
|
|
||||||
@@ -336,13 +336,13 @@ Fiix the errors oon thhis line and reeplace them witth undo.
|
|||||||
5. The format for a change command is:
|
5. The format for a change command is:
|
||||||
operator [number] motion
|
operator [number] motion
|
||||||
where:
|
where:
|
||||||
operator - is what to do, such as [d](d) for delete
|
operator - is what to do, such as [d](d) for delete
|
||||||
[number] - is an optional count to repeat the motion
|
[number] - is an optional count to repeat the motion
|
||||||
motion - moves over the text to operate on, such as:
|
motion - moves over the text to operate on, such as:
|
||||||
[w](w) (word),
|
[w](w) (word),
|
||||||
[$]($) (to the end of line), etc.
|
[$]($) (to the end of line), etc.
|
||||||
|
|
||||||
6. To move to the start of the line use a zero: [0](0)
|
6. To move to the start of the line use a zero: [0](0)
|
||||||
|
|
||||||
7. To undo previous actions, type: `u`{normal} (lowercase u)
|
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 all the changes on a line, type: `U`{normal} (capital U)
|
||||||
@@ -350,15 +350,15 @@ Fiix the errors oon thhis line and reeplace them witth undo.
|
|||||||
|
|
||||||
# Lesson 3.1: THE PUT COMMAND
|
# Lesson 3.1: THE PUT COMMAND
|
||||||
|
|
||||||
** Type p to put previously deleted text after the cursor. **
|
** Type `p`{normal} to put previously deleted text after the cursor. **
|
||||||
|
|
||||||
1. Move the cursor to the first ---> line below.
|
1. Move the cursor to the first ---> line below.
|
||||||
|
|
||||||
2. Type `dd`{normal} to delete the line and store it in a Vim register.
|
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.
|
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.
|
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.
|
5. Repeat steps 2 through 4 to put all the lines in correct order.
|
||||||
|
|
||||||
@@ -388,11 +388,11 @@ NOTE: Remember that you should be learning by doing, not memorization.
|
|||||||
|
|
||||||
# Lesson 3.3: THE CHANGE OPERATOR
|
# Lesson 3.3: THE CHANGE OPERATOR
|
||||||
|
|
||||||
** To change until the end of a word, type `ce`{normal} **
|
** To change until the end of a word, type `ce`{normal}. **
|
||||||
|
|
||||||
1. Move the cursor to the first line below marked --->.
|
1. Move the cursor to the first line below marked --->.
|
||||||
|
|
||||||
2. Place the cursor on the "u" in "lubw".
|
2. Place the cursor on the "u" in "lubw".
|
||||||
|
|
||||||
3. Type `ce`{normal} and the correct word (in this case, type "ine" ).
|
3. Type `ce`{normal} and the correct word (in this case, type "ine" ).
|
||||||
|
|
||||||
@@ -405,11 +405,11 @@ 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.
|
Notice that [c](c)e deletes the word and places you in Insert mode.
|
||||||
|
|
||||||
# Lesson 3.4: MORE CHANGES USING c
|
# Lesson 3.4: MORE CHANGES USING `c`{normal}
|
||||||
|
|
||||||
** The change operator is used with the same motions as delete. **
|
** 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:
|
1. The change operator works in the same way as delete. The format is:
|
||||||
|
|
||||||
c [number] motion
|
c [number] motion
|
||||||
|
|
||||||
@@ -422,13 +422,13 @@ Notice that [c](c)e deletes the word and places you in Insert mode.
|
|||||||
5. Type `c$`{normal} and type the rest of the line like the second and press `<Esc>`{normal}.
|
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.
|
The end of this line needs some help to make it like the second.
|
||||||
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$`{normal} command.
|
||||||
|
|
||||||
NOTE: You can use the Backspace key to correct mistakes while typing.
|
NOTE: You can use the Backspace key to correct mistakes while typing.
|
||||||
|
|
||||||
# Lesson 3 SUMMARY
|
# Lesson 3 SUMMARY
|
||||||
|
|
||||||
1. To put back text that has just been deleted, type [p](p). This puts the
|
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
|
deleted text AFTER the cursor (if a line was deleted it will go on the
|
||||||
line below the cursor).
|
line below the cursor).
|
||||||
|
|
||||||
@@ -436,8 +436,8 @@ NOTE: You can use the Backspace key to correct mistakes while typing.
|
|||||||
character you want to have there.
|
character you want to have there.
|
||||||
|
|
||||||
3. The [change operator](c) allows you to change from the cursor to where the
|
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
|
motion takes you. Type `ce`{normal} to change from the cursor to the end of
|
||||||
the word, `c$`{normal} to change to the end of a line.
|
the word, `c$`{normal} to change to the end of a line.
|
||||||
|
|
||||||
4. The format for change is:
|
4. The format for change is:
|
||||||
|
|
||||||
@@ -448,21 +448,21 @@ Now go on to the next lesson.
|
|||||||
# Lesson 4.1: CURSOR LOCATION AND FILE STATUS
|
# Lesson 4.1: CURSOR LOCATION AND FILE STATUS
|
||||||
|
|
||||||
** Type `<Ctrl-g>`{normal} to show your location in the file and the 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. **
|
Type `G`{normal} to move to a line in the file. **
|
||||||
|
|
||||||
NOTE: Read this entire lesson before executing any of the steps!!
|
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}.
|
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
|
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.
|
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
|
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' )
|
This happens when the ['ruler']('ruler') option is set (see `:help 'ruler'`{vim} ).
|
||||||
|
|
||||||
2. Press [G](G) to move you to the bottom of the file.
|
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.
|
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
|
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}.
|
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.
|
4. If you feel confident to do this, execute steps 1 through 3.
|
||||||
@@ -471,20 +471,20 @@ NOTE: You may see the cursor position in the lower right corner of the screen
|
|||||||
|
|
||||||
** Type `/`{normal} followed by a phrase to search for the phrase. **
|
** 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
|
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.
|
appear at the bottom of the screen as with the `:`{normal} command.
|
||||||
|
|
||||||
2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search for.
|
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) .
|
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) .
|
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 / .
|
4. To search for a phrase in the backward direction, use [?](?) instead of `/`{normal}.
|
||||||
|
|
||||||
5. To go back to where you came from press `<Ctrl-o>`{normal} (Keep Ctrl down while
|
5. To go back to where you came from press `<Ctrl-o>`{normal} (keep `<Ctrl>`{normal} pressed down while
|
||||||
pressing the letter o). Repeat to go back further. `<Ctrl-i>`{normal} goes forward.
|
pressing the letter `o`{normal}). Repeat to go back further. `<Ctrl-i>`{normal} goes forward.
|
||||||
|
|
||||||
"errroor" is not the way to spell error; errroor is an error.
|
"errroor" is not the way to spell error; errroor is an error.
|
||||||
|
|
||||||
NOTE: When the search reaches the end of the file it will continue at the
|
NOTE: When the search reaches the end of the file it will continue at the
|
||||||
start, unless the ['wrapscan']('wrapscan') option has been reset.
|
start, unless the ['wrapscan']('wrapscan') option has been reset.
|
||||||
@@ -495,7 +495,7 @@ NOTE: When the search reaches the end of the file it will continue at the
|
|||||||
|
|
||||||
1. Place the cursor on any (, [, or { in the line below marked --->.
|
1. Place the cursor on any (, [, or { in the line below marked --->.
|
||||||
|
|
||||||
2. Now type the [%](%) character.
|
2. Now type the [%](%) character.
|
||||||
|
|
||||||
3. The cursor will move to the matching parenthesis or bracket.
|
3. The cursor will move to the matching parenthesis or bracket.
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ NOTE: This is very useful in debugging a program with unmatched parentheses!
|
|||||||
Adding the g [flag](:s_flags) means to substitute globally in the line, change
|
Adding the g [flag](:s_flags) means to substitute globally in the line, change
|
||||||
all occurrences of "thee" in the line.
|
all occurrences of "thee" in the line.
|
||||||
|
|
||||||
thee best time to see thee flowers is in thee spring.
|
Usually thee best time to see thee flowers is in thee spring.
|
||||||
|
|
||||||
4. To change every occurrence of a character string between two lines, type
|
4. To change every occurrence of a character string between two lines, type
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
@@ -589,20 +589,20 @@ thee best time to see thee flowers is in thee spring.
|
|||||||
** Type `:!`{vim} followed by an external command to execute that 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
|
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.
|
screen. This allows you to enter a command-line command.
|
||||||
|
|
||||||
2. Now type the [!](!cmd) (exclamation point) character. This allows you to
|
2. Now type the [!](!cmd) (exclamation point) character. This allows you to
|
||||||
execute any external shell command.
|
execute any external shell command.
|
||||||
|
|
||||||
3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This
|
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
|
will show you a listing of your directory, just as if you were at the
|
||||||
shell prompt.
|
shell prompt.
|
||||||
|
|
||||||
NOTE: It is possible to execute any external command this way, also with
|
NOTE: It is possible to execute any external command this way, also with
|
||||||
arguments.
|
arguments.
|
||||||
|
|
||||||
NOTE: All : commands must be finished by hitting <Enter>
|
NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}.
|
||||||
From here on we will not always mention it.
|
From here on we will not always mention it.
|
||||||
|
|
||||||
# Lesson 5.2: MORE ON WRITING FILES
|
# Lesson 5.2: MORE ON WRITING FILES
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ NOTE: All : commands must be finished by hitting <Enter>
|
|||||||
4. This saves the whole file (the Vim Tutor) under the name TEST.
|
4. This saves the whole file (the Vim Tutor) under the name TEST.
|
||||||
To verify this, type `:!ls`{vim} again to see your directory.
|
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
|
NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file
|
||||||
would be an exact copy of the tutor when you saved it.
|
would be an exact copy of the tutor when you saved it.
|
||||||
|
|
||||||
5. Now remove the file by typing:
|
5. Now remove the file by typing:
|
||||||
@@ -632,14 +632,14 @@ NOTE: If you were to exit Vim and start it again with vim TEST , the file
|
|||||||
|
|
||||||
# Lesson 5.3: SELECTING TEXT TO WRITE
|
# Lesson 5.3: SELECTING TEXT TO WRITE
|
||||||
|
|
||||||
** To save part of the file, type `v`{normal} motion `:w FILENAME`{vim} **
|
** To save part of the file, type `v`{normal} motion `:w FILENAME`{vim}. **
|
||||||
|
|
||||||
1. Move the cursor to this line.
|
1. Move the cursor to this line.
|
||||||
|
|
||||||
2. Press [v](v) and move the cursor to the fifth item below. Notice that the
|
2. Press [v](v) and move the cursor to the fifth item below. Notice that the
|
||||||
text is highlighted.
|
text is highlighted.
|
||||||
|
|
||||||
3. Press the `:`{normal} character. At the bottom of the screen
|
3. Press the `:`{normal} character. At the bottom of the screen
|
||||||
|
|
||||||
:'<,'>
|
:'<,'>
|
||||||
|
|
||||||
@@ -649,27 +649,27 @@ NOTE: If you were to exit Vim and start it again with vim TEST , the file
|
|||||||
|
|
||||||
`:w TEST`{vim}
|
`:w TEST`{vim}
|
||||||
|
|
||||||
where TEST is a filename that does not exist yet. Verify that you see
|
where TEST is a filename that does not exist yet. Verify that you see
|
||||||
|
|
||||||
`:'<,'>w TEST`{vim}
|
`:'<,'>w TEST`{vim}
|
||||||
|
|
||||||
before you press `<Enter>`{normal}.
|
before you press `<Enter>`{normal}.
|
||||||
|
|
||||||
5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it.
|
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.
|
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
|
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
|
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
|
use an operator to do something with the text. For example, `d`{normal} deletes
|
||||||
the text.
|
the text.
|
||||||
|
|
||||||
# Lesson 5.4: RETRIEVING AND MERGING FILES
|
# Lesson 5.4: RETRIEVING AND MERGING FILES
|
||||||
|
|
||||||
** To insert the contents of a file, type `:r FILENAME`{vim} **
|
** To insert the contents of a file, type `:r FILENAME`{vim}. **
|
||||||
|
|
||||||
1. Place the cursor just above this line.
|
1. Place the cursor just above this line.
|
||||||
|
|
||||||
NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
|
NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
|
||||||
DOWN to see this lesson again.
|
DOWN to see this lesson again.
|
||||||
|
|
||||||
2. Now retrieve your TEST file using the command
|
2. Now retrieve your TEST file using the command
|
||||||
@@ -682,31 +682,31 @@ NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
|
|||||||
3. To verify that a file was retrieved, cursor back and notice that there
|
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.
|
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,
|
NOTE: You can also read the output of an external command. For example,
|
||||||
|
|
||||||
`:r !ls`{vim}
|
`:r !ls`{vim}
|
||||||
|
|
||||||
reads the output of the `ls` command and puts it below the cursor.
|
reads the output of the `ls` command and puts it below the cursor.
|
||||||
|
|
||||||
# Lesson 5 SUMMARY
|
# Lesson 5 SUMMARY
|
||||||
|
|
||||||
1. [:!command](:!cmd) executes an external command.
|
1. [:!command](:!cmd) executes an external command.
|
||||||
|
|
||||||
Some useful examples are:
|
Some useful examples are:
|
||||||
`:!ls`{vim} - shows a directory listing
|
`:!ls`{vim} - shows a directory listing
|
||||||
`:!rm FILENAME`{vim} - removes file FILENAME
|
`:!rm FILENAME`{vim} - removes file FILENAME
|
||||||
|
|
||||||
2. [:w](:w) FILENAME writes the current Vim file to disk with
|
2. [:w](:w) FILENAME writes the current Vim file to disk with
|
||||||
name FILENAME.
|
name FILENAME.
|
||||||
|
|
||||||
3. [v](v) motion :w FILENAME saves the Visually selected lines in file
|
3. [v](v) motion :w FILENAME saves the Visually selected lines in file
|
||||||
FILENAME.
|
FILENAME.
|
||||||
|
|
||||||
4. [:r](:r) FILENAME retrieves disk file FILENAME and puts it
|
4. [:r](:r) FILENAME retrieves disk file FILENAME and puts it
|
||||||
below the cursor position.
|
below the cursor position.
|
||||||
|
|
||||||
5. [:r !dir](:r!) reads the output of the dir command and
|
5. [:r !dir](:r!) reads the output of the dir command and
|
||||||
puts it below the cursor position.
|
puts it below the cursor position.
|
||||||
|
|
||||||
# Lesson 6.1: THE OPEN COMMAND
|
# Lesson 6.1: THE OPEN COMMAND
|
||||||
|
|
||||||
@@ -719,10 +719,10 @@ NOTE: You can also read the output of an external command. For example,
|
|||||||
|
|
||||||
3. Now type some text and press `<Esc>`{normal} to exit 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.
|
After typing `o`{normal} the cursor is placed on the open line in Insert mode.
|
||||||
|
|
||||||
4. To open up a line ABOVE the cursor, simply type a [capital O](O), rather
|
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.
|
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.
|
Open up a line above this by typing O while the cursor is on this line.
|
||||||
|
|
||||||
@@ -734,9 +734,9 @@ Open up a line above this by typing O while the cursor is on this line.
|
|||||||
|
|
||||||
2. Press `e`{normal} until the cursor is on the end of "li".
|
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.
|
3. Type the lowercase letter `a`{normal} to [append](a) text AFTER the cursor.
|
||||||
|
|
||||||
4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert
|
4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert
|
||||||
mode.
|
mode.
|
||||||
|
|
||||||
5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4.
|
5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4.
|
||||||
@@ -744,20 +744,20 @@ Open up a line above this by typing O while the cursor is on this line.
|
|||||||
This li will allow you to pract appendi text to a line.
|
This li will allow you to pract appendi text to a line.
|
||||||
This line will allow you to practice appending text to a line.
|
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
|
NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only difference is where
|
||||||
the characters are inserted.
|
the characters are inserted.
|
||||||
|
|
||||||
# Lesson 6.3: ANOTHER WAY TO REPLACE
|
# Lesson 6.3: ANOTHER WAY TO REPLACE
|
||||||
|
|
||||||
** Type a capital `R`{normal} to replace more than one character. **
|
** 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
|
1. Move the cursor to the first line below marked --->. Move the cursor to
|
||||||
the beginning of the first "xxx".
|
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
|
2. Now press `R`{normal} ([capital R](R)) and type the number below it in the second line, so that it
|
||||||
replaces the "xxx".
|
replaces the "xxx".
|
||||||
|
|
||||||
3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line
|
3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line
|
||||||
remains unmodified.
|
remains unmodified.
|
||||||
|
|
||||||
4. Repeat the steps to replace the remaining "xxx".
|
4. Repeat the steps to replace the remaining "xxx".
|
||||||
@@ -765,12 +765,12 @@ NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only differ
|
|||||||
Adding 123 to xxx gives you xxx.
|
Adding 123 to xxx gives you xxx.
|
||||||
Adding 123 to 456 gives you 579.
|
Adding 123 to 456 gives you 579.
|
||||||
|
|
||||||
NOTE: Replace mode is like Insert mode, but every typed character deletes an
|
NOTE: Replace mode is like Insert mode, but every typed character deletes an
|
||||||
existing character.
|
existing character.
|
||||||
|
|
||||||
# Lesson 6.4: COPY AND PASTE TEXT
|
# Lesson 6.4: COPY AND PASTE TEXT
|
||||||
|
|
||||||
** Use the `y`{normal} operator to copy text and `p`{normal} to paste it **
|
** 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)".
|
1. Go to the line marked with ---> below and place the cursor after "a)".
|
||||||
|
|
||||||
@@ -780,35 +780,37 @@ NOTE: Replace mode is like Insert mode, but every typed character deletes an
|
|||||||
|
|
||||||
4. Move the cursor to the end of the next line: `j$`{normal}
|
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}.
|
5. Type `p`{normal} to [put](put) (paste) the text.
|
||||||
|
|
||||||
6. Use Visual mode to select " item.", yank it with `y`{normal}, move to the end of
|
6. Press `a`{normal} and then type "second". Press `<Esc>`{normal} to leave Insert mode.
|
||||||
|
|
||||||
|
7. 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}.
|
the next line with `j$`{normal} and put the text there with `p`{normal}.
|
||||||
|
|
||||||
a) this is the first item.
|
a) This is the first item.
|
||||||
b)
|
b)
|
||||||
|
|
||||||
NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word.
|
NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word.
|
||||||
|
|
||||||
# Lesson 6.5: SET OPTION
|
# Lesson 6.5: SET OPTION
|
||||||
|
|
||||||
** Set an option so a search or substitute ignores case **
|
** Set an option so a search or substitute ignores case. **
|
||||||
|
|
||||||
1. Search for 'ignore' by entering: `/ignore`
|
1. Search for 'ignore' by entering: `/ignore`
|
||||||
Repeat several times by pressing `n`{normal}.
|
Repeat several times by pressing `n`{normal}.
|
||||||
|
|
||||||
2. Set the 'ic' (Ignore case) option by entering:
|
2. Set the 'ic' (Ignore case) option by entering:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set ic
|
:set ic
|
||||||
~~~
|
~~~
|
||||||
3. Now search for 'ignore' again by pressing n
|
3. Now search for 'ignore' again by pressing `n`{normal}.
|
||||||
Notice that Ignore and IGNORE are now also found.
|
Notice that Ignore and IGNORE are now also found.
|
||||||
|
|
||||||
4. Set the 'hlsearch' and 'incsearch' options:
|
4. Set the 'hlsearch' and 'incsearch' options:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set hls is
|
:set hls is
|
||||||
~~~
|
~~~
|
||||||
5. Now type the search command again and see what happens: /ignore <Enter>
|
5. Now type the search command again and see what happens: /ignore <Enter>
|
||||||
|
|
||||||
6. To disable ignoring case enter:
|
6. To disable ignoring case enter:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
@@ -818,12 +820,12 @@ a) this is the first item.
|
|||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set invic
|
:set invic
|
||||||
~~~
|
~~~
|
||||||
NOTE: To remove the highlighting of matches enter:
|
NOTE: To remove the highlighting of matches enter:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:nohlsearch
|
:nohlsearch
|
||||||
~~~
|
~~~
|
||||||
NOTE: If you want to ignore case for just one search command, use [\c](/\c)
|
NOTE: If you want to ignore case for just one search command, use [\c](/\c)
|
||||||
in the phrase: /ignore\c <Enter>
|
in the phrase: /ignore\c <Enter>
|
||||||
|
|
||||||
# Lesson 6 SUMMARY
|
# Lesson 6 SUMMARY
|
||||||
|
|
||||||
@@ -839,7 +841,7 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
|
|||||||
|
|
||||||
5. Typing a capital `R`{normal} enters Replace mode until `<Esc>`{normal} is pressed.
|
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:
|
6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are:
|
||||||
|
|
||||||
'ic' 'ignorecase' ignore upper/lower case when searching
|
'ic' 'ignorecase' ignore upper/lower case when searching
|
||||||
'is' 'incsearch' show partial matches for a search phrase
|
'is' 'incsearch' show partial matches for a search phrase
|
||||||
@@ -858,9 +860,9 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
|
|||||||
|
|
||||||
# Lesson 7.1: GETTING HELP
|
# Lesson 7.1: GETTING HELP
|
||||||
|
|
||||||
** Use the on-line help system **
|
** Use the on-line help system. **
|
||||||
|
|
||||||
Vim has a comprehensive on-line help system. To get started, try one of
|
Vim has a comprehensive on-line help system. To get started, try one of
|
||||||
these three:
|
these three:
|
||||||
- press the `<HELP>`{normal} key (if you have one)
|
- press the `<HELP>`{normal} key (if you have one)
|
||||||
- press the `<F1>`{normal} key (if you have one)
|
- press the `<F1>`{normal} key (if you have one)
|
||||||
@@ -872,7 +874,7 @@ Type `<Ctrl-w><Ctrl-w>`{normal} to jump from one window to another.
|
|||||||
Type `:q`{vim} to close the help window.
|
Type `:q`{vim} to close the help window.
|
||||||
|
|
||||||
You can find help on just about any subject, by giving an argument to the
|
You can find help on just about any subject, by giving an argument to the
|
||||||
":help" command. Try these (don't forget pressing <Enter>):
|
":help" command. Try these (don't forget pressing <Enter>):
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:help w
|
:help w
|
||||||
:help c_CTRL-D
|
:help c_CTRL-D
|
||||||
@@ -881,13 +883,13 @@ You can find help on just about any subject, by giving an argument to the
|
|||||||
~~~
|
~~~
|
||||||
# Lesson 7.2: CREATE A STARTUP SCRIPT
|
# Lesson 7.2: CREATE A STARTUP SCRIPT
|
||||||
|
|
||||||
** Enable Vim features **
|
** Enable Vim features. **
|
||||||
|
|
||||||
Vim has many more features than Vi, but most of them are disabled by
|
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.
|
default. To start using more features you have to create a "vimrc" file.
|
||||||
|
|
||||||
1. Start editing the "vimrc" file. This depends on your system:
|
1. Start editing the "vimrc" file. This depends on your system:
|
||||||
`:e ~/.config/nvim/init.vim`{vim} for Unix-like systems
|
`:e ~/.config/nvim/init.vim`{vim} for Unix-like systems
|
||||||
|
|
||||||
2. Now read the example "vimrc" file contents:
|
2. Now read the example "vimrc" file contents:
|
||||||
`:r $VIMRUNTIME/vimrc_example.vim`{vim}
|
`:r $VIMRUNTIME/vimrc_example.vim`{vim}
|
||||||
@@ -897,15 +899,15 @@ default. To start using more features you have to create a "vimrc" file.
|
|||||||
|
|
||||||
The next time you start Vim it will use syntax highlighting.
|
The next time you start Vim it will use syntax highlighting.
|
||||||
You can add all your preferred settings to this "vimrc" file.
|
You can add all your preferred settings to this "vimrc" file.
|
||||||
For more information type :help vimrc-intro
|
For more information type `:help vimrc-intro`{vim}.
|
||||||
|
|
||||||
# Lesson 7.3: COMPLETION
|
# Lesson 7.3: COMPLETION
|
||||||
|
|
||||||
** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal} **
|
** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal}. **
|
||||||
|
|
||||||
1. Look what files exist in the directory: `:!ls`{vim}
|
1. Look what files exist in the directory: `:!ls`{vim}
|
||||||
|
|
||||||
2. Type the start of a command: `:e`{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".
|
3. Press `<Ctrl-d>`{normal} and Vim will show a list of commands that start with "e".
|
||||||
|
|
||||||
@@ -913,20 +915,20 @@ default. To start using more features you have to create a "vimrc" file.
|
|||||||
|
|
||||||
5. Now add a space and the start of an existing file name: `:edit FIL`{vim}
|
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).
|
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}.
|
NOTE: Completion works for many commands. It is especially useful for `:help`{vim}.
|
||||||
|
|
||||||
# Lesson 7 SUMMARY
|
# Lesson 7 SUMMARY
|
||||||
|
|
||||||
1. Type `:help`{vim}
|
1. Type `:help`{vim}
|
||||||
or press `<F1>`{normal} or `<Help>`{normal} to open a help window.
|
or press `<F1>`{normal} or `<Help>`{normal} to open a help window.
|
||||||
|
|
||||||
2. Type `:help TOPIC`{vim} to find help on TOPIC.
|
2. Type `:help TOPIC`{vim} to find help on TOPIC.
|
||||||
|
|
||||||
3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window
|
3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window
|
||||||
|
|
||||||
4. Type `:q`{vim} to close the help window
|
4. Type `:q`{vim} to close the help window
|
||||||
|
|
||||||
5. Create a vimrc startup script to keep your preferred settings.
|
5. Create a vimrc startup script to keep your preferred settings.
|
||||||
|
|
||||||
@@ -937,24 +939,24 @@ NOTE: Completion works for many commands. It is especially useful for `:help`{v
|
|||||||
|
|
||||||
This was intended to give a brief overview of the Vim editor, just enough to
|
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
|
allow you to use the editor fairly easily. It is far from complete as Vim has
|
||||||
many many more commands. Consult the help often.
|
many many more commands. Consult the help often.
|
||||||
|
|
||||||
There are many resources online to learn more about vim. Here's a bunch of them:
|
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/
|
- *Learn Vim Progressively*: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
|
||||||
- *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/
|
- *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/
|
||||||
- Vimcasts: http://vimcasts.org/
|
- *Vimcasts*: http://vimcasts.org/
|
||||||
- Vim Video-Tutorials by Derek Wyatt: http://derekwyatt.org/vim/tutorials/
|
- *Vim Video-Tutorials by Derek Wyatt*: http://derekwyatt.org/vim/tutorials/
|
||||||
- *Learn Vimscript the Hard Way*: http://learnvimscriptthehardway.stevelosh.com/
|
- *Learn Vimscript the Hard Way*: http://learnvimscriptthehardway.stevelosh.com/
|
||||||
- *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html
|
- *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html
|
||||||
- *vim-galore*: https://github.com/mhinz/vim-galore
|
- *vim-galore*: https://github.com/mhinz/vim-galore
|
||||||
|
|
||||||
If you prefer a book, *Practical Vim* by Drew Neil is recommended often (the sequel, *Modern
|
If you prefer a book, *Practical Vim* by Drew Neil is recommended often (the sequel, *Modern
|
||||||
Vim*, includes material specific to nvim!).
|
Vim*, includes material specific to nvim).
|
||||||
|
|
||||||
This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
|
This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
|
||||||
School of Mines using ideas supplied by Charles Smith, Colorado State
|
School of Mines using ideas supplied by Charles Smith, Colorado State
|
||||||
University. E-mail: bware@mines.colorado.edu.
|
University. E-mail: bware@mines.colorado.edu.
|
||||||
|
|
||||||
Modified for Vim by Bram Moolenaar.
|
Modified for Vim by Bram Moolenaar.
|
||||||
Modified for vim-tutor-mode by Felipe Morales.
|
Modified for vim-tutor-mode by Felipe Morales.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"215": "There are some words that don't belong in this sentence.",
|
"215": "There are some words that don't belong in this sentence.",
|
||||||
"231": "Somebody typed the end of this line twice.",
|
"231": "Somebody typed the end of this line twice.",
|
||||||
"271": -1,
|
"271": -1,
|
||||||
"290": "this line of words is cleaned up.",
|
"290": "This line of words is cleaned up.",
|
||||||
"304": -1,
|
"304": -1,
|
||||||
"305": -1,
|
"305": -1,
|
||||||
"306": -1,
|
"306": -1,
|
||||||
@@ -32,14 +32,14 @@
|
|||||||
"425": "The end of this line needs to be corrected using the c$ command.",
|
"425": "The end of this line needs to be corrected using the c$ command.",
|
||||||
"487": -1,
|
"487": -1,
|
||||||
"506": -1,
|
"506": -1,
|
||||||
"531": "the best time to see the flowers is in the spring.",
|
"531": "Usually the best time to see the flowers is in the spring.",
|
||||||
"722": -1,
|
"722": -1,
|
||||||
"727": -1,
|
"727": -1,
|
||||||
"744": "This line will allow you to practice appending text to a line.",
|
"744": "This line will allow you to practice appending text to a line.",
|
||||||
"745": "This line will allow you to practice appending text to a line.",
|
"745": "This line will allow you to practice appending text to a line.",
|
||||||
"765": "Adding 123 to 456 gives you 579.",
|
"765": "Adding 123 to 456 gives you 579.",
|
||||||
"766": "Adding 123 to 456 gives you 579.",
|
"766": "Adding 123 to 456 gives you 579.",
|
||||||
"788": "a) this is the first item.",
|
"790": "a) This is the first item.",
|
||||||
"789": " b) this is the second item."
|
"791": " b) This is the second item."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1668,8 +1668,8 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
if (*ea.cmd == ';') {
|
if (*ea.cmd == ';') {
|
||||||
if (!ea.skip) {
|
if (!ea.skip) {
|
||||||
curwin->w_cursor.lnum = ea.line2;
|
curwin->w_cursor.lnum = ea.line2;
|
||||||
// Don't leave the cursor on an illegal line (caused by ';')
|
// don't leave the cursor on an illegal line or column
|
||||||
check_cursor_lnum();
|
check_cursor();
|
||||||
}
|
}
|
||||||
} else if (*ea.cmd != ',') {
|
} else if (*ea.cmd != ',') {
|
||||||
break;
|
break;
|
||||||
@@ -1813,7 +1813,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
if (text_locked() && !(ea.argt & CMDWIN)
|
if (text_locked() && !(ea.argt & CMDWIN)
|
||||||
&& !IS_USER_CMDIDX(ea.cmdidx)) {
|
&& !IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
// Command not allowed when editing the command line.
|
// Command not allowed when editing the command line.
|
||||||
errormsg = get_text_locked_msg();
|
errormsg = (char_u *)_(get_text_locked_msg());
|
||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
/* Disallow editing another buffer when "curbuf_lock" is set.
|
/* Disallow editing another buffer when "curbuf_lock" is set.
|
||||||
@@ -9378,7 +9378,7 @@ ses_arglist (
|
|||||||
(void)vim_FullName((char *)s, (char *)buf, MAXPATHL, FALSE);
|
(void)vim_FullName((char *)s, (char *)buf, MAXPATHL, FALSE);
|
||||||
s = buf;
|
s = buf;
|
||||||
}
|
}
|
||||||
if (fputs("argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL
|
if (fputs("$argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL
|
||||||
|| put_eol(fd) == FAIL) {
|
|| put_eol(fd) == FAIL) {
|
||||||
xfree(buf);
|
xfree(buf);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|||||||
@@ -1749,7 +1749,7 @@ do_set (
|
|||||||
|
|
||||||
if (flags & P_FLAGLIST) {
|
if (flags & P_FLAGLIST) {
|
||||||
// Remove flags that appear twice.
|
// Remove flags that appear twice.
|
||||||
for (s = newval; *s; s++) {
|
for (s = newval; *s;) {
|
||||||
// if options have P_FLAGLIST and P_ONECOMMA such as
|
// if options have P_FLAGLIST and P_ONECOMMA such as
|
||||||
// 'whichwrap'
|
// 'whichwrap'
|
||||||
if (flags & P_ONECOMMA) {
|
if (flags & P_ONECOMMA) {
|
||||||
@@ -1757,15 +1757,16 @@ do_set (
|
|||||||
&& vim_strchr(s + 2, *s) != NULL) {
|
&& vim_strchr(s + 2, *s) != NULL) {
|
||||||
// Remove the duplicated value and the next comma.
|
// Remove the duplicated value and the next comma.
|
||||||
STRMOVE(s, s + 2);
|
STRMOVE(s, s + 2);
|
||||||
s -= 2;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((!(flags & P_COMMA) || *s != ',')
|
if ((!(flags & P_COMMA) || *s != ',')
|
||||||
&& vim_strchr(s + 1, *s) != NULL) {
|
&& vim_strchr(s + 1, *s) != NULL) {
|
||||||
STRMOVE(s, s + 1);
|
STRMOVE(s, s + 1);
|
||||||
s--;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3316,6 +3316,47 @@ bt_regexec_nl (
|
|||||||
return (int)r;
|
return (int)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Wrapper around strchr which accounts for case-insensitive searches and
|
||||||
|
/// non-ASCII characters.
|
||||||
|
///
|
||||||
|
/// This function is used a lot for simple searches, keep it fast!
|
||||||
|
///
|
||||||
|
/// @param s string to search
|
||||||
|
/// @param c character to find in @a s
|
||||||
|
///
|
||||||
|
/// @return NULL if no match, otherwise pointer to the position in @a s
|
||||||
|
static inline char_u *cstrchr(const char_u *const s, const int c)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
|
||||||
|
FUNC_ATTR_ALWAYS_INLINE
|
||||||
|
{
|
||||||
|
if (!rex.reg_ic) {
|
||||||
|
return vim_strchr(s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use folded case for UTF-8, slow! For ASCII use libc strpbrk which is
|
||||||
|
// expected to be highly optimized.
|
||||||
|
if (c > 0x80) {
|
||||||
|
const int folded_c = utf_fold(c);
|
||||||
|
for (const char_u *p = s; *p != NUL; p += utfc_ptr2len(p)) {
|
||||||
|
if (utf_fold(utf_ptr2char(p)) == folded_c) {
|
||||||
|
return (char_u *)p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cc;
|
||||||
|
if (ASCII_ISUPPER(c)) {
|
||||||
|
cc = TOLOWER_ASC(c);
|
||||||
|
} else if (ASCII_ISLOWER(c)) {
|
||||||
|
cc = TOUPPER_ASC(c);
|
||||||
|
} else {
|
||||||
|
return vim_strchr(s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
char tofind[] = { (char)c, (char)cc, NUL };
|
||||||
|
return (char_u *)strpbrk((const char *)s, tofind);
|
||||||
|
}
|
||||||
|
|
||||||
/// Matches a regexp against multiple lines.
|
/// Matches a regexp against multiple lines.
|
||||||
/// "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
/// "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
||||||
@@ -6320,42 +6361,6 @@ static int cstrncmp(char_u *s1, char_u *s2, int *n)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* cstrchr: This function is used a lot for simple searches, keep it fast!
|
|
||||||
*/
|
|
||||||
static inline char_u *cstrchr(const char_u *const s, const int c)
|
|
||||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
|
|
||||||
FUNC_ATTR_ALWAYS_INLINE
|
|
||||||
{
|
|
||||||
if (!rex.reg_ic) {
|
|
||||||
return vim_strchr(s, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use folded case for UTF-8, slow! For ASCII use libc strpbrk which is
|
|
||||||
// expected to be highly optimized.
|
|
||||||
if (c > 0x80) {
|
|
||||||
const int folded_c = utf_fold(c);
|
|
||||||
for (const char_u *p = s; *p != NUL; p += utfc_ptr2len(p)) {
|
|
||||||
if (utf_fold(utf_ptr2char(p)) == folded_c) {
|
|
||||||
return (char_u *)p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cc;
|
|
||||||
if (ASCII_ISUPPER(c)) {
|
|
||||||
cc = TOLOWER_ASC(c);
|
|
||||||
} else if (ASCII_ISLOWER(c)) {
|
|
||||||
cc = TOUPPER_ASC(c);
|
|
||||||
} else {
|
|
||||||
return vim_strchr(s, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
char tofind[] = { (char)c, (char)cc, NUL };
|
|
||||||
return (char_u *)strpbrk((const char *)s, tofind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* regsub stuff *
|
* regsub stuff *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ NEW_TESTS ?= \
|
|||||||
test_match.res \
|
test_match.res \
|
||||||
test_matchadd_conceal.res \
|
test_matchadd_conceal.res \
|
||||||
test_matchadd_conceal_utf8.res \
|
test_matchadd_conceal_utf8.res \
|
||||||
|
test_mksession.res \
|
||||||
test_nested_function.res \
|
test_nested_function.res \
|
||||||
test_normal.res \
|
test_normal.res \
|
||||||
test_quickfix.res \
|
test_quickfix.res \
|
||||||
|
|||||||
@@ -250,9 +250,21 @@ func Test_remove_char_in_cmdline()
|
|||||||
call assert_equal('"def', @:)
|
call assert_equal('"def', @:)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_illegal_address()
|
func Test_illegal_address1()
|
||||||
new
|
new
|
||||||
2;'(
|
2;'(
|
||||||
2;')
|
2;')
|
||||||
quit
|
quit
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_illegal_address2()
|
||||||
|
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim')
|
||||||
|
new
|
||||||
|
source Xtest.vim
|
||||||
|
" Trigger calling validate_cursor()
|
||||||
|
diffsp Xtest.vim
|
||||||
|
quit!
|
||||||
|
bwipe!
|
||||||
|
call delete('Xtest.vim')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|||||||
15
src/nvim/testdir/test_mksession.vim
Normal file
15
src/nvim/testdir/test_mksession.vim
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
" Tests for sessions
|
||||||
|
|
||||||
|
" Verify that arglist is stored correctly to the session file.
|
||||||
|
func Test_mksession_arglist()
|
||||||
|
argdel *
|
||||||
|
next file1 file2 file3 file4
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
source Xtest_mks.out
|
||||||
|
call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
|
||||||
|
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
argdel *
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
@@ -13,6 +13,12 @@ function! Test_whichwrap()
|
|||||||
set whichwrap+=h,l
|
set whichwrap+=h,l
|
||||||
call assert_equal('b,s,h,l', &whichwrap)
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,15 @@
|
|||||||
#define LINUXSET0C "\x1b[?0c"
|
#define LINUXSET0C "\x1b[?0c"
|
||||||
#define LINUXSET1C "\x1b[?1c"
|
#define LINUXSET1C "\x1b[?1c"
|
||||||
|
|
||||||
|
#ifdef NVIM_UNIBI_HAS_VAR_FROM
|
||||||
|
#define UNIBI_SET_NUM_VAR(var, num) \
|
||||||
|
do { \
|
||||||
|
(var) = unibi_var_from_num((num)); \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define UNIBI_SET_NUM_VAR(var, num) (var).i = (num);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Per the commentary in terminfo, only a minus sign is a true suffix
|
// Per the commentary in terminfo, only a minus sign is a true suffix
|
||||||
// separator.
|
// separator.
|
||||||
bool terminfo_is_term_family(const char *term, const char *family)
|
bool terminfo_is_term_family(const char *term, const char *family)
|
||||||
@@ -391,15 +400,15 @@ static void update_attrs(UI *ui, HlAttrs attrs)
|
|||||||
|
|
||||||
if (unibi_get_str(data->ut, unibi_set_attributes)) {
|
if (unibi_get_str(data->ut, unibi_set_attributes)) {
|
||||||
if (attrs.bold || attrs.reverse || attrs.underline || attrs.undercurl) {
|
if (attrs.bold || attrs.reverse || attrs.underline || attrs.undercurl) {
|
||||||
data->params[0].i = 0; // standout
|
UNIBI_SET_NUM_VAR(data->params[0], 0); // standout
|
||||||
data->params[1].i = attrs.underline || attrs.undercurl;
|
UNIBI_SET_NUM_VAR(data->params[1], attrs.underline || attrs.undercurl);
|
||||||
data->params[2].i = attrs.reverse;
|
UNIBI_SET_NUM_VAR(data->params[2], attrs.reverse);
|
||||||
data->params[3].i = 0; // blink
|
UNIBI_SET_NUM_VAR(data->params[3], 0); // blink
|
||||||
data->params[4].i = 0; // dim
|
UNIBI_SET_NUM_VAR(data->params[4], 0); // dim
|
||||||
data->params[5].i = attrs.bold;
|
UNIBI_SET_NUM_VAR(data->params[5], attrs.bold);
|
||||||
data->params[6].i = 0; // blank
|
UNIBI_SET_NUM_VAR(data->params[6], 0); // blank
|
||||||
data->params[7].i = 0; // protect
|
UNIBI_SET_NUM_VAR(data->params[7], 0); // protect
|
||||||
data->params[8].i = 0; // alternate character set
|
UNIBI_SET_NUM_VAR(data->params[8], 0); // alternate character set
|
||||||
unibi_out(ui, unibi_set_attributes);
|
unibi_out(ui, unibi_set_attributes);
|
||||||
} else if (!data->default_attr) {
|
} else if (!data->default_attr) {
|
||||||
unibi_out(ui, unibi_exit_attribute_mode);
|
unibi_out(ui, unibi_exit_attribute_mode);
|
||||||
@@ -423,26 +432,26 @@ static void update_attrs(UI *ui, HlAttrs attrs)
|
|||||||
}
|
}
|
||||||
if (ui->rgb) {
|
if (ui->rgb) {
|
||||||
if (fg != -1) {
|
if (fg != -1) {
|
||||||
data->params[0].i = (fg >> 16) & 0xff; // red
|
UNIBI_SET_NUM_VAR(data->params[0], (fg >> 16) & 0xff); // red
|
||||||
data->params[1].i = (fg >> 8) & 0xff; // green
|
UNIBI_SET_NUM_VAR(data->params[1], (fg >> 8) & 0xff); // green
|
||||||
data->params[2].i = fg & 0xff; // blue
|
UNIBI_SET_NUM_VAR(data->params[2], fg & 0xff); // blue
|
||||||
unibi_out_ext(ui, data->unibi_ext.set_rgb_foreground);
|
unibi_out_ext(ui, data->unibi_ext.set_rgb_foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bg != -1) {
|
if (bg != -1) {
|
||||||
data->params[0].i = (bg >> 16) & 0xff; // red
|
UNIBI_SET_NUM_VAR(data->params[0], (bg >> 16) & 0xff); // red
|
||||||
data->params[1].i = (bg >> 8) & 0xff; // green
|
UNIBI_SET_NUM_VAR(data->params[1], (bg >> 8) & 0xff); // green
|
||||||
data->params[2].i = bg & 0xff; // blue
|
UNIBI_SET_NUM_VAR(data->params[2], bg & 0xff); // blue
|
||||||
unibi_out_ext(ui, data->unibi_ext.set_rgb_background);
|
unibi_out_ext(ui, data->unibi_ext.set_rgb_background);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fg != -1) {
|
if (fg != -1) {
|
||||||
data->params[0].i = fg;
|
UNIBI_SET_NUM_VAR(data->params[0], fg);
|
||||||
unibi_out(ui, unibi_set_a_foreground);
|
unibi_out(ui, unibi_set_a_foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bg != -1) {
|
if (bg != -1) {
|
||||||
data->params[0].i = bg;
|
UNIBI_SET_NUM_VAR(data->params[0], bg);
|
||||||
unibi_out(ui, unibi_set_a_background);
|
unibi_out(ui, unibi_set_a_background);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,7 +567,7 @@ static void cursor_goto(UI *ui, int row, int col)
|
|||||||
unibi_out(ui, unibi_cursor_left);
|
unibi_out(ui, unibi_cursor_left);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = n;
|
UNIBI_SET_NUM_VAR(data->params[0], n);
|
||||||
unibi_out(ui, unibi_parm_left_cursor);
|
unibi_out(ui, unibi_parm_left_cursor);
|
||||||
}
|
}
|
||||||
ugrid_goto(grid, row, col);
|
ugrid_goto(grid, row, col);
|
||||||
@@ -570,7 +579,7 @@ static void cursor_goto(UI *ui, int row, int col)
|
|||||||
unibi_out(ui, unibi_cursor_right);
|
unibi_out(ui, unibi_cursor_right);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = n;
|
UNIBI_SET_NUM_VAR(data->params[0], n);
|
||||||
unibi_out(ui, unibi_parm_right_cursor);
|
unibi_out(ui, unibi_parm_right_cursor);
|
||||||
}
|
}
|
||||||
ugrid_goto(grid, row, col);
|
ugrid_goto(grid, row, col);
|
||||||
@@ -585,7 +594,7 @@ static void cursor_goto(UI *ui, int row, int col)
|
|||||||
unibi_out(ui, unibi_cursor_down);
|
unibi_out(ui, unibi_cursor_down);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = n;
|
UNIBI_SET_NUM_VAR(data->params[0], n);
|
||||||
unibi_out(ui, unibi_parm_down_cursor);
|
unibi_out(ui, unibi_parm_down_cursor);
|
||||||
}
|
}
|
||||||
ugrid_goto(grid, row, col);
|
ugrid_goto(grid, row, col);
|
||||||
@@ -597,7 +606,7 @@ static void cursor_goto(UI *ui, int row, int col)
|
|||||||
unibi_out(ui, unibi_cursor_up);
|
unibi_out(ui, unibi_cursor_up);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = n;
|
UNIBI_SET_NUM_VAR(data->params[0], n);
|
||||||
unibi_out(ui, unibi_parm_up_cursor);
|
unibi_out(ui, unibi_parm_up_cursor);
|
||||||
}
|
}
|
||||||
ugrid_goto(grid, row, col);
|
ugrid_goto(grid, row, col);
|
||||||
@@ -675,19 +684,19 @@ static void set_scroll_region(UI *ui)
|
|||||||
TUIData *data = ui->data;
|
TUIData *data = ui->data;
|
||||||
UGrid *grid = &data->grid;
|
UGrid *grid = &data->grid;
|
||||||
|
|
||||||
data->params[0].i = grid->top;
|
UNIBI_SET_NUM_VAR(data->params[0], grid->top);
|
||||||
data->params[1].i = grid->bot;
|
UNIBI_SET_NUM_VAR(data->params[1], grid->bot);
|
||||||
unibi_out(ui, unibi_change_scroll_region);
|
unibi_out(ui, unibi_change_scroll_region);
|
||||||
if (grid->left != 0 || grid->right != ui->width - 1) {
|
if (grid->left != 0 || grid->right != ui->width - 1) {
|
||||||
unibi_out_ext(ui, data->unibi_ext.enable_lr_margin);
|
unibi_out_ext(ui, data->unibi_ext.enable_lr_margin);
|
||||||
if (data->can_set_lr_margin) {
|
if (data->can_set_lr_margin) {
|
||||||
data->params[0].i = grid->left;
|
UNIBI_SET_NUM_VAR(data->params[0], grid->left);
|
||||||
data->params[1].i = grid->right;
|
UNIBI_SET_NUM_VAR(data->params[1], grid->right);
|
||||||
unibi_out(ui, unibi_set_lr_margin);
|
unibi_out(ui, unibi_set_lr_margin);
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = grid->left;
|
UNIBI_SET_NUM_VAR(data->params[0], grid->left);
|
||||||
unibi_out(ui, unibi_set_left_margin_parm);
|
unibi_out(ui, unibi_set_left_margin_parm);
|
||||||
data->params[0].i = grid->right;
|
UNIBI_SET_NUM_VAR(data->params[0], grid->right);
|
||||||
unibi_out(ui, unibi_set_right_margin_parm);
|
unibi_out(ui, unibi_set_right_margin_parm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -702,19 +711,19 @@ static void reset_scroll_region(UI *ui)
|
|||||||
if (0 <= data->unibi_ext.reset_scroll_region) {
|
if (0 <= data->unibi_ext.reset_scroll_region) {
|
||||||
unibi_out_ext(ui, data->unibi_ext.reset_scroll_region);
|
unibi_out_ext(ui, data->unibi_ext.reset_scroll_region);
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = 0;
|
UNIBI_SET_NUM_VAR(data->params[0], 0);
|
||||||
data->params[1].i = ui->height - 1;
|
UNIBI_SET_NUM_VAR(data->params[1], ui->height - 1);
|
||||||
unibi_out(ui, unibi_change_scroll_region);
|
unibi_out(ui, unibi_change_scroll_region);
|
||||||
}
|
}
|
||||||
if (grid->left != 0 || grid->right != ui->width - 1) {
|
if (grid->left != 0 || grid->right != ui->width - 1) {
|
||||||
if (data->can_set_lr_margin) {
|
if (data->can_set_lr_margin) {
|
||||||
data->params[0].i = 0;
|
UNIBI_SET_NUM_VAR(data->params[0], 0);
|
||||||
data->params[1].i = ui->width - 1;
|
UNIBI_SET_NUM_VAR(data->params[1], ui->width - 1);
|
||||||
unibi_out(ui, unibi_set_lr_margin);
|
unibi_out(ui, unibi_set_lr_margin);
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = 0;
|
UNIBI_SET_NUM_VAR(data->params[0], 0);
|
||||||
unibi_out(ui, unibi_set_left_margin_parm);
|
unibi_out(ui, unibi_set_left_margin_parm);
|
||||||
data->params[0].i = ui->width - 1;
|
UNIBI_SET_NUM_VAR(data->params[0], ui->width - 1);
|
||||||
unibi_out(ui, unibi_set_right_margin_parm);
|
unibi_out(ui, unibi_set_right_margin_parm);
|
||||||
}
|
}
|
||||||
unibi_out_ext(ui, data->unibi_ext.disable_lr_margin);
|
unibi_out_ext(ui, data->unibi_ext.disable_lr_margin);
|
||||||
@@ -728,8 +737,8 @@ static void tui_resize(UI *ui, Integer width, Integer height)
|
|||||||
ugrid_resize(&data->grid, (int)width, (int)height);
|
ugrid_resize(&data->grid, (int)width, (int)height);
|
||||||
|
|
||||||
if (!got_winch) { // Try to resize the terminal window.
|
if (!got_winch) { // Try to resize the terminal window.
|
||||||
data->params[0].i = (int)height;
|
UNIBI_SET_NUM_VAR(data->params[0], (int)height);
|
||||||
data->params[1].i = (int)width;
|
UNIBI_SET_NUM_VAR(data->params[1], (int)width);
|
||||||
unibi_out_ext(ui, data->unibi_ext.resize_screen);
|
unibi_out_ext(ui, data->unibi_ext.resize_screen);
|
||||||
// DECSLPP does not reset the scroll region.
|
// DECSLPP does not reset the scroll region.
|
||||||
if (data->scroll_region_is_full_screen) {
|
if (data->scroll_region_is_full_screen) {
|
||||||
@@ -863,7 +872,7 @@ static void tui_set_mode(UI *ui, ModeShape mode)
|
|||||||
int attr = syn_id2attr(c.id);
|
int attr = syn_id2attr(c.id);
|
||||||
if (attr > 0) {
|
if (attr > 0) {
|
||||||
attrentry_T *aep = syn_cterm_attr2entry(attr);
|
attrentry_T *aep = syn_cterm_attr2entry(attr);
|
||||||
data->params[0].i = aep->rgb_bg_color;
|
UNIBI_SET_NUM_VAR(data->params[0], aep->rgb_bg_color);
|
||||||
unibi_out_ext(ui, data->unibi_ext.set_cursor_color);
|
unibi_out_ext(ui, data->unibi_ext.set_cursor_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -874,7 +883,7 @@ static void tui_set_mode(UI *ui, ModeShape mode)
|
|||||||
case SHAPE_VER: shape = 5; break;
|
case SHAPE_VER: shape = 5; break;
|
||||||
default: WLOG("Unknown shape value %d", shape); break;
|
default: WLOG("Unknown shape value %d", shape); break;
|
||||||
}
|
}
|
||||||
data->params[0].i = shape + (int)(c.blinkon == 0);
|
UNIBI_SET_NUM_VAR(data->params[0], shape + (int)(c.blinkon == 0));
|
||||||
unibi_out_ext(ui, data->unibi_ext.set_cursor_style);
|
unibi_out_ext(ui, data->unibi_ext.set_cursor_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,14 +936,14 @@ static void tui_scroll(UI *ui, Integer count)
|
|||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
unibi_out(ui, unibi_delete_line);
|
unibi_out(ui, unibi_delete_line);
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = (int)count;
|
UNIBI_SET_NUM_VAR(data->params[0], (int)count);
|
||||||
unibi_out(ui, unibi_parm_delete_line);
|
unibi_out(ui, unibi_parm_delete_line);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (count == -1) {
|
if (count == -1) {
|
||||||
unibi_out(ui, unibi_insert_line);
|
unibi_out(ui, unibi_insert_line);
|
||||||
} else {
|
} else {
|
||||||
data->params[0].i = -(int)count;
|
UNIBI_SET_NUM_VAR(data->params[0], -(int)count);
|
||||||
unibi_out(ui, unibi_parm_insert_line);
|
unibi_out(ui, unibi_parm_insert_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1177,8 +1186,8 @@ end:
|
|||||||
static void unibi_goto(UI *ui, int row, int col)
|
static void unibi_goto(UI *ui, int row, int col)
|
||||||
{
|
{
|
||||||
TUIData *data = ui->data;
|
TUIData *data = ui->data;
|
||||||
data->params[0].i = row;
|
UNIBI_SET_NUM_VAR(data->params[0], row);
|
||||||
data->params[1].i = col;
|
UNIBI_SET_NUM_VAR(data->params[1], col);
|
||||||
unibi_out(ui, unibi_cursor_address);
|
unibi_out(ui, unibi_cursor_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1190,7 +1199,8 @@ static void unibi_goto(UI *ui, int row, int col)
|
|||||||
str = fn(data->ut, (unsigned)unibi_index); \
|
str = fn(data->ut, (unsigned)unibi_index); \
|
||||||
} \
|
} \
|
||||||
if (str) { \
|
if (str) { \
|
||||||
unibi_var_t vars[26 + 26] = { { 0 } }; \
|
unibi_var_t vars[26 + 26]; \
|
||||||
|
memset(&vars, 0, sizeof(vars)); \
|
||||||
unibi_format(vars, vars + 26, str, data->params, out, ui, NULL, NULL); \
|
unibi_format(vars, vars + 26, str, data->params, out, ui, NULL, NULL); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|||||||
@@ -625,10 +625,10 @@ static const int included_patches[] = {
|
|||||||
// 330,
|
// 330,
|
||||||
// 329,
|
// 329,
|
||||||
// 328,
|
// 328,
|
||||||
// 327,
|
327,
|
||||||
326,
|
326,
|
||||||
325,
|
325,
|
||||||
// 324,
|
324,
|
||||||
// 323,
|
// 323,
|
||||||
322,
|
322,
|
||||||
// 321,
|
// 321,
|
||||||
@@ -647,10 +647,10 @@ static const int included_patches[] = {
|
|||||||
308,
|
308,
|
||||||
307,
|
307,
|
||||||
// 306,
|
// 306,
|
||||||
// 305,
|
305,
|
||||||
// 304,
|
// 304,
|
||||||
// 303,
|
// 303,
|
||||||
// 302,
|
// 302, NA
|
||||||
// 301,
|
// 301,
|
||||||
300,
|
300,
|
||||||
// 299,
|
// 299,
|
||||||
@@ -658,7 +658,7 @@ static const int included_patches[] = {
|
|||||||
297,
|
297,
|
||||||
// 296,
|
// 296,
|
||||||
// 295,
|
// 295,
|
||||||
// 294,
|
294,
|
||||||
// 293,
|
// 293,
|
||||||
// 292,
|
// 292,
|
||||||
291,
|
291,
|
||||||
|
|||||||
Reference in New Issue
Block a user