April 26, 2020

Renaming files in Vim: A Vimscript experiment

I took an attempt at creating a Vimscript function to rename a file with a simple command. It was not that hard, but there are a few tricks that you need to learn to get started writing Vimscript. Let’s first look at the full code for the function, with a mapping to <leader>fr function! s:RenameCurrentFile( newName ) let l:file = expand('%') let l:currentFilePath = expand('%:p:h') let l:newFile = l:currentFilePath . '/' . Read more

Copyright Marin Gilles 2019-2022