We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free. Anti-spam check. Do not fill this in!==Change to forward/back slashes== The following mappings (for your [[vimrc]]) allow easily changing slashes in the current line. <pre> nnoremap <silent> <Leader>/ :let tmp=@/<Bar>s:\\:/:ge<Bar>let @/=tmp<Bar>noh<CR> nnoremap <silent> <Leader><Bslash> :let tmp=@/<Bar>s:/:\\:ge<Bar>let @/=tmp<Bar>noh<CR> </pre> By default the <code><Leader></code> key is backslash, and <code><Bslash></code> is a way to refer to a backslash in a mapping, so by default these commands map <code>\/</code> and <code>\\</code> respectively. Press <code>\/</code> to change every backslash to a forward slash, in the current line. Press <code>\\</code> to change every forward slash to a backslash, in the current line. The mappings save and restore the search register (<code>@/</code>) so a previous search can be continued, if wanted. The <code>:noh</code> command is used to remove search highlighting (if enabled) to avoid search hits being highlighted after setting the search register. In the substitute command (<code>:s</code>), a colon (<code>:</code>) is used as a delimiter, so the slashes do not need to be escaped. The substitute flags (<code>ge</code>) cause all occurrences on the line to be substituted (<code>g</code>), and no error to be reported if no slash is found (<code>e</code>). Summary: Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA Cancel Editing help (opens in new window) Retrieved from "https://vim.fandom.com/wiki/Change_between_backslash_and_forward_slash"