On 2006-07-13, JD Miller <[EMAIL PROTECTED]> wrote: > " Comment out a line by inserting "# " then move to the lower line > map <F10> i# <Esc>hj > > " Here I try to do the same thing but use the BufEnter event to make the > comment character > " change depending on the file type (*.asp). > > let comment_char="#" > autocmd BufEnter *.asp let comment_char="'" > execute "map <F10> i" . comment_char . " <Esc>hj" > > " But the comment_char variable never seems to see the let assignment in the > " autocmd statement. What have I missed here? Is there a better approach? > " Thank you.
On 2006-07-13, JD Miller <[EMAIL PROTECTED]> wrote: > Thanks much Hari, > > I added a space before the <Esc> and your method works nicely. > > map <F1> i<C-R>=comment_char<CR> <Esc>hj Another approach to this would be to make the mapping local to the buffer, e.g., map <F10> i#<Esc>hj autocmd BufEnter *.asp map <buffer> <F10> i'<Esc>hj HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA