You can use %b or %B in statusline or rulerformat. From :help statusline:
b N Value of character under cursor.
B N As above, in hexadecimal.
set statusline=%b\ %B
Another way is to use ga or the :ascii command. From :help ga:
:as[cii] or ga :as :ascii
As romainl suggested, you can achieve so with the conceal feature of vim.
Here is a script example that can be used:
let rules = [
\ ['01' , '☺'],
\ ['02' , '☻'],
\ ['03' , '♥'],
\ ['04' , '♦'],
\ ['05' , '♣'],
\ ['06' , '♣'],
\ ['07' , '•'],
\ ['08' , '◘'],
\ ['^A' , '¢'],
for [value, ...
It is whatever you define whit :scriptencoding. it should be the first line in you .vimrc file, e.g.:
Be aware that some options (listchars for example) only accept single width values.
Edit: Yeah, Vim is weird. encoding is for the editor itself, fileencoding is for the buffer and scriptencoding is for Vim scripts.
Vim's name for that encoding is ucs-2le (ucs-2 for Unicode, 2 byte per character, le for little endian). You can open that via
:edit ++enc=ucs-2le filename
enforcing the encoding, or alternatively (if you open such files often), add that encoding to the list of detected ones:
You could use something like this to convert to Unicode:
As a naive toggle command:
function! s:toggle_unicode(line1, line2) abort
if search('\\u\x\+', 'n')
The edit ++enc=ucs-2le [filename] only applies to the current file; when multiple are passed on the command-line, that's the last opened one. You could open the other with :diffsplit ++enc=ucs-2le file2, but in this case, it's shorter to augment the 'fileencodings' option:
vim --cmd "set fileencodings^=ucs-2le" -d icacls.txt icacls2.txt
This allows you to ...
Vim is using Unicode (probably UTF-8), but Excel and/or Access are using Windows-1252 (or possibly a related Windows code page such as 1251 or 1253). Decimal 8216 is hexadecimal 2018, thus ‘ is Unicode character U+2018 LEFT SINGLE QUOTATION MARK.
Asc and Chr are old, pre-Unicode functions, which is why they are reporting the Windows-1252 character codes. If ...
The question 20.5 of the Vim FAQ seems to indicate that vim will receive a single character:
20.5. Why does mapping the <C-...> key not work?
The only Ctrl-printable-key chords which Vim can reliably detect (because they
are defined in the ASCII standard) are the following: >
Ctrl-@ 0x00 NUL
Ctrl-A to ...
Try reopening the file and forcing it to load in "utf-8" mode. You can do this with
:e! ++enc=utf-8 %
From :help ++opt
The [++opt] argument can be used to force the value of 'fileformat',
'fileencoding' or 'binary' to a value for one command, and to specify the
behavior for bad characters. The form is: >
No, that is not true. Internally, \n will always match the line termination of a buffer regardless of whether the actual file uses <CR> or <NL> or <CR><NL> as line terminator (e.g. the 'fileformat') option does not matter.
In a replace command however, the \r in the replace part will always produce an actual new line, since the \n ...
Vim internal use of encoding (this settings is must if you like to use utf-8 or you would like to convert encoding from one to another). I strongly recommend to set this setting in _vimrc file (Windows equivalent of Linux .vimrc file). You can open your _vimrc file with command: :e $MYVIMRC
Bellow is actual setting ...
Windows doesn't use UTF-8 natively. It uses UTF-16LE by default. If you do not change the Windows console to UTF-8, it is not going to do what you want with the text.
Part of the problem may be that you aren't using Windows console, at least not directly: your screenshot shows you're using a third-party tool called Cmder, which may be part of the problem. ...
I feel like an idiot. The test file doesn't have any non-ASCII characters in it, so there is nothing for file to look for that would tell it the encoding Vim is using. So I repeated the test with ä in it and it returns "utf-8" as desired.
In short, file was doing its best, and Vim was doing what I wanted it to do.
It would be set encoding=utf-8, no quotes. set encoding="utf-8" would be an error because "utf-8" would be considered a comment, thus it would be the same as set encoding=.
Vim does not actually default 'encoding' to UTF-8. It defaults to latin1, but will change based on the locale of your environment.
However, since changing 'encoding' at runtime is ...
There's nothing built-in, but the following mapping seems to do the trick.
" g9 Print the hex values of the bytes used in the
" character under the cursor / selected text, using the
" actual 'fileencoding' of the buffer.
function! s:ShowHexFileEncodingCharacter( isSelection )
let l:text = (a:isSelection ...
^Z is a control character more or less synonymous with EOF (end of file). Maybe they were mandatory for the compiler used by the author?
If you have that line in every file in the project:
<C-v><C-z> is Ctrl+V followed by Ctrl+Z, it should insert ^Z and make the command look like:
Those characters are actually color encoding. Don't you think it odd that when you type more you get color instead of black-and-white characters?
You must have grep set as an alias to grep --color=always. You're probably going to want to make a separate grep alias for viewing results in the console versus extracting text from files.
Basically, vim is being ...
I think you might be misunderstanding how the 'fileformats' (plural) setting is used. This setting is a global list of file formats that Vim tries when opening any file in order to see which matches the format of the file. When it has detected the format, Vim sets the per-file 'fileformat' (singular) option for that individual file.
If you are setting '...
Looks like there is no easy way to change font/encoding for menu rendering. Maybe it's somewhere in the code files, and you need to change and compile it in order to be able to decode menu in another encoding.
I have the same issue (in Russian localization), I think it appears after adding in vimrc this:
Per this Stackoverflow:4586628 Q/A, How do you pipe a vim buffer through lpr?, I have this entry in my ~/.vimrc:
nmap PpP :%w !lpr -o lpi=8 -o cpi=14<CR><CR>
that replaces my old entry,
nmap PpP :ha<CR>
(:ha = :hardcopy).
Using :ha, Neovim was not printing Greek letters, ... even though my (Arch Linux) locale was
The biggest problem with your example is [noeol]. Note that the bytes 00 DF do not really make a file that a text editor expects; if you add a newline to the end (00 DF 0A), you definitely won't get the [noeol] error, and I suspect that the file will now correctly open as latin1 (it does in my tests), and you'll see something like <00>ý or ^@ý. I'm not ...
As hinted at in the help files (:help scriptencoding), if you do not use scriptencoding, vim does no conversion, effectively assuming the script is in the encoding of the 'encoding' option. This is very often utf-8, occasionally latin1. Other encodings are possible. Generally you want to use
when your script file contains non-ascii ...
According to :h /\v:
Use of "\v" means that after it, all ASCII characters except '0'-'9', 'a'-'z',
'A'-'Z' and '_' have special meaning: "very magic"
It's ASCII characters, not any characters.
According to :h /\:
\x A backslash followed by a single character, with no special ...
From :help 'encoding':
NOTE: Changing this option will not change the encoding of the existing text in Vim. It may cause non-ASCII text to become invalid. It should normally be kept at its default value, or set when Vim starts up. See multibyte. To reload the menus see :menutrans.
So either set it at the first line, or don't set it at all.
Send the buffer to the browser by converting to HTML, then print from there:
:TOhtml | w | !open -a Safari %
For example I have this in vim:
If I type
I get this:
But when I send it to the browser I get this (with color scheme!):
I have this in my .vimrc, which deletes the new html buffer and stored file:
nnoremap <F2> <ESC> :TOhtml &...
It can depend on your system. Some characters may be right on one system and not work at all on another. Between Macintosh, Windows, and Unix/Linux, there are three different types of carriage returns.
\n may work for you. You could also try them both together: \n\r (I think that's the right way, but you could also try it reversed)
Alternately, you can ...
Actually, the decision was to update gVim to 8.0 version, released just a few weeks ago. Then such settings were useful as well:
set guifont=Consolas:h11:cRUSSIAN "to get proper font for Cyrillic
"to get English menu instead of broken Russian
set langmenu=en_US ...