Nvim breaks the color of white space.
I did it with vim.opt.termguicolors = true
in nvim init.lua.
But the colors don't look right in my old oh-my-zsh.
The weird thing is that if I run nvim in a shell with tmux, it works fine. I don't know why. Is there a solution?
Below is my lua file. After that is an example of what happens when I try to use my old zsh shell. Last is the result of running the shell through tmux and then running nvim.
Here is my setting lua file:
local o = vim.o
vim.opt.cursorline = true --show current cursor line
if vim.opt.termguicolors then
vim.opt.termguicolors = true --use true color -> true color is wide color of standard 257 color in vim
else
vim.opt.termguicolors = false
end
vim.opt.winblend = 0 -- option controls the transparency of floating windows.(like lsp command gp window)
-- when you're typing file names or directory paths in Vim's command-line.
-- p - Show the preview window when multiple matches are found
-- u - Auto-insert characters that can complete the match
-- m - Show matches in a pop-up menu
vim.opt.wildoptions = 'pum'
-- set transparency popup
vim.opt.pumblend = 5
vim.opt.background = 'dark'
-- blew is base.lua
vim.cmd('autocmd!') -- remove auto cmd (after clear and start setting)
vim.scriptencoding = 'utf-8'
vim.opt.encoding = 'utf-8' -- user interface encoding
vim.opt.fileencoding = 'utf-8'
vim.wo.number = true -- display line num
vim.opt.title = true -- set title of ternimal window to file name
vim.opt.autoindent = true -- if you enter newline cursor automatically move indent level
vim.opt.hlsearch = true -- search highlighting
vim.opt.backup = false -- not use backup
vim.opt.showcmd = true -- display last cmd after exit command mode
vim.opt.cmdheight = 1 -- display cmd line height
vim.opt.laststatus = 2 -- 2 is alway show bottom status
vim.opt.expandtab = true -- change tab to sevral space
vim.opt.scrolloff = 10 -- keep screen number below and above
vim.opt.backupskip = '/tmp/*,/private/tmp/*' -- skip backup when file locate "/tmp/*" and "/private/tmp/*"
vim.opt.icm = 'split' -- method to enter Non ASCII character
vim.opt.ignorecase = true -- when search for text
vim.opt.smarttab = true -- when press tab-key , based on the existing indentation of the current line.
vim.opt.breakindent = true -- whether vim adds extra indentation to wrapped lines of text.
vim.opt.shiftwidth = 2 -- '>>' '<<' press set line
vim.opt.tabstop = 2 -- control tab the number of space
vim.opt.ai = true -- Auto indent when press 'enter'
vim.opt.si = true -- Smart indent based space lever like '{}'
vim.opt.wrap = true -- if text line is very long to fit within current monitor width, fit or not
vim.opt.mouse = '' -- set no use mouse in vim
vim.opt.backspace =
'start,eol,indent' --if press 'backspace' when position beginning-line, move to end of previous line ,cuntinue delete
vim.opt.path:append { '**' } -- Finding files - Search down into subfolders
vim.opt.wildignore:append { '*/node_modules/*' } -- ignore subfolders 'node_modules'
-- Turn off paste mode when leaving insert
-- nopaste is set pastemode off -> This will disable certain features like autoindenting and mappings, which can prevent unintended side effects while pasting.
vim.cmd([[let &t_Cs = "\e[4:3m" ]])
vim.cmd([[let &t_Ce = "\e[4:0m"]])
vim.api.nvim_create_autocmd("InsertLeave", {
pattern = '*',
command = "set nopaste"
})
-- Add asterisks in block comments
-- create insert a closing bracket or quote
vim.opt.formatoptions:append { 'r' }
termguicolors
if-and-only-if the underlying terminal emulator supports truecolorvim.opt.background
& then commenting out thepaste-mode
stuff. BTW , it is not white-space here. It is just the Part outside the "Editable Area" , you should Insert new-lines , spaces & tabs in the "Editable Area" to check what you get.curl -s https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh | bash
When I run the above syntax in TMUX, the colors come out fine. However, when I run it in the default terminal (not tmux), the colors don't come out well. What should I check?