Show function name in status line

后端 未结 7 548
感情败类
感情败类 2020-12-15 03:10

I edit a large C, C++, or Java file, say, about 15000 lines, with pretty long function definitions, say, about 400 lines. When the cursor is in middle of a function definiti

相关标签:
7条回答
  • 2020-12-15 03:47

    Based on @solidak solution (which was already based on another one :)

    I wanted to always show the function name in the bottom of the terminal. But I had some problems with very large function which I solved that way:

    fun! ShowFuncName()
      echohl ModeMsg
      echo getline(search("^[^ \t#/]\\{2}.*[^:]\s*$", 'bWn'))[:winwidth('%')-3]
      echohl None
    endfun
    
    augroup show_funcname
      autocmd CursorMoved * :call ShowFuncName()
    augroup end
    
    0 讨论(0)
提交回复
热议问题