Vim pauses if echo in .vimrc file
:silent !echo Hello
will do the trick.
~~~
From the OP, this worked:
let colorScheme = "evening"
silent execute "!echo setting color scheme to " . colorScheme
how to have an echo statement run after vimrc has loaded?
Add this to your vimrc:
" when Vim starts with no file
if argc() == 0
autocmd VimEnter * echo "Nr. of Colors: " . &t_Co
end
how to have an echo statement run after vimrc has loaded?
Add this to your vimrc:
" when Vim starts with no file
if argc() == 0
autocmd VimEnter * echo "Nr. of Colors: " . &t_Co
end
Using custom vimrc on mac causes syntax highlighting to be lost
If you have no vimrc
, vim loads a defaults.vim
file, but once you add a custom vimrc
, vim stops loading that file. This was introduced in Vim 8.0, and you can get more info by typing :h defaults.vim
within vim, but here are your options to fix the issue:
SOLUTION 1:
Source the defaults.vim
file into your .vimrc
(this is the method mentioned in the vim help files - see :help defaults.vim
). Just add these lines to the top of your .vimrc
:
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
SOLUTION 2:
Copy the stuff you like from defaults.vim
into your own config.
This involves a few steps:
- Figure out what $VIMRUNTIME is set to by typing
:echo $VIMRUNTIME
inside of vim and hitting enter. - Navigate to the directory it returns (for me this was
/usr/local/share/vim/vim80/
) and find thedefaults.vim
file. - Copy and paste any of the settings that you want into your own
.vimrc
.
Hope this helps!
Vim freezes after pressing CTRL-U in insert mode. Any suggestions?
I've copied your vimrc and used it. Same effect. It's this line:
imap <C-U> <C-G>u<C-U>
which apparently causes a recursion. When commented out, <C-u>
erases back to start-of-line.
Execute a line in vimrc at the end
Your hypothesis that plugins are overriding your settings is probably right. Putting your code at the end of vimrc
would also not help as vimrc
is loaded before plugins.
One way to get around this is to use after directory.
Create a file ~/.vim/after/ftplugin/text.vim
Add your code to this file.
Vim will load this script after it loads plugins.
Is there a vim runtime log?
running vim with the -V[N] option will do a pretty hefty runtime log, here N is the debug level.
vim -V9myVim.log
would create a log of debug level 9 in the current directory with the filename myVim.log
Vim Leader Shortcut Stops Executing After CR
If you need the <F8>
map in the <leader>y
map you need to use a recursive map. Change nnoremap
(which means non-recursive map) to nmap
:
nmap <leader>y :tabnew ~/.vim-clipboard<CR><F8>
Recursive maps are documented in :help recursive_mapping
Vim not recognizing aliases when in interactive mode?
I got this to work, via the man page for bash
:
set shell=/bin/bash\ --rcfile\ ~/.bash_profile
Similarly, --init-file
works.
Note that \ -i
is not necessary, though it can be added to the command:
set shell=/bin/bash\ --rcfile\ ~/.bash_profile\ -i
Example:
~/.bash_profile
contains
source ~/.bash_aliases
~/.bash_aliases
contains
alias rdc="open -a \"Remote Desktop Connection\""
~/.vimrc
contains
set shell=/bin/bash\ --rcfile\ ~/.bash_profile
map ,r :!rdc &<cr>
Related Topics
Bash Script Commands Not Working in Cron
Unanticipated Segmentation Fault in C
Kernel Preemption While Holding Spinlock
Can't Hard Link The Gitconfig File
Bash, Execute Command But Continue with Interactive Session
Git Says Everything Up-To-Date
Getting The New Squeak 5 to Run on 64 Bit Linux
Version 'Glibc_2.32' Not Found Error When Running Petalinux-Build
Perl Signal Processing Only Works Once When Sighandler Calls Subroutine
How to Get The Union of Two Arrays in Bash
How to Enable Vt-X/Amd-V in Aspire V5-122P Bios