Questions tagged [echo]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
63 views

Why doesn't echo % do anything in command mode?

I read the section of current-file in the document. (see :h current-file) And I have a question. if % stands for the current file name, why I can not use echo %?
mohamadi_arch's user avatar
0 votes
1 answer
34 views

Vim doesn't display my echo if it's 2 characters

On Vim 9 linux running this code: inoremap <C-n> <C-o>:echo "aa"<CR> doesn't display anything whereas: inoremap <C-n> <C-o>:echo "aaaa"<CR> ...
Hamster's user avatar
2 votes
1 answer
167 views

Get current vimscript script name and line number?

In C programming language, it's typical to log a message with filename and line number of the source code file the message is coming from: #define log(fmt, ...) printf("%s:%d: " fmt "\...
KamilCuk's user avatar
  • 265
0 votes
1 answer
47 views

Weird behavior when execute and echo are used together

So I was doing some testing on some function I made, let's call it Test_mode, "let g:Test_mode = 0 " commented to show that it works without defining it first function! Test_mode() if g:...
Nordine Lotfi's user avatar
0 votes
1 answer
732 views

How to echo string to a file using vimscript?

I want to use the echo command from vim (not the shell ones or the external command) for outputting some strings to external files. I know I could use redir but I'm just wondering if there isn't a ...
Nordine Lotfi's user avatar
0 votes
1 answer
335 views

synIDattr returns nothing in function

I have this part of code: function! Test() echom synIDattr(synID(line('.'), col('.'), 1), 'name') endfunction autocmd TextChangedI <buffer> call Test() I expected that every time I change ...
TornaxO7's user avatar
  • 561
2 votes
0 answers
58 views

Is there some way to retrieve/redisplay :echon output?

I want to create a multi-color enabled debug-print command. As far I know, the only way to print multi-color messages in Vim is: echohl Macro | echon "Hi" | echohl Statement | \ echon &...
Mooncer's user avatar
  • 173
6 votes
1 answer
741 views

How to change the command line status message color and font?

I would like to change the color of part of the command line, the stuff that's echo'd from vim scripts. I know it can be different since when your search hits the bottom it prints a message in red ...
Thomas N's user avatar
2 votes
0 answers
194 views

echom a multline message, and force pause

I got some code that jobstart() a ripgrep, but if there is an error I wish to show it. At the on_exit callback a summary message is echom'ed after whether it was successfull or not. Unfortunately I ...
run_the_race's user avatar
3 votes
1 answer
928 views

vim display message on execution of mapping

I have mapped a key shortcut to copy all lines to system clipboard, which is working fine nnoremap <localleader>o :silent %w !pbcopy<cr> I would like to display the message as 'Copied' ...
mtk's user avatar
  • 233
1 vote
0 answers
116 views

How to avoid dialog box when using echo in vimrc/gvimrc file?

If there is a echo/echom sentence in the vimrc or gvimrc file, a dialog box is popped out when gvim starts. How to avoid this?
Grinny Green's user avatar
2 votes
2 answers
2k views

How can I log debug messages without blocking?

When debugging my vimrc, I often want to log informational messages, e.g. things like "skipping function X because a necessary plugin isn't available". I can use echom statements to do that, but they ...
Andrew's user avatar
  • 373
2 votes
1 answer
1k views

How to create Preview window to display a string?

I'm using a LSP plugin to call a command from the server, and currently it is logging the data using echom. My current code is like this: function! PtypeCallback(result) echom json_encode(a:...
Sri Harsha Chilakapati's user avatar
0 votes
0 answers
50 views

How to show "/foobar match 1 of " or "E486: Pattern not found: foobar" in commandline when calling `normal! n` in function [duplicate]

I'm calling normal! n in a vimscript function. If there is a match, I don't get the message /foobar match 1 of 3 in the commandline. If there is no match, my commandline shortly flickers up and down ...
Bananach's user avatar
  • 494
4 votes
3 answers
4k views

How to have the echo command process newline characters?

I find that when running :echo message with a message variable that contains newlines, it displays the newline character as ^@. Often I'd prefer it to actually be split on a new line though. Do I ...
Steve Vermeulen's user avatar
1 vote
0 answers
55 views

return value of execute(command) when command has "silent!"

In my understanding, the return value of execute(command) should be what command outputs. (The second parameter of execute is to affect whether this output will also be displayed in vim.) Now command ...
doraemon's user avatar
  • 1,667
3 votes
1 answer
740 views

Can't echo messages from inside async functions

CASE 1: Have your autocmd command be setup like this: autocmd User ALELintPost call SayHello() " ALELintPost is async And your SayHello function set up like this function! SayHello() abort ...
resolritter's user avatar
1 vote
1 answer
2k views

How to print an option's value to standard output?

I'd like to know if a file uses LF or CRLF line endings. I'm on Windows with vim installed. I don't want to convert the files, just know which line endings they use. I know I can get the file format (...
liberforce's user avatar
1 vote
0 answers
208 views

Why are [$p] characters appearing at the beginning of every file? [duplicate]

Every file I open in vim lately, even new empty files, as a ($p) at the beginning. This does not appear to be real - inserting text overwrites it, and once it's overwritten it does not return. I ...
GlyphGryph's user avatar
0 votes
1 answer
698 views

How to echo a command but avoid the "hit enter" prompt

I have found how to silently execute a command with :silent, but I actually would like to echo the command being executed, without getting into this "hit-enter" prompt. How to do it? My example is a ...
PlasmaBinturong's user avatar
1 vote
3 answers
1k views

Execute() is not returning a value

I am apparently not getting a return value from execute(): function! Example() return 5 endfunction :echo execute("call Example()") Just results in a blank line. The 5 is not printed. Why is ...
Tyler Durden's user avatar
  • 2,083
0 votes
3 answers
1k views

How can I echo the result of function with a range?

If I have a function that takes a range, how can I echo the return value of the function? For example, the following does not work: :echo 2,8call MyFunction()
Tyler Durden's user avatar
  • 2,083
0 votes
1 answer
439 views

Error occurs while echoing system('echo %PATH%')

I'm currently using gvim 8.0 on Windows 10. When I try to do the following command, :echo system('echo %PATH%') I get the following error. E484: Can't open file C:/Users/BITS_A~1/AppData/Local/Temp/...
bits_and_scraps's user avatar
6 votes
1 answer
3k views

Echo highlighted warning in one line

I found from the vim's manual that we can echo colored text by the following command: :echohl WarningMsg | echo "Warnging" | echohl None | echo ":Some warning" which will highlight the string ...
van abel's user avatar
  • 199
1 vote
2 answers
470 views

How can I echo non-printable characters like spaces?

If I have non-printable characters assigned to a variable, how can I echo them? For example, if I have a variable xyz set to be two spaces and a tab, then if I do this: :echo xyz it just shows a ...
Tyler Durden's user avatar
  • 2,083
3 votes
1 answer
127 views

Wrapping echo for use in VimL

I'm attempting to add some debugging functionality to a small vim plugin that I am working on. I'd like to wrap echo / echom in a way that allows me to turn off output if I want. I've attempted to do ...
Nick Tomlin's user avatar
11 votes
1 answer
4k views

Echo message on startup without prompting

I'd like to echo a custom message upon startup, based on whether or not certain startup functions were successful. I tried this in my .vimrc echo 'test' "All my settings ... I'd like vim to echo a ...
DJMcMayhem's user avatar
  • 17.4k
2 votes
3 answers
1k views

No echo command?

I tried doing the following command on a new install of Ubuntu and got a "Sorry, command not supported on this version message": :echo @% How could any version of vim not support echo? The reported ...
Tyler Durden's user avatar
  • 2,083