<commit_before>" C/C++ specific settings

" Change default commentstring
setlocal commentstring=//\ %s

" Add cscope database, if present in current directory
if filereadable('cscope.out')
    cs add cscope.out
endif

" Find the callers of the function under cursor
nmap <C-\>c :cs find c <C-R>=expand('<cword>')<CR><CR>

" Prefer cscope over ctags for <C-]>
set cscopetag

" Echo current method's header (works for simple well-structured programs)
function! CurrentFunction()
    " Get the previous line that starts without space and ends with '{'
    let startline = getline(search("^[^ \s\t].*[^:]$", 'nb'))
    " Check if the line contains 'class' or 'struct'
    if startline =~ ".*\\(class\\|struct\\).*"
        " If yes, then print the value of the motion '[m'
        execute "normal! mxHmy`x[m"
        let startline = getline('.')
        execute "normal! `yzt`x"
        echo startline
    else
        " Else print the line itself
        echo startline
    endif
endfunction
nnoremap ,m :call CurrentFunction()<CR><commit_msg>Taking care of comments while getting the current function name in C/C++ files.<commit_after>" C/C++ specific settings

" Change default commentstring
setlocal commentstring=//\ %s

" Add cscope database, if present in current directory
if filereadable('cscope.out')
    cs add cscope.out
endif

" Find the callers of the function under cursor
nmap <C-\>c :cs find c <C-R>=expand('<cword>')<CR><CR>

" Prefer cscope over ctags for <C-]>
set cscopetag

" Echo current method's header (works for simple well-structured programs)
function! CurrentFunction()
    " Get the previous uncommented line that starts without space and ends with '{'
    let startline = getline(search("^[^ \s\t\/\/].*[^:]$", 'nb'))
    " Check if the line contains 'class' or 'struct'
    if startline =~ ".*\\(class\\|struct\\).*"
        " If yes, then print the value of the motion '[m'
        execute "normal! mxHmy`x[m"
        let startline = getline('.')
        execute "normal! `yzt`x"
        echo startline
    else
        " Else print the line itself
        echo startline
    endif
endfunction
nnoremap ,m :call CurrentFunction()<CR>
{'fraction_non_alphanumeric': 0.12488436632747456, 'fraction_numerical': 0.0, 'mean_word_length': 3.274703557312253, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '897090', 'n_tokens_mistral': 676, 'n_tokens_neox': 658, 'n_words': 250}