Git commit messages lost by vi

You should set vim to not detach from the shell and be in the foreground. You can do this with the following command: git config –global core.editor vim -f From the man: -f Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in. On the Amiga, Vim … Read more

How to search/replace special chars?

Check the help for \%u: /\%d /\%x /\%o /\%u /\%U E678 \%d123 Matches the character specified with a decimal number. Must be followed by a non-digit. \%o40 Matches the character specified with an octal number up to 0377. Numbers below 040 must be followed by a non-octal digit or a non-digit. \%x2a Matches the character … Read more

mapping function keys in vim

Your problem is that vim does not know what does terminal emit when you press <F2>. On some terminals it emits something like <Esc>[12~, so the vim quits current mode (or just beeps if it can’t) (<ESC>), does nothing ([1: there must be some key after [, but not 1, so it does nothing) and … Read more

How can I make Vim autosave files when it loses focus?

You don’t care about errors in those circumstances since there is nothing you can reasonably do about them anyway – especially when losing focus. So just swallow them: autocmd BufLeave,FocusLost * silent! wall Much simpler than an elaborate dance to figure out where there would be an error in order to avoid it.

^@ symbol in vim

That is the null character, in a format (which Vim uses a lot, as you’ve probably noticed) called caret notation. Basically, somehow you’re getting bytes full of zeros into your file. Since we don’t know what your utility is doing, if it’s the culprit, you’ll need to show us some code if you want us … Read more

How to open files in web browsers (e.g Firefox) within editors like vim or emacs?

browse-url-of-file is an interactive compiled Lisp function in `browse-url.el’. It is bound to <menu-bar> <HTML> <Load this Buffer in Browser>, C-c C-z v. (browse-url-of-file &optional file) Ask a WWW browser to display file. Display the current buffer’s file if file is nil or if called interactively. Turn the filename into a URL with function browse-url-file-url. … Read more