Vim: Enterキー押下時、カーソルの右がとじ括弧だったら括弧の外側で改行
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"---------------- | |
" Enterキー押下時、カーソルの右がとじ括弧だったら括弧の外側で改行 | |
"---------------- | |
function! MyEnterFunc() | |
let pos = getpos('.') | |
let c = getline('.')[pos[2]-1] | |
if(c =~ "[\\)\\]]") | |
return "\<Right>\<Enter>" | |
endif | |
return "\<Enter>" | |
endfunction | |
inoremap <expr> <Enter> MyEnterFunc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment