Re: echo question
I forgot CC:[EMAIL PROTECTED] Then I'll send you twice. Jared wrote: On 5/14/2006 1:37 AM, Gerald Lai wrote: On Sun, 14 May 2006, Yakov Lerner wrote: Try 2 things (1) add :redraw before the :echo in question (2) if that doesn't help, make message shorter. I noticed that if message is longer than screen width-15, it cases the prompt. You could also readjust the height of the command-line dynamically: let msg = str let len = strlen(substitute(msg, ., x, g)) let t_ch = cmdheight let cmdheight = len / (columns - 15) + 1 echo msg let cmdheight = t_ch See :help 'cmdheight' :help strlen(). I tried adding :redraw, but that didn't seem to work. As for making the message shorter or the changing the height, I don't think those are applicable. The line is not longer than the window width. In fact, this is the function: function Toggle_spell() if spell exec set nospell else exec set spell echo ]s to skip to word, zg to add word, z= to suggest word endif endfunction nmap C-s :call Toggle_spell()CR I just want to display a message in the status reminding me of the commands when I enable the spell checker. Any other ideas? Thanks. I think that your 'cmdheight' is 1 and 'showcmd' or 'ruler' is on and perhaps 'laststatus' is 0 or 1. How about this let ru_save = ruler let sc_save = showcmd set noruler noshowcmd echo ]s to skip to word, zg to add word, z= to suggest word let showcmd = sc_save let ruler = ru_save But the message may be truncated when there is no space for showcmd and ruler. It seems that showcmd and ruler require some spaces on the right side of cmdline area. -- Yukihiro Nakadaira [EMAIL PROTECTED]
Re: undo/redo mess with version 7.0 and utf-8 text
# I failed in sending this mail. I'll resend it. This is old subject but I think this report might help someone. When using GTK2 GUI and XIM and GTK_IM_MODULE=scim, one undo command undoes several insert command because undo sequence is not broken. And also it causes error E438. This is because ... 1. scim doesn't invoke im_preedit_start_cb() and im_preedit_end_cb(), so the xim_has_preediting can be reset in im_preedit_changed_cb() only. 2. To delete preedit, scim invoke im_preedit_changed_cb() with empty preedit string only one time. But at the time preedit_start_col is not MAXCOL and xim_is_preediting is not reset. Therefore xim_is_preediting is always TRUE and undo sequence is not broken (u_sync() is canceled). This problem can be avoided to use OverTheSpot instead of OnTheSpot (this can be set with scim-setup), or to set environment variables, GTK_IM_MODULE=xim and [EMAIL PROTECTED], or to use the following patch. The code around there was added at 6.2.451. I don't understand why checking if preedit_start_col is MAXCOL. I think that the line can be removed. *** mbyte.c.origMon Aug 28 17:19:28 2006 --- mbyte.c Mon Aug 28 17:19:30 2006 *** *** 3741,3748 } else if (cursor_index == 0 preedit_string[0] == '\0') { ! if (preedit_start_col == MAXCOL) ! xim_has_preediting = FALSE; /* If at the start position (after typing backspace) * preedit_start_col must be reset. */ --- 3741,3747 } else if (cursor_index == 0 preedit_string[0] == '\0') { ! xim_has_preediting = FALSE; /* If at the start position (after typing backspace) * preedit_start_col must be reset. */ -- Yukihiro Nakadaira [EMAIL PROTECTED]
Re: formatexpr examples
I wrote a plugin that uses formatexpr. But this is a bit complicated. http://yukihiro.nakadaira.googlepages.com/autofmt.zip -- Yukihiro Nakadaira - [EMAIL PROTECTED]
Re: timer revisited
In Vim7 feedkeys() can be used. autocmd CursorHold * call Timer() function! Timer() echo strftime(%c) let K_IGNORE = \x80\xFD\x35internal key code that is ignored call feedkeys(K_IGNORE) endfunction -- Yukihiro Nakadaira - [EMAIL PROTECTED]
Re: hi Comment guifg=white guibg=black in ~/.vimrc ignored
You should set 'background' option. set background=lightor dark hi ... hi ... If 'background' option is not set, Vim may change it while initializing GUI (after vimrc is sourced). Then syntax/syncolor.vim is sourced and highlight settings are reset. -- Yukihiro Nakadaira - [EMAIL PROTECTED]
Re: completion problem
Bram Moolenaar wrote: Yukihiro Nakadaira wrote: There are two problems in completion. I wrote a patch. Please check the following. 1. 'ignorecase' does not work for completion. For example, when :set nosmartcase ignorecase and buffer is 1: foo 2: Foo Then, complete with 3: C-N or 3: fC-N or 3: FC-N In all cases, only foo is matched. Hmm, setting 'ignorecase' was used as a hint that case doesn't matter. However, when it's set just to find more matches, you will still want to complete words with different case, I suppose. I expect 'noignorecase' 'ignorecase' 3: C-N3: C-N foo foo Foo Foo 3: fC-N 3: fC-N foo foo Foo 3: FC-N 3: FC-N Foo foo Foo This is same as searching behavior. And before 7.0.068, Vim behaved as I expect. I wonder if this change causes a problem in combination with other things, such as using longest in 'completeopt'. My patch seems to work with longest. But maybe it should be tested for other completion method. I checked only i_CTRL-X_CTRL-N. 2. Completion is slow when 'completeopt' doesn't have menu and menuone. Until search finished, current selected item is not displayed and typed key is not handled (except CTRL-C). I wonder when this is noticable. I do see a match displayed before the search is finished. Is this only in a very long file perhaps? Yes, I worry for very long file. The unoperatable time I complained to is only 3 or 5 seconds, but I don't like it. And I think there is no reason to not check if key is typed while searching, only when popup menu is not used. By the way, I got a crash with plain vim when 'completeopt' doesn't have longest and CTRL-L is used while completing. Reproducing: $ vim -u NONE :execute normal! ifoo\n\C-N\C-P\C-L This is stacktrace. #0 0x2889c0b9 in strlen () from /lib/libc.so.6 #1 0x08066191 in ins_compl_addfrommatch () at edit.c:3209 #2 0x080625f2 in edit (cmdchar=111, startln=1, count=1) at edit.c:753 #3 0x0811b55b in invoke_edit (cap=0xbfbfe4c0, repl=0, cmd=111, startln=1) at normal.c:8714 #4 0x0811a855 in n_opencmd (cap=0xbfbfe4c0) at normal.c:8085 #5 0x0811bd9c in nv_open (cap=0xbfbfe4c0) at normal.c:9059 #6 0x0810f810 in normal_cmd (oap=0xbfbfe530, toplevel=1) at normal.c:1137 #7 0x080d7201 in main_loop (cmdwin=0, noexmode=0) at main.c:1154 #8 0x080d6d63 in main (argc=3, argv=0xbfbfe6f8) at main.c:934 -- Yukihiro Nakadaira - [EMAIL PROTECTED]
Re: block insert mode and CTRL-C problem
Bram Moolenaar wrote: Yukihiro Nakadaira wrote: There are two problems in block insert mode (C-V + I). 1. When CTRL-C is used in block insert mode, text is inserted to first line only even if multi-line was selected. For example, when there are three lines and type 1GC-VjjIxxxC-C 1: aaa1: xxxaaa 2: bbb - 2: bbb 3: ccc3: ccc Please see op_insert() function in ops.c. After invoking edit(), got_int is TRUE when CTRL-C was used. Then u_save() returns FAIL and block_insert() is not invoked. Thus text is not inserted to other line. I think that is how it's supposed to happen: You abort the insertion with CTRL-C, thus further changes are not done. It makes sense. But CTRL-C can be used in Vim6. So I want to use CTRL-C to enter the block inserting, if possible. Perhaps is it corrected feature? 2. When CTRL-C is used in block insert mode, extra undo is added. This happens when using GUI. For example, type C-VIxxxC-C and do undo: insertundoundo 1: - 1: xxx - 1: xxx - 1: In CUI: insertundo 1: - 1: xxx - 1: This is stacktrace explaining how extra undo is added. That is indeed a problem. I think gotchars() should not be invoked for peekc(). This patch should fix it, but we need to check for side effects: Thanks, I'll try it. -- Yukihiro Nakadaira - [EMAIL PROTECTED]
Re: Calling COM Components from Vim (Win32)
Although this is still a bit inconvenient, it is possible to keep DLL loaded by incrementing reference count itself. /* test.c */ #ifdef WIN32 # include windows.h #else # include dlfcn.h #endif #ifdef _MSC_VER # define EXPORT __declspec(dllexport) #else # define EXPORT #endif EXPORT int load(char *path); EXPORT int count(); int load(char *path) { #ifdef WIN32 return (LoadLibrary(path) != NULL); #else return (dlopen(path, RTLD_LAZY) != NULL); #endif } static int x = 0; int count() { return ++x; } test.vim let dll = has(win32) ? test.dll : test.so call libcallnr(dll, load, dll) for i in range(10) echo libcallnr(dll, count, 0) endfor -- Yukihiro Nakadaira - [EMAIL PROTECTED]
if_spidermonkey
Hi, all. I have a patch to add SpiderMonkey interface to Vim. This is not well tested and have only few features. But someone is interested in this. (This is not proposal to add SpiderMonkey interface to Vim) http://yukihiro.nakadaira.googlepages.com/if_spidermonkey.diff Usage: (On Windows) 1. Compile SpiderMonkey wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.60.tar.gz tar xzf js-1.60.tar.gz cd js\src nmake -f js.mak CFG=js - Win32 Release 2. Compile Vim with if_spidermonkey svn co https://vim.svn.sourceforge.net/svnroot/vim/vim7 cd vim7 patch -p1 if_spidermonkey.diff cd src namke -f Make_mvc.mak USE_MSVCRT=yes GUI=yes SPIDERMONKEY=C:\tmp\js DYNAMIC_SPIDERMONKEY=yes DYNAMIC_SPIDERMONKEY_DLL=js32.dll 3. Type :spidermonkey command :spidermonkey print(hello, JavaScript!) see :help if_spidermonkey.txt -- Yukihiro Nakadaira - [EMAIL PROTECTED]