Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- For those of you who may (still !) have to read/code in Fortran, using VIM, if you're navigating in a huge project written ages ago by people who were better at science than at coding, this might come in handy.
- This little script ads to your VIMs *statusline* the **name of the subroutine** youre cursor is currently in. It proved very useful for me, especially when dealing with similar subroutines that I did not write myself in the first place.
- The following function extract the name of the current subroutine :
- function! SubName() abort
- if &syntax!='fortran'
- return ''
- endif
- let line_num = search('subroutine', 'bncW')
- return ' '.matchstr(getline(line_num), 'subroutine \zs\w\+').' '
- endfunction
- The next line updates your `statusline` :
- set statusline+=%8*%{SubName()}
- You may want to have
- set laststatus=2
- so that your statusline is always displayed, even when your window isn't splitted.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement