Thursday, September 29, 2011

Re: Insert a tab or call a function

On 09/29/2011 01:30 AM, Christian Brabandt wrote:
> On Wed, September 28, 2011 10:52 pm, AK wrote:
>> Hi, I'm trying to write a small function that is called when I press tab
>> key and checks if current line is empty; if it is, it should insert a
>> tab, and if not, it should call two other functions. Here's the example
>> of what I came up with, which does not work right:
>>
>> function! DoTab()
>> if match(getline('.'), '^\s*$') != -1
>> call feedkeys("\<tab>") | return ''
>> else
>> call CloseMenu()
>> call feedkeys("\<c-r>=TriggerSnippet()\<cr>") | return ''
>> endif
>> endfu
>> ino<silent> <tab> <c-o>:call DoTab()<CR>
>>
>> CloseMenu is another function I have that closes a popup menu if it's
>> open, TriggerSnippet is a snipmate function that expands current
>> snippet.
>
> And now the question: What are you expecting and what do you see instead?
> Please don't let us guess, what is not working!
>
> regards,
> Christian
>


Sorry, but it was just flickering the cursor on screen, so
I thought it was some obvious error in the way I wrote it.

-ak

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: