mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
Merge #9578 'vim-patch:8.0.{1045,1073,1077,1114}'
This commit is contained in:
@@ -3134,7 +3134,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
may change in later releases.
|
may change in later releases.
|
||||||
|
|
||||||
*'iminsert'* *'imi'*
|
*'iminsert'* *'imi'*
|
||||||
'iminsert' 'imi' number (default 0, 2 when an input method is supported)
|
'iminsert' 'imi' number (default 0)
|
||||||
local to buffer
|
local to buffer
|
||||||
Specifies whether :lmap or an Input Method (IM) is to be used in
|
Specifies whether :lmap or an Input Method (IM) is to be used in
|
||||||
Insert mode. Valid values:
|
Insert mode. Valid values:
|
||||||
@@ -3154,7 +3154,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
It is also used for the argument of commands like "r" and "f".
|
It is also used for the argument of commands like "r" and "f".
|
||||||
|
|
||||||
*'imsearch'* *'ims'*
|
*'imsearch'* *'ims'*
|
||||||
'imsearch' 'ims' number (default 0, 2 when an input method is supported)
|
'imsearch' 'ims' number (default -1)
|
||||||
local to buffer
|
local to buffer
|
||||||
Specifies whether :lmap or an Input Method (IM) is to be used when
|
Specifies whether :lmap or an Input Method (IM) is to be used when
|
||||||
entering a search pattern. Valid values:
|
entering a search pattern. Valid values:
|
||||||
|
109
runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
vendored
109
runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
vendored
@@ -1,40 +1,133 @@
|
|||||||
" Debugger commands.
|
" Debugger plugin using gdb.
|
||||||
"
|
"
|
||||||
" WORK IN PROGRESS - much doesn't work yet
|
" WORK IN PROGRESS - much doesn't work yet
|
||||||
"
|
"
|
||||||
" Open two terminal windows:
|
" Open two visible terminal windows:
|
||||||
" 1. run a pty, as with ":term NONE"
|
" 1. run a pty, as with ":term NONE"
|
||||||
" 2. run gdb, passing the pty
|
" 2. run gdb, passing the pty
|
||||||
" The current window is used to edit source code and follows gdb.
|
" The current window is used to view source code and follows gdb.
|
||||||
|
"
|
||||||
|
" A third terminal window is hidden, it is used for communication with gdb.
|
||||||
|
"
|
||||||
|
" The communication with gdb uses GDB/MI. See:
|
||||||
|
" https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html
|
||||||
"
|
"
|
||||||
" Author: Bram Moolenaar
|
" Author: Bram Moolenaar
|
||||||
" Copyright: Vim license applies
|
" Copyright: Vim license applies, see ":help license"
|
||||||
|
|
||||||
" In case this gets loaded twice.
|
" In case this gets loaded twice.
|
||||||
if exists(':Termdebug')
|
if exists(':Termdebug')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" The command that starts debugging, e.g. ":Termdebug vim".
|
||||||
|
" To end type "quit" in the gdb window.
|
||||||
command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
|
command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
|
||||||
|
|
||||||
|
" Name of the gdb command, defaults to "gdb".
|
||||||
if !exists('debugger')
|
if !exists('debugger')
|
||||||
let debugger = 'gdb'
|
let debugger = 'gdb'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Sign used to highlight the line where the program has stopped.
|
||||||
|
sign define debugPC linehl=debugPC
|
||||||
|
if &background == 'light'
|
||||||
|
hi debugPC term=reverse ctermbg=lightblue guibg=lightblue
|
||||||
|
else
|
||||||
|
hi debugPC term=reverse ctermbg=darkblue guibg=darkblue
|
||||||
|
endif
|
||||||
|
let s:pc_id = 12
|
||||||
|
|
||||||
func s:StartDebug(cmd)
|
func s:StartDebug(cmd)
|
||||||
|
let s:startwin = win_getid(winnr())
|
||||||
|
let s:startsigncolumn = &signcolumn
|
||||||
|
|
||||||
" Open a terminal window without a job, to run the debugged program
|
" Open a terminal window without a job, to run the debugged program
|
||||||
let s:ptybuf = term_start('NONE', {})
|
let s:ptybuf = term_start('NONE', {
|
||||||
let pty = job_info(term_getjob(s:ptybuf))['tty']
|
\ 'term_name': 'gdb program',
|
||||||
|
\ })
|
||||||
|
if s:ptybuf == 0
|
||||||
|
echoerr 'Failed to open the program terminal window'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let pty = job_info(term_getjob(s:ptybuf))['tty_out']
|
||||||
|
|
||||||
|
" Create a hidden terminal window to communicate with gdb
|
||||||
|
let s:commbuf = term_start('NONE', {
|
||||||
|
\ 'term_name': 'gdb communication',
|
||||||
|
\ 'out_cb': function('s:CommOutput'),
|
||||||
|
\ 'hidden': 1,
|
||||||
|
\ })
|
||||||
|
if s:commbuf == 0
|
||||||
|
echoerr 'Failed to open the communication terminal window'
|
||||||
|
exe 'bwipe! ' . s:ptybuf
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let commpty = job_info(term_getjob(s:commbuf))['tty_out']
|
||||||
|
|
||||||
" Open a terminal window to run the debugger.
|
" Open a terminal window to run the debugger.
|
||||||
let cmd = [g:debugger, '-tty', pty, a:cmd]
|
let cmd = [g:debugger, '-tty', pty, a:cmd]
|
||||||
echomsg 'executing "' . join(cmd) . '"'
|
echomsg 'executing "' . join(cmd) . '"'
|
||||||
let gdbbuf = term_start(cmd, {
|
let gdbbuf = term_start(cmd, {
|
||||||
\ 'exit_cb': function('s:EndDebug'),
|
\ 'exit_cb': function('s:EndDebug'),
|
||||||
\ 'term_finish': 'close'
|
\ 'term_finish': 'close',
|
||||||
\ })
|
\ })
|
||||||
|
if gdbbuf == 0
|
||||||
|
echoerr 'Failed to open the gdb terminal window'
|
||||||
|
exe 'bwipe! ' . s:ptybuf
|
||||||
|
exe 'bwipe! ' . s:commbuf
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Connect gdb to the communication pty, using the GDB/MI interface
|
||||||
|
call term_sendkeys(gdbbuf, 'new-ui mi ' . commpty . "\r")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func s:EndDebug(job, status)
|
func s:EndDebug(job, status)
|
||||||
exe 'bwipe! ' . s:ptybuf
|
exe 'bwipe! ' . s:ptybuf
|
||||||
|
exe 'bwipe! ' . s:commbuf
|
||||||
|
call setwinvar(s:startwin, '&signcolumn', s:startsigncolumn)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" Handle a message received from gdb on the GDB/MI interface.
|
||||||
|
func s:CommOutput(chan, msg)
|
||||||
|
let msgs = split(a:msg, "\r")
|
||||||
|
|
||||||
|
for msg in msgs
|
||||||
|
" remove prefixed NL
|
||||||
|
if msg[0] == "\n"
|
||||||
|
let msg = msg[1:]
|
||||||
|
endif
|
||||||
|
if msg != ''
|
||||||
|
if msg =~ '^\*\(stopped\|running\)'
|
||||||
|
let wid = win_getid(winnr())
|
||||||
|
|
||||||
|
if win_gotoid(s:startwin)
|
||||||
|
if msg =~ '^\*stopped'
|
||||||
|
" TODO: proper parsing
|
||||||
|
let fname = substitute(msg, '.*fullname="\([^"]*\)".*', '\1', '')
|
||||||
|
let lnum = substitute(msg, '.*line="\([^"]*\)".*', '\1', '')
|
||||||
|
if lnum =~ '^[0-9]*$'
|
||||||
|
if expand('%:h') != fname
|
||||||
|
if &modified
|
||||||
|
" TODO: find existing window
|
||||||
|
exe 'split ' . fnameescape(fname)
|
||||||
|
let s:startwin = win_getid(winnr())
|
||||||
|
else
|
||||||
|
exe 'edit ' . fnameescape(fname)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
exe lnum
|
||||||
|
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fnameescape(fname)
|
||||||
|
setlocal signcolumn=yes
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
exe 'sign unplace ' . s:pc_id
|
||||||
|
endif
|
||||||
|
|
||||||
|
call win_gotoid(wid)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -3224,6 +3224,9 @@ int build_stl_str_hl(
|
|||||||
#define TMPLEN 70
|
#define TMPLEN 70
|
||||||
char_u tmp[TMPLEN];
|
char_u tmp[TMPLEN];
|
||||||
char_u *usefmt = fmt;
|
char_u *usefmt = fmt;
|
||||||
|
const int save_must_redraw = must_redraw;
|
||||||
|
const int save_redr_type = curwin->w_redr_type;
|
||||||
|
const int save_highlight_shcnaged = need_highlight_changed;
|
||||||
|
|
||||||
// When the format starts with "%!" then evaluate it as an expression and
|
// When the format starts with "%!" then evaluate it as an expression and
|
||||||
// use the result as the actual format string.
|
// use the result as the actual format string.
|
||||||
@@ -3632,16 +3635,16 @@ int build_stl_str_hl(
|
|||||||
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
|
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
|
||||||
set_internal_string_var((char_u *)"g:actual_curbuf", tmp);
|
set_internal_string_var((char_u *)"g:actual_curbuf", tmp);
|
||||||
|
|
||||||
buf_T *o_curbuf = curbuf;
|
buf_T *const save_curbuf = curbuf;
|
||||||
win_T *o_curwin = curwin;
|
win_T *const save_curwin = curwin;
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = wp->w_buffer;
|
curbuf = wp->w_buffer;
|
||||||
|
|
||||||
// Note: The result stored in `t` is unused.
|
// Note: The result stored in `t` is unused.
|
||||||
str = eval_to_string_safe(out_p, &t, use_sandbox);
|
str = eval_to_string_safe(out_p, &t, use_sandbox);
|
||||||
|
|
||||||
curwin = o_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = o_curbuf;
|
curbuf = save_curbuf;
|
||||||
|
|
||||||
// Remove the variable we just stored
|
// Remove the variable we just stored
|
||||||
do_unlet(S_LEN("g:actual_curbuf"), true);
|
do_unlet(S_LEN("g:actual_curbuf"), true);
|
||||||
@@ -4262,6 +4265,13 @@ int build_stl_str_hl(
|
|||||||
cur_tab_rec->def.func = NULL;
|
cur_tab_rec->def.func = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We do not want redrawing a stausline, ruler, title, etc. to trigger
|
||||||
|
// another redraw, it may cause an endless loop. This happens when a
|
||||||
|
// statusline changes a highlight group.
|
||||||
|
must_redraw = save_must_redraw;
|
||||||
|
curwin->w_redr_type = save_redr_type;
|
||||||
|
need_highlight_changed = save_highlight_shcnaged;
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1173,9 +1173,7 @@ return {
|
|||||||
vi_def=true,
|
vi_def=true,
|
||||||
varname='p_iminsert', pv_name='p_imi',
|
varname='p_iminsert', pv_name='p_imi',
|
||||||
defaults={
|
defaults={
|
||||||
condition='B_IMODE_IM',
|
if_true={vi=macros('B_IMODE_NONE')},
|
||||||
if_true={vi=macros('B_IMODE_IM')},
|
|
||||||
if_false={vi=macros('B_IMODE_NONE')},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1184,9 +1182,7 @@ return {
|
|||||||
vi_def=true,
|
vi_def=true,
|
||||||
varname='p_imsearch', pv_name='p_ims',
|
varname='p_imsearch', pv_name='p_ims',
|
||||||
defaults={
|
defaults={
|
||||||
condition='B_IMODE_IM',
|
if_true={vi=macros('B_IMODE_USE_INSERT')},
|
||||||
if_true={vi=macros('B_IMODE_IM')},
|
|
||||||
if_false={vi=macros('B_IMODE_NONE')},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -24,6 +24,9 @@ let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
|||||||
set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
|
set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
|
||||||
let &packpath = &rtp
|
let &packpath = &rtp
|
||||||
|
|
||||||
|
" Avoid storing shell history.
|
||||||
|
let $HISTFILE = ""
|
||||||
|
|
||||||
" Make sure $HOME does not get read or written.
|
" Make sure $HOME does not get read or written.
|
||||||
let $HOME = expand(getcwd() . '/XfakeHOME')
|
let $HOME = expand(getcwd() . '/XfakeHOME')
|
||||||
if !isdirectory($HOME)
|
if !isdirectory($HOME)
|
||||||
|
@@ -32,9 +32,9 @@ describe(':setlocal', function()
|
|||||||
eq(0, meths.get_option('iminsert'))
|
eq(0, meths.get_option('iminsert'))
|
||||||
feed_command('setlocal iminsert=1')
|
feed_command('setlocal iminsert=1')
|
||||||
eq(0, meths.get_option('iminsert'))
|
eq(0, meths.get_option('iminsert'))
|
||||||
eq(0, meths.get_option('imsearch'))
|
eq(-1, meths.get_option('imsearch'))
|
||||||
feed_command('setlocal imsearch=1')
|
feed_command('setlocal imsearch=1')
|
||||||
eq(0, meths.get_option('imsearch'))
|
eq(-1, meths.get_option('imsearch'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user