-1

On saving my .i3 config file, I get the following message at the bottom:
"~/.i3" 234L, 8266C written/bin/bash: redraw: command not found

The file does appear to save. However, I think the vim screen doesn't get redrawn, which is possibly related to the error.

  • Likely wrong PATH. Also the error message looks weird, as if there were somewhere a carriage return in the output. – user1934428 Jan 28 '21 at 08:14
  • how would I check the PATH? –  Jan 28 '21 at 10:50
  • ??? Right before you are calling `redraw` in your script, you simply do put a `echo $PATH` there.... – user1934428 Jan 28 '21 at 11:54
  • I don't have a script that calls a "redraw". I don't even have the word 'redraw' anywhere in the i3 config file. –  Jan 28 '21 at 13:16
  • So, where do you call it? You aren't by chance invoking some external tool from within vim? Did you check your vim macros? – user1934428 Jan 28 '21 at 13:42
  • this error message is only being displayed when editing the .i3 config file, not when editing any other file in vim –  Jan 28 '21 at 13:55
  • That's why I suspect that vim macros, which implicitly shell out to something, are executed. A macro could query the filename and do something particular for it. Did you check your `.vimrc`? – user1934428 Jan 28 '21 at 13:57
  • If the behaviour is vim-specific (did you try other editors, such as nvim or a completely different one, such as emacs or nano?), I suggest that you post your question on [superuser](https://superuser.com/), and emphasize in your question, that the error does not occur when you save a different file. – user1934428 Jan 28 '21 at 14:02
  • yes, you were right. in my vimrc I have the following line: `autocmd BufWritePost ~/.i3 silent !i3-msg reload | redraw`. I think it's supposed to reload the i3 session whenever I save the config file. –  Jan 28 '21 at 14:04
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/227962/discussion-between-zmunk-and-user1934428). –  Jan 28 '21 at 14:07

1 Answers1

1

The problem was that I had the following line in my .vimrc file which is supposed to reload the i3 session whenever the .i3 config file is saved.

autocmd BufWritePost ~/.i3 silent !i3-msg reload | redraw

When I change that line as follows, it seems to work now.

autocmd BufWritePost ~/.i3 execute '!i3-msg reload' | redraw!

I also had to add a line autocmd! at the top of my .vimrc to clear all previous autocmds.

The explanation for exclamation point at the end of the redraw command (from the vim docs):

:redr[aw][!]      Redraw the screen right now. When ! is included it is cleared first.