[vim/vim] Vimscript lambdas in method chains are not indented correctly (Issue #18257)

3 views
Skip to first unread message

Balki

unread,
Sep 9, 2025, 8:36:41 PM (17 hours ago) Sep 9
to vim/vim, Subscribed
balki created an issue (vim/vim#18257)

Steps to reproduce

def ToggleBoolOpt(opt: string)                                       
    exe $"&{opt} = !&{opt}"                                          
    $"&{opt}"                                                        
        ->eval()                                                     
    ->( (v) => v ? "ON" : "OFF" )()                                  
        ->printf($"{opt} %s")                                        
        ->popup_notification({})                                     
enddef                                                               
noremap <Leader>ol <Cmd>call <SID>ToggleBoolOpt("relativenumber")<CR>

The = command indents the lambda incorrectly. Rest of the method calls are aligned properly

Expected behaviour

lambda's should be aligned same as other method calls like below.

def ToggleBoolOpt(opt: string)                                      
    exe $"&{opt} = !&{opt}"                                         
    $"&{opt}"                                                       
        ->eval()                                                    
        ->( (v) => v ? "ON" : "OFF" )()                             
        ->printf($"{opt} %s")                                       
        ->popup_notification({})                                    
enddef                                                              
noremap <Leader>ol <Cmd>call <SID>ToggleBoolOpt("relativenumber")<CR

Version of Vim

9.1 1-1734

Environment

Arch linux

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18257@github.com>

Reply all
Reply to author
Forward
0 new messages