3

I'm very new to Vim and I have some ASCII art in my _vimrc.

I've inserted it there using normal i, but it doesn't display properly, because the normal i commands don't have a line break at the end. I've tried <esc>, but it doesn't work.

Does anybody know how I can break the ASCII art into multiple lines?

Here's my _vimrc:

" Packages
packadd! nord

" Visual settings
syntax on
colorscheme nord
language en_gb
set guifont=consolas:h11

" Functionality settings
set tabstop=4
set laststatus=2
set nu!
set guicursor=i:block-cursor
set guioptions-=T
set guioptions-=m
set guioptions-=r
set guioptions-=L

" ASCII art
normal i  __     __  __
normal i /  |   /  |/  |
normal i $$ |   $$ |$$/  _____  ____
normal i $$ |   $$ |/  |/     \/    \
normal i $$  \ /$$/ $$ |$$$$$$ $$$$  |
normal i  $$  /$$/  $$ |$$ | $$ | $$ |
normal i   $$ $$/   $$ |$$ | $$ | $$ |
normal i    $$$/    $$ |$$ | $$ | $$ |
normal i     $/     $$/ $$/  $$/  $$/

By the way I'm on Windows and I'm using GUI Vim 8.2.

Edit 1: I know, that there might be a better way to do this, but I'd like to stick to my way for now.

MY SOLUTION:

Edit 2: I solved it by adding normal o between every line of the ASCII art like this:

normal i $$ |   $$ |$$/  _____  ____
normal o
normal i $$ |   $$ |/  |/     \/    \
normal o
normal i $$  \ /$$/ $$ |$$$$$$ $$$$  |

It's not the best solution, but it does the job for me.

Edit 3: I might've deleted the edit summary inserted by someone else and I'm sorry. I tried putting it back, but it always disappears.

3

You need to add a literal newline (displayed as ^M). You can type this character into your _vimrc by holding down Ctrl and typing v followed by m, and then releasing Ctrl. So for each line you would have:

normal i  __     __  __^M
normal i /  |   /  |/  |^M
" etc...

where ^M is not the characters "^M" literally, but the result of typing Ctrl+vm (holding Ctrl until after typing m).

7
  • Cool! It works! But is there any other way of doing this, that isn't Vim-specific?
    – user31298
    Sep 5 '20 at 19:14
  • 1
    Nevermind, I got. I just had to insert normal o in between every normal i line.
    – user31298
    Sep 5 '20 at 19:48
  • @bld you should checkout :h append() and :h line(). Then you could do it in actual VimL instead of emulating keypresses. Sep 5 '20 at 19:50
  • Might be better to :put =join(my_list_of_lines, '\n')
    – D. Ben Knoble
    Sep 6 '20 at 0:30
  • 1
    Thanks for the help, but I've already achieved what I've wanted. @filbranden I will post it. (-:
    – user31298
    Sep 6 '20 at 6:54

Your Answer

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