diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | man/nvim.1 | 3 | ||||
-rw-r--r-- | runtime/doc/options.txt | 8 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 12 | ||||
-rw-r--r-- | runtime/doc/various.txt | 1 | ||||
-rw-r--r-- | runtime/optwin.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/dircolors.vim | 42 | ||||
-rw-r--r-- | src/nvim/eval.c | 1 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/options.lua | 8 | ||||
-rw-r--r-- | src/nvim/syntax.c | 42 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 8 | ||||
-rw-r--r-- | test/functional/viml/completion_spec.lua | 1 |
14 files changed, 87 insertions, 54 deletions
@@ -94,7 +94,7 @@ functionaltest: | nvim functionaltest-lua: | nvim +$(BUILD_CMD) -C build functionaltest-lua -testlint: | nvim +testlint: | build/.ran-cmake deps $(BUILD_CMD) -C build testlint unittest: | nvim @@ -115,10 +115,12 @@ distclean: clean install: | nvim +$(BUILD_CMD) -C build install -lint: +clint: cmake -DLINT_PRG=./clint.py \ -DLINT_DIR=src \ -DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \ -P cmake/RunLint.cmake -.PHONY: test testlint functionaltest unittest lint clean distclean nvim libnvim cmake deps install +lint: clint testlint + +.PHONY: test testlint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install diff --git a/man/nvim.1 b/man/nvim.1 index 7e8cd5b809..2fa3ab8ff5 100644 --- a/man/nvim.1 +++ b/man/nvim.1 @@ -391,9 +391,6 @@ See in the .Xr tmux 1 manual page for more information. -.It Ev NVIM_TUI_ENABLE_TRUE_COLOR -If defined, assume the host terminal supports 24 bit colors. -Has no effect in GUIs. .El .Sh FILES .Bl -tag -width "~/.config/nvim/init.vim" diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 84fc2ecfc1..fedacfaea4 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6420,6 +6420,14 @@ A jump table for the options with a short description can be found at |Q_op|. *'termencoding'* *'tenc'* 'termencoding' 'tenc' Removed. |vim-differences| {Nvim} + *'termguicolors'* *'tgc'* +'termguicolors' 'tgc' boolean (default off) + global + When on, uses |highlight-guifg| and |highlight-guibg| attributes in + the terminal (thus using 24-bit color). Requires a ISO-8613-3 + compatible terminal. + Must be set at startup (in your |init.vim| or |--cmd|). + *'terse'* *'noterse'* 'terse' boolean (default off) global diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 37593aef43..46efe1996a 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -350,7 +350,7 @@ argument. -W {scriptout} Like -w, but do not append, overwrite an existing file. ============================================================================== -3. Initialization *initialization* *startup* +2. Initialization *initialization* *startup* At startup, Vim checks environment variables and files and sets values accordingly. Vim proceeds in this order: @@ -601,7 +601,7 @@ This still won't work for systems where gvim does not use stdout at all though. ============================================================================== -4. $VIM and $VIMRUNTIME +3. $VIM and $VIMRUNTIME *$VIM* The environment variable "$VIM" is used to locate various user files for Vim, such as the user startup script |init.vim|. This depends on the system, see @@ -663,7 +663,7 @@ greps in the help files) you might be able to use this: > VIMRUNTIME="$(nvim -e --cmd 'echo $VIMRUNTIME|quit' 2>&1)" ============================================================================== -5. Suspending *suspend* +4. Suspending *suspend* *iconize* *iconise* *CTRL-Z* *v_CTRL-Z* CTRL-Z Suspend Vim, like ":stop". @@ -696,7 +696,7 @@ can't paste it in another application (since Vim is going to sleep an attempt to get the selection would make the program hang). ============================================================================== -6. Saving settings *save-settings* +5. Saving settings *save-settings* Mostly you will edit your vimrc files manually. This gives you the greatest flexibility. There are a few commands to generate a vimrc file automatically. @@ -753,7 +753,7 @@ these steps: You need to escape special characters, esp. spaces. ============================================================================== -7. Views and Sessions *views-sessions* +6. Views and Sessions *views-sessions* This is introduced in sections |21.4| and |21.5| of the user manual. @@ -897,7 +897,7 @@ To automatically save and restore views for *.c files: > au BufWinEnter *.c silent loadview ============================================================================== -8. The ShaDa file *shada* *shada-file* +7. The ShaDa file *shada* *shada-file* If you exit Vim and later start it again, you would normally lose a lot of information. The ShaDa file can be used to remember that information, which diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 3a2b8115db..af4224993f 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -371,6 +371,7 @@ N *+tablineat* 'tabline' option recognizing %@Func@ items. N *+tag_binary* binary searching in tags file |tag-binary-search| N *+tag_old_static* old method for static tags |tag-old-static| m *+tag_any_white* any white space allowed in tags file |tag-any-white| +B *+termguicolors* 24-bit color in xterm-compatible terminals support *+terminfo* uses |terminfo| instead of termcap N *+termresponse* support for |t_RV| and |v:termresponse| N *+textobjects* |text-objects| selection diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 7050436aab..07dcd31b1b 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -410,6 +410,10 @@ call append("$", "highlight\twhich highlighting to use for various occasions") call <SID>OptionG("hl", &hl) call append("$", "hlsearch\thighlight all matches for the last used search pattern") call <SID>BinOptionG("hls", &hls) +if has("termguicolors") + call append("$", "termguicolors\tuse GUI colors for the terminal") + call <SID>BinOptionG("tgc", &tgc) +endif if has("syntax") call append("$", "cursorcolumn\thighlight the screen column of the cursor") call append("$", "\t(local to window)") diff --git a/runtime/syntax/dircolors.vim b/runtime/syntax/dircolors.vim index c94d720644..1b598c39b5 100644 --- a/runtime/syntax/dircolors.vim +++ b/runtime/syntax/dircolors.vim @@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier highlight default link dircolorsEscape Special function! s:set_guicolors() abort - let s:guicolors = {} - - let s:guicolors[0] = "Black" - let s:guicolors[1] = "DarkRed" - let s:guicolors[2] = "DarkGreen" - let s:guicolors[3] = "DarkYellow" - let s:guicolors[4] = "DarkBlue" - let s:guicolors[5] = "DarkMagenta" - let s:guicolors[6] = "DarkCyan" - let s:guicolors[7] = "Gray" - let s:guicolors[8] = "DarkGray" - let s:guicolors[9] = "Red" - let s:guicolors[10] = "Green" - let s:guicolors[11] = "Yellow" - let s:guicolors[12] = "Blue" - let s:guicolors[13] = "Magenta" - let s:guicolors[14] = "Cyan" - let s:guicolors[15] = "White" + let s:termguicolors = {} + + let s:termguicolors[0] = "Black" + let s:termguicolors[1] = "DarkRed" + let s:termguicolors[2] = "DarkGreen" + let s:termguicolors[3] = "DarkYellow" + let s:termguicolors[4] = "DarkBlue" + let s:termguicolors[5] = "DarkMagenta" + let s:termguicolors[6] = "DarkCyan" + let s:termguicolors[7] = "Gray" + let s:termguicolors[8] = "DarkGray" + let s:termguicolors[9] = "Red" + let s:termguicolors[10] = "Green" + let s:termguicolors[11] = "Yellow" + let s:termguicolors[12] = "Blue" + let s:termguicolors[13] = "Magenta" + let s:termguicolors[14] = "Cyan" + let s:termguicolors[15] = "White" let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"] @@ -70,7 +70,7 @@ function! s:set_guicolors() abort for r in xterm_palette for g in xterm_palette for b in xterm_palette - let s:guicolors[cur_col] = '#' . r . g . b + let s:termguicolors[cur_col] = '#' . r . g . b let cur_col += 1 endfor endfor @@ -78,14 +78,14 @@ function! s:set_guicolors() abort for i in range(24) let g = i * 0xa + 8 - let s:guicolors[i + 232] = '#' . g . g . g + let s:termguicolors[i + 232] = '#' . g . g . g endfor endfunction function! s:get_hi_str(color, place) abort if a:color >= 0 && a:color <= 255 if has('gui_running') - return ' gui' . a:place . '=' . s:guicolors[a:color] + return ' gui' . a:place . '=' . s:termguicolors[a:color] elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 return ' cterm' . a:place . '=' . a:color endif diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6e9f89bbb5..8c8881b398 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10684,6 +10684,7 @@ static void f_has(typval_T *argvars, typval_T *rettv) "tablineat", "tag_binary", "tag_old_static", + "termguicolors", "termresponse", "textobjects", "title", diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 87a9a7398c..904e97f8ca 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -619,6 +619,7 @@ EXTERN long p_titlelen; ///< 'titlelen' EXTERN char_u *p_titleold; ///< 'titleold' EXTERN char_u *p_titlestring; ///< 'titlestring' EXTERN char_u *p_tsr; ///< 'thesaurus' +EXTERN bool p_tgc; ///< 'termguicolors' EXTERN int p_ttimeout; ///< 'ttimeout' EXTERN long p_ttm; ///< 'ttimeoutlen' EXTERN char_u *p_udir; ///< 'undodir' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index a743e8c605..218e34f595 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2383,6 +2383,14 @@ return { defaults={if_true={vi=""}} }, { + full_name='termguicolors', abbreviation='tgc', + type='bool', scope={'global'}, + vi_def=false, + redraw={'everything'}, + varname='p_tgc', + defaults={if_true={vi=false}} + }, + { full_name='terse', type='bool', scope={'global'}, vi_def=true, diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 41af7af55c..b2ab1f8a3a 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -2615,33 +2615,37 @@ find_endpos ( IF_SYN_TIME(&spp_skip->sp_time)); spp_skip->sp_prog = regmatch.regprog; if (r && regmatch.startpos[0].col <= best_regmatch.startpos[0].col) { - /* Add offset to skip pattern match */ + // Add offset to skip pattern match syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1); - /* If the skip pattern goes on to the next line, there is no - * match with an end pattern in this line. */ - if (pos.lnum > startpos->lnum) + // If the skip pattern goes on to the next line, there is no + // match with an end pattern in this line. + if (pos.lnum > startpos->lnum) { break; + } - line = ml_get_buf(syn_buf, startpos->lnum, FALSE); + line = ml_get_buf(syn_buf, startpos->lnum, false); + int line_len = (int)STRLEN(line); - /* take care of an empty match or negative offset */ - if (pos.col <= matchcol) - ++matchcol; - else if (pos.col <= regmatch.endpos[0].col) + // take care of an empty match or negative offset + if (pos.col <= matchcol) { + matchcol++; + } else if (pos.col <= regmatch.endpos[0].col) { matchcol = pos.col; - else - /* Be careful not to jump over the NUL at the end-of-line */ + } else { + // Be careful not to jump over the NUL at the end-of-line for (matchcol = regmatch.endpos[0].col; - line[matchcol] != NUL && matchcol < pos.col; - ++matchcol) - ; + matchcol < line_len && matchcol < pos.col; + matchcol++) { + } + } - /* if the skip pattern includes end-of-line, break here */ - if (line[matchcol] == NUL) + // if the skip pattern includes end-of-line, break here + if (matchcol >= line_len) { break; + } - continue; /* start with first end pattern again */ + continue; // start with first end pattern again } } @@ -5004,6 +5008,10 @@ static void syn_cmd_sync(exarg_T *eap, int syncing) curwin->w_s->b_syn_sync_maxlines = 0; } } else if (STRCMP(key, "LINECONT") == 0) { + if (*next_arg == NUL) { // missing pattern + illegal = true; + break; + } if (curwin->w_s->b_syn_linecont_pat != NULL) { EMSG(_("E403: syntax sync: line continuations pattern specified twice")); finished = TRUE; diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index e1c0407b27..202c5666a1 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -81,7 +81,7 @@ UI *tui_start(void) { UI *ui = xcalloc(1, sizeof(UI)); ui->stop = tui_stop; - ui->rgb = os_getenv("NVIM_TUI_ENABLE_TRUE_COLOR") != NULL; + ui->rgb = p_tgc; ui->resize = tui_resize; ui->clear = tui_clear; ui->eol_clear = tui_eol_clear; diff --git a/src/nvim/version.c b/src/nvim/version.c index 76b6115885..b55d31ea76 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -69,6 +69,10 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 1809, + 1808, + 1806, + 1799, 1757, 1755, 1753, @@ -624,9 +628,9 @@ static int included_patches[] = { // 1057, // 1056, 1055, - // 1054, + 1054, // 1053, - // 1052, + 1052, // 1051, // 1050, 1049, diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 0271540fe3..2b3844bf6d 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers') local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq -local insert = helpers.insert local execute, source, expect = helpers.execute, helpers.source, helpers.expect describe('completion', function() |