13

I want to make a table in vim.

Making a horizontal line is easy

______________________________ 

For the vertical I use this

yes "|" | head -10

But the result is bad

|
|
|
|
|
|
|
|
|

I want something contiguous like the horizontal line. How can I do this?

27

If your version of Vim is compiled with multibyte support and your terminal encoding is set correctly, you may use the Unicode box-drawing characters, which include horizontal and vertical lines as well as several varieties of intersections and blocks. Vim defines some default digraphs for these characters, such as vv for (to enter a digraph, you use Ctrl-K; thus in insert mode ^Kvv will insert the character at the cursor location). For the full list if your version of Vim supports it, type :digraphs; for more information on the feature and to search by Unicode character name, type :help digraphs.

Depending on your terminal settings and choice of font, however, box-drawing characters may not all render as connected lines, so your mileage may vary. For instance, on my machine vertical lines render as connected in the terminal (using Source Code Pro), but as broken lines in GVim (using DejaVu Sans Mono):

Box-drawing characters rendering as solid lines in the terminal Box-drawing characters rendered as broken lines in GVim

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.