1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Can't get current line number in a source file.
12 Solution: Add the <slnum> item, similar to <sfile>.
16 *** ../vim-7.3.064/src/ex_docmd.c 2010-11-16 11:29:30.000000000 +0100
17 --- src/ex_docmd.c 2010-11-24 15:41:51.000000000 +0100
21 "<sfile>", /* ":so" file name */
24 "<afile>", /* autocommand file name */
25 ! # define SPEC_AFILE 6
26 "<abuf>", /* autocommand buffer number */
27 ! # define SPEC_ABUF 7
28 "<amatch>", /* autocommand match name */
29 ! # define SPEC_AMATCH 8
31 #ifdef FEAT_CLIENTSERVER
33 ! # define SPEC_CLIENT 9
39 "<sfile>", /* ":so" file name */
41 + "<slnum>", /* ":so" file line number */
42 + #define SPEC_SLNUM 6
44 "<afile>", /* autocommand file name */
45 ! # define SPEC_AFILE 7
46 "<abuf>", /* autocommand buffer number */
47 ! # define SPEC_ABUF 8
48 "<amatch>", /* autocommand match name */
49 ! # define SPEC_AMATCH 9
51 #ifdef FEAT_CLIENTSERVER
53 ! # ifdef FEAT_AUTOCMD
54 ! # define SPEC_CLIENT 10
56 ! # define SPEC_CLIENT 7
64 * '<cWORD>' to WORD under the cursor
65 * '<cfile>' to path name under the cursor
66 * '<sfile>' to sourced file name
67 + * '<slnum>' to sourced file line number
68 * '<afile>' to file name for autocommand
69 * '<abuf>' to buffer number for autocommand
70 * '<amatch>' to matching name for autocommand
73 #ifdef FEAT_MODIFY_FNAME
77 - #if defined(FEAT_AUTOCMD) || defined(FEAT_CLIENTSERVER)
90 + case SPEC_SLNUM: /* line in file for ":so" command */
91 + if (sourcing_name == NULL || sourcing_lnum == 0)
93 + *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
96 + sprintf((char *)strbuf, "%ld", (long)sourcing_lnum);
99 #if defined(FEAT_CLIENTSERVER)
100 case SPEC_CLIENT: /* Source of last submitted input */
101 sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
102 *** ../vim-7.3.064/src/version.c 2010-11-24 14:28:53.000000000 +0100
103 --- src/version.c 2010-11-24 15:49:57.000000000 +0100
107 { /* Add new patch number below this line */
114 If you don't get everything you want, think of
115 everything you didn't get and don't want.
117 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
118 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
119 \\\ an exciting new programming language -- http://www.Zimbu.org ///
120 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///