colorscheme.lua (1115B)
1 vim.opt.background = 'dark' 2 if vim.fn.has('termguicolors') == 1 then 3 vim.opt.cursorline = true -- Highlight cursor line, max column. 4 vim.opt.termguicolors = true -- Enable 24-bit colour. 5 6 vim.api.nvim_create_autocmd({'WinLeave'}, { 7 pattern = '*', 8 command = 'setlocal nocursorline' 9 }) 10 vim.api.nvim_create_autocmd({'WinEnter'}, { 11 pattern = '*', 12 command = 'setlocal cursorline' 13 }) 14 vim.api.nvim_create_autocmd({'BufLeave'}, { 15 pattern = '*', 16 command = 'setlocal nocursorline' 17 }) 18 vim.api.nvim_create_autocmd({'BufEnter'}, { 19 pattern = '*', 20 command = 'setlocal cursorline' 21 }) 22 23 -- Highlight over-length lines. 24 vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { 25 pattern = '*', 26 command = 'set colorcolumn=80' 27 }) 28 vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { 29 pattern = {'*.txt', '*.md'}, 30 command = 'set colorcolumn=80 | set textwidth=80' 31 }) 32 vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { 33 pattern = {'*.java', '*.m', '*.mm'}, 34 command = 'set colorcolumn=100 | set textwidth=100' 35 }) 36 end 37