neovim + system

neovim:
    - highlight:
        + adjust treesitter groups for nord (TSField as fg doesn't look
          good in yaml files). Also add highlight for TSNote, TSWarning,
          TSDanger (notes such as 'TODO', 'FIXME', ...)
        + rewrite the way theme is set (now 'g:colors_name' is used
          properly instead of a hacky variable 'g:global_theme'). Also
          make setting theme more modular
        + add 'highlight_languages' groups for other syntaxes (html,
          markdown) that are not covered with treesitter
    - mappings: properly move ':Telescope lsp_range_code_action' to
      visual block + avoid mappings for <C-x> and <C-a> (number
      decrement/increment)
    - null-ls.nvim: add basic config, load before nvim-lspconfig
    - plugins: add nvim-treesitter/playground
    - feline.nvim: lazy loaded on VimEnter
    - nvim-lightbulb: only refresh on CursorHold (previously stopped
      working after entering INSERT mode)
system:
    - tlp: update config for v1.4.0
setup: add ani-cli to scripts.sh
This commit is contained in:
Hoang Nguyen 2021-10-16 23:29:17 +07:00
parent d8b8b179f5
commit 0f2574a887
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
20 changed files with 311 additions and 209 deletions

View File

@ -30,7 +30,7 @@
### :star2: Credits ### :star2: Credits
- [@glepnir](https://github.com/glepnir/nvim)'s Neovim config, and also [NvChad](https://github.com/NvChad/NvChad) - [@glepnir](https://github.com/glepnir/nvim)'s Neovim config, also [NvChad](https://github.com/NvChad/NvChad) and [nord.nvim](https://github.com/shaunsingh/nord.nvim)
- [@novakane](https://git.sr.ht/~novakane/) for git aliases - [@novakane](https://git.sr.ht/~novakane/) for git aliases
- [@hlissner](https://github.com/hlissner)'s zsh config - [@hlissner](https://github.com/hlissner)'s zsh config
- [@daviwil](https://github.com/daviwil)'s/[@tecosaur](https://tecosaur.github.io/emacs-config/config.html)'s Emacs configurations - [@daviwil](https://github.com/daviwil)'s/[@tecosaur](https://tecosaur.github.io/emacs-config/config.html)'s Emacs configurations

View File

@ -0,0 +1 @@
require('themes').set('nord')

View File

@ -0,0 +1 @@
require('themes').set('onedark')

View File

@ -10,5 +10,4 @@ local options = require('options')
options.disable_default_plugins() options.disable_default_plugins()
options.load_options() options.load_options()
require('colors.' .. vim.g.global_theme).highlight()
async:send() async:send()

View File

@ -47,11 +47,11 @@ wk.register({
-- Close a window -- Close a window
['<C-q>'] = {'<C-w>q', 'Quit current window'}, ['<C-q>'] = {'<C-w>q', 'Quit current window'},
-- Copy the whole buffer -- Close current buffer
['<C-a>'] = {':%y+<CR>', 'Copy whole buffer'}, ['<A-q>'] = {':bdelete<CR>', 'Close current buffer'},
-- Close buffer -- Copy the whole buffer
['<C-x>'] = {':bdelete<CR>', 'Close current buffer'}, ['<A-a>'] = {':%y+<CR>', 'Copy whole buffer'},
-- Remove trailing whitespace -- Remove trailing whitespace
['<A-w>'] = {':%s/\\s\\+$//e<CR>', 'Remove trailing'}, ['<A-w>'] = {':%s/\\s\\+$//e<CR>', 'Remove trailing'},
@ -215,6 +215,7 @@ wk.register({
name = 'Editor', name = 'Editor',
a = {':EasyAlign<CR>', 'Align elements'}, a = {':EasyAlign<CR>', 'Align elements'},
g = 'Generate annotations', g = 'Generate annotations',
h = {':TSHighlightCapturesUnderCursor<CR>', 'Syntax groups under cursor'},
s = {':ISwapWith<CR>', 'Swap elements'}, s = {':ISwapWith<CR>', 'Swap elements'},
t = {':Twilight<CR>', 'Twilight mode'}, t = {':Twilight<CR>', 'Twilight mode'},
z = {':ZenMode<CR>', 'Zen mode'} z = {':ZenMode<CR>', 'Zen mode'}
@ -294,7 +295,6 @@ wk.register({
f = { f = {
name = 'Telescope', name = 'Telescope',
a = {':Telescope lsp_code_actions<CR>', 'Code actions'}, a = {':Telescope lsp_code_actions<CR>', 'Code actions'},
A = {':Telescope lsp_range_code_actions<CR>', 'Range code actions'},
d = {':Telescope lsp_document_diagnostics<CR>', 'Buffer diagnostics'}, d = {':Telescope lsp_document_diagnostics<CR>', 'Buffer diagnostics'},
D = {':Telescope lsp_workspace_diagnostics<CR>', 'Workspace diagnostics'}, D = {':Telescope lsp_workspace_diagnostics<CR>', 'Workspace diagnostics'},
e = {':Telescope lsp_dynamic_workspace_symbols<CR>', 'Dynamic workspace symbols'}, e = {':Telescope lsp_dynamic_workspace_symbols<CR>', 'Dynamic workspace symbols'},
@ -390,6 +390,15 @@ wk.register({
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'} c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
}, },
l = {
name = 'LSP',
f = {
name = 'Telescope',
a = {':Telescope lsp_range_code_actions<CR>', 'Range code actions'}
},
o = 'Range format'
},
p = 'Find/Replace' p = 'Find/Replace'
}, {mode = 'v', prefix = '<leader>'}) }, {mode = 'v', prefix = '<leader>'})

View File

@ -107,7 +107,30 @@ function M.treesitter_conf()
} }
} }
}, },
matchup = {enable = true} matchup = {enable = true},
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<cr>',
show_help = '?'
}
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = {'BufWrite', 'CursorHold'}
}
} }
-- tree-sitter based folding -- tree-sitter based folding
@ -254,7 +277,7 @@ end
function M.project_conf() function M.project_conf()
require('project_nvim').setup { require('project_nvim').setup {
manual_mode = false, manual_mode = false,
detection_methods = {'pattern', 'lsp'}, detection_methods = {'lsp', 'pattern'},
patterns = {'.git', '_darcs', '.hg', '.bzr', '.svn', 'Makefile', 'package.json', '*.pro', 'Dockerfile', '>Code'}, patterns = {'.git', '_darcs', '.hg', '.bzr', '.svn', 'Makefile', 'package.json', '*.pro', 'Dockerfile', '>Code'},
show_hidden = true, show_hidden = true,
silent_chdir = true, silent_chdir = true,

View File

@ -29,8 +29,11 @@ function M.lsp_conf()
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then
buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.formatting()<CR>', opts) buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.formatting()<CR>', opts)
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
elseif client.resolved_capabilities.document_range_formatting then elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})<CR>', opts) buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})<CR>', opts)
buf_set_keymap('v', '<leader>lo', ':lua vim.lsp.buf.range_formatting()<CR>', opts)
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})')
end end
-- Attach lsp_signature.nvim -- Attach lsp_signature.nvim
@ -38,7 +41,7 @@ function M.lsp_conf()
bind = true, -- This is mandatory, otherwise border config doesn't work bind = true, -- This is mandatory, otherwise border config doesn't work
floating_window = true, floating_window = true,
fix_pos = true, fix_pos = true,
hint_prefix = '🐬 ', hint_prefix = ' ',
transpancy = 5, transpancy = 5,
handler_opts = {border = 'none'}, handler_opts = {border = 'none'},
zindex = 50, -- set to 200 to make the float window on top of others zindex = 50, -- set to 200 to make the float window on top of others
@ -66,6 +69,12 @@ function M.lsp_conf()
} }
} }
-- Replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define('LspDiagnosticsSignError', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignWarning', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignInformation', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignHint', {text = ''})
--------------------------- ---------------------------
-- Server configurations -- -- Server configurations --
--------------------------- ---------------------------
@ -255,8 +264,6 @@ function M.lsp_conf()
} }
} }
-- TODO: efm-langserver
-- Others -- Others
local servers = { local servers = {
rust_analyzer = {'rust-analyzer'}, rust_analyzer = {'rust-analyzer'},
@ -277,11 +284,31 @@ function M.lsp_conf()
} }
end end
-- Replace the default lsp diagnostic letters with prettier symbols ------------------------
vim.fn.sign_define('LspDiagnosticsSignError', {text = ''}) -- Linters/Formatters --
vim.fn.sign_define('LspDiagnosticsSignWarning', {text = ''}) ------------------------
vim.fn.sign_define('LspDiagnosticsSignInformation', {text = ''}) -- TODO: efm-langserver as another option
vim.fn.sign_define('LspDiagnosticsSignHint', {text = ''}) local null_ls = require('null-ls')
-- Register sources
null_ls.config {
sources = {
-- Formatters
null_ls.builtins.formatting.stylua.with {
condition = function(utils)
return utils.root_has_file('stylua.toml')
end
},
null_ls.builtins.formatting.clang_format.with {
filetypes = {'c', 'cpp'}
}
-- Linters
}
}
lspconf['null-ls'].setup {
on_attach = on_attach
}
end end
function M.sqls_conf() function M.sqls_conf()
@ -292,7 +319,7 @@ end
function M.lightbulb_conf() function M.lightbulb_conf()
vim.api.nvim_command [[ vim.api.nvim_command [[
autocmd CursorHold,CursorHoldI * lua require('nvim-lightbulb').update_lightbulb {sign = {enabled = false}, status_text = {enabled = true, text = ' Code action', text_unavailable = ''}} autocmd CursorHold * lua require('nvim-lightbulb').update_lightbulb({sign = {enabled = false}, status_text = {enabled = true, text = ' Code action', text_unavailable = ''}})
]] ]]
end end
@ -344,9 +371,9 @@ end
-- exclude = {'org'}, -- list of file types to exclude highlighting -- exclude = {'org'}, -- list of file types to exclude highlighting
-- }, -- },
-- colors = { -- colors = {
-- error = {'LspDiagnosticsDefaultError', 'Red'}, -- error = {'LspDiagnosticsDefaultError', 'TSDanger', 'Red'},
-- warning = {'LspDiagnosticsDefaultWarning', 'Yellow'}, -- warning = {'LspDiagnosticsDefaultWarning', 'TSWarning', 'Yellow'},
-- info = {'LspDiagnosticsDefaultInformation', 'Blue'}, -- info = {'LspDiagnosticsDefaultInformation', 'TSNote', 'Blue'},
-- hint = {'LspDiagnosticsDefaultHint', 'Cyan'}, -- hint = {'LspDiagnosticsDefaultHint', 'Cyan'},
-- default = {'Normal', 'White'} -- default = {'Normal', 'White'}
-- }, -- },
@ -375,9 +402,6 @@ function M.outline_conf()
} }
end end
function M.null_ls_conf()
end
function M.dap_conf() function M.dap_conf()
local dap = require('dap') local dap = require('dap')
vim.fn.sign_define('DapBreakpoint', {text='', texthl='Orange'}) vim.fn.sign_define('DapBreakpoint', {text='', texthl='Orange'})

View File

@ -108,7 +108,7 @@ function M.rest_conf()
end end
function M.orgmode_conf() function M.orgmode_conf()
local c = require('colors.' .. vim.g.global_theme).colors local c = require('themes.' .. vim.g.colors_name .. '.colors')
require('orgmode').setup { require('orgmode').setup {
-- General settings -- General settings
@ -247,7 +247,7 @@ function M.neoscroll_conf()
end end
function M.sniprun_conf() function M.sniprun_conf()
local c = require('colors.' .. vim.g.global_theme).colors local c = require('themes.' .. vim.g.colors_name .. '.colors')
require('sniprun').setup { require('sniprun').setup {
display = { display = {
@ -348,7 +348,7 @@ function M.winpicker_conf()
keys = 'alskdjfhgwoeiruty', keys = 'alskdjfhgwoeiruty',
-- Swap windows by holding shift + letter -- Swap windows by holding shift + letter
swap_shift = true, swap_shift = true,
exclude = {qf = true, NvimTree = true, packer = true, alpha = true}, exclude = {NvimTree = true, alpha = true},
-- Flash the cursor line of the newly focused window -- Flash the cursor line of the newly focused window
flash_duration = 300 flash_duration = 300
} }

View File

@ -94,7 +94,7 @@ function M.dashboard_conf()
end end
function M.statusline_conf() function M.statusline_conf()
local colors = require('colors.' .. vim.g.global_theme).colors local colors = require('themes.' .. vim.g.colors_name .. '.colors')
local vi_mode_colors = { local vi_mode_colors = {
NORMAL = colors.green, NORMAL = colors.green,

View File

@ -24,12 +24,12 @@ function M.disable_default_plugins()
end end
function M.load_options() function M.load_options()
-- Global theme -- This is the same as `:colorscheme nord/onedark`
vim.g.global_theme = 'nord' vim.g.colors_name = 'nord'
-- Leader key -- Leader key
vim.g.mapleader = ' ' vim.g.mapleader = ' '
-- Python path -- Python path
vim.g.python_host_prog = '/usr/bin/python' -- vim.g.python_host_prog = '/usr/bin/python'
vim.g.python3_host_prog = '/usr/bin/python3' vim.g.python3_host_prog = '/usr/bin/python3'
-- General settings -- General settings

View File

@ -24,6 +24,7 @@ return packer.startup(function(use)
} }
use { use {
'famiu/feline.nvim', 'famiu/feline.nvim',
event = 'VimEnter',
wants = 'nvim-web-devicons', wants = 'nvim-web-devicons',
config = ui.statusline_conf config = ui.statusline_conf
} }
@ -74,6 +75,9 @@ return packer.startup(function(use)
event = 'BufRead', event = 'BufRead',
config = editor.treesitter_conf config = editor.treesitter_conf
} }
use {'nvim-treesitter/playground', after = 'nvim-treesitter'}
use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
-- use { -- use {
-- 'lewis6991/spellsitter.nvim', -- 'lewis6991/spellsitter.nvim',
-- event = {'BufRead', 'BufNew', 'BufNewFile'}, -- event = {'BufRead', 'BufNew', 'BufNewFile'},
@ -90,8 +94,6 @@ return packer.startup(function(use)
-- Putting config into `treesitter_conf` doesn't work for some reason -- Putting config into `treesitter_conf` doesn't work for some reason
config = editor.rainbow_conf config = editor.rainbow_conf
} }
use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
use { use {
'mizlan/iswap.nvim', 'mizlan/iswap.nvim',
cmd = {'ISwapWith', 'ISwap'}, cmd = {'ISwapWith', 'ISwap'},
@ -175,8 +177,14 @@ return packer.startup(function(use)
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
event = 'BufReadPre', event = 'BufReadPre',
wants = 'lsp_signature.nvim', wants = {'lsp_signature.nvim', 'null-ls.nvim'},
requires = {{'ray-x/lsp_signature.nvim', opt = true}}, requires = {
{'ray-x/lsp_signature.nvim', opt = true},
{ -- TODO: scripts to install linters/formatters, config
'jose-elias-alvarez/null-ls.nvim',
wants = 'plenary.nvim', opt = true
}
},
config = lsp.lsp_conf config = lsp.lsp_conf
} }
use { use {
@ -206,12 +214,6 @@ return packer.startup(function(use)
cmd = {'SymbolsOutline', 'SymbolsOutlineOpen'}, cmd = {'SymbolsOutline', 'SymbolsOutlineOpen'},
setup = lsp.outline_conf setup = lsp.outline_conf
} }
use { -- TODO: config, scripts to install formaters, linters
'jose-elias-alvarez/null-ls.nvim',
wants = 'plenary.nvim',
after = 'nvim-lspconfig',
config = lsp.null_ls_conf
}
use { -- TODO: config, scripts to install/update dap servers use { -- TODO: config, scripts to install/update dap servers
'rcarriga/nvim-dap-ui', 'rcarriga/nvim-dap-ui',
keys = '<leader>d', keys = '<leader>d',

View File

@ -0,0 +1,29 @@
local M = {}
function M.set(theme)
-- Reset everything
vim.api.nvim_command('hi clear')
if vim.fn.exists('syntax_on') then vim.api.nvim_command('syntax reset') end
vim.opt.background = 'dark'
-- Get theme specs
local t = require('themes.' .. theme)
vim.g.colors_name = theme
-- Load highlight groups
local async
async = vim.loop.new_async(vim.schedule_wrap(function()
t.set_vim_termcolors()
t.highlight_plugins()
t.highlight_languages()
t.highlight_treesitter()
t.highlight_lsp()
async:close()
end))
t.highlight_editor()
t.highlight_syntax()
async:send() -- Load the rest later
end
return M

View File

@ -0,0 +1,22 @@
local nord = {
black = '#2E3440',
grey1 = '#3B4252',
grey2 = '#434C5E',
grey3 = '#4C566A',
grey_bright = '#616E88',
fg = '#D8DEE9',
white1 = '#E5E9F0',
white2 = '#ECEFF4',
teal = '#8FBCBB',
cyan = '#88C0D0',
blue = '#81A1C1',
dark_blue = '#5E81AC',
red = '#BF616A',
orange = '#D08770',
yellow = '#EBCB8B',
green = '#A3BE8C',
purple = '#B48EAD',
highlight = '#7B88A1'
}
return nord

View File

@ -1,40 +1,11 @@
local cmd = vim.api.nvim_command
local M = {} local M = {}
M.colors = { local c = require('themes.nord.colors')
black = '#2E3440', local hi = require('themes.util').highlight
grey1 = '#3B4252',
grey2 = '#434C5E',
grey3 = '#4C566A',
grey_bright = '#616E88',
fg = '#D8DEE9',
white1 = '#E5E9F0',
white2 = '#ECEFF4',
teal = '#8FBCBB',
cyan = '#88C0D0',
blue = '#81A1C1',
dark_blue = '#5E81AC',
red = '#BF616A',
orange = '#D08770',
yellow = '#EBCB8B',
green = '#A3BE8C',
purple = '#B48EAD',
highlight = '#7B88A1'
}
local c = M.colors
local function hi(group, guifg, guibg, attr, guisp)
local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
vim.api.nvim_command(hl)
end
-- Set terminal colors -- Set terminal colors
local function set_vim_termcolors() function M.set_vim_termcolors()
vim.g.terminal_color_0 = c.grey1 vim.g.terminal_color_0 = c.grey1
vim.g.terminal_color_1 = c.red vim.g.terminal_color_1 = c.red
vim.g.terminal_color_2 = c.green vim.g.terminal_color_2 = c.green
@ -54,7 +25,7 @@ local function set_vim_termcolors()
end end
-- Editor related groups -- Editor related groups
local function highlight_editors() function M.highlight_editor()
-- Color groups for other uses -- Color groups for other uses
hi('Red', c.red, '', '', '') hi('Red', c.red, '', '', '')
hi('Green', c.green, '', '', '') hi('Green', c.green, '', '', '')
@ -110,7 +81,7 @@ local function highlight_editors()
-- Prompt -- Prompt
hi('EndOfBuffer', c.grey1, '' , '', '') hi('EndOfBuffer', c.grey1, '' , '', '')
hi('ErrorMsg' , c.fg , c.red , '', '') hi('ErrorMsg' , c.fg , c.red , '', '')
hi('ModeMsg' , c.green, '' , '', '') hi('ModeMsg' , c.fg , '' , '', '')
hi('MoreMsg' , c.cyan , '' , '', '') hi('MoreMsg' , c.cyan , '' , '', '')
hi('Question' , c.fg , '' , '', '') hi('Question' , c.fg , '' , '', '')
hi('WarningMsg' , c.black, c.yellow, '', '') hi('WarningMsg' , c.black, c.yellow, '', '')
@ -137,7 +108,7 @@ local function highlight_editors()
end end
-- Syntax groups -- Syntax groups
local function highlight_syntax() function M.highlight_syntax()
-- Base syntax -- Base syntax
hi('Boolean', c.blue, '', '', '') hi('Boolean', c.blue, '', '', '')
hi('Character', c.fg, '', '', '') hi('Character', c.fg, '', '', '')
@ -153,7 +124,7 @@ local function highlight_syntax()
hi('Function', c.cyan, '', '', '') hi('Function', c.cyan, '', '', '')
hi('Identifier', c.fg, '', '', '') hi('Identifier', c.fg, '', '', '')
hi('Include', c.blue, '', '', '') hi('Include', c.blue, '', '', '')
hi('Keyword', c.blue, '', '', '') hi('Keyword', c.blue, '', 'bold', '')
hi('Label', c.blue, '', '', '') hi('Label', c.blue, '', '', '')
hi('Number', c.purple, '', '', '') hi('Number', c.purple, '', '', '')
hi('Operator', c.blue, '', '', '') hi('Operator', c.blue, '', '', '')
@ -170,14 +141,10 @@ local function highlight_syntax()
hi('Todo', c.yellow, '', '', '') hi('Todo', c.yellow, '', '', '')
hi('Type', c.blue, '', '', '') hi('Type', c.blue, '', '', '')
hi('Typedef', c.blue, '', '', '') hi('Typedef', c.blue, '', '', '')
vim.api.nvim_command('hi! link Annotation Decorator') cmd('hi! link Annotation Decorator')
vim.api.nvim_command('hi! link Macro Define') cmd('hi! link Macro Define')
vim.api.nvim_command('hi! link PreCondit PreProc') cmd('hi! link PreCondit PreProc')
vim.api.nvim_command('hi! link Variable Identifier') cmd('hi! link Variable Identifier')
-- sql
vim.api.nvim_command('hi! link sqlKeyword Keyword')
vim.api.nvim_command('hi! link sqlSpecial Keyword')
-- Diff -- Diff
hi('DiffAdd' , c.green , c.grey1, '', '') hi('DiffAdd' , c.green , c.grey1, '', '')
@ -190,66 +157,107 @@ local function highlight_syntax()
hi('diffFile', c.cyan, c.grey1, '', '') hi('diffFile', c.cyan, c.grey1, '', '')
hi('diffLine', c.purple, c.grey1, '', '') hi('diffLine', c.purple, c.grey1, '', '')
hi('diffIndexLine', c.fg, c.grey1, '', '') hi('diffIndexLine', c.fg, c.grey1, '', '')
vim.api.nvim_command('hi! link diffAdded DiffAdd') cmd('hi! link diffAdded DiffAdd')
vim.api.nvim_command('hi! link diffRemoved DiffDelete') cmd('hi! link diffRemoved DiffDelete')
vim.api.nvim_command('hi! link diffChanged DiffChange') cmd('hi! link diffChanged DiffChange')
end end
-- Treesitter -- Things that still don't look right with nvim-treesitter
local function highlight_treesitter() function M.highlight_languages()
hi('TSPunctDelimiter', c.fg, '', '', '') -- sql
hi('TSPunctBracket', c.fg, '', '', '') cmd('hi! link sqlKeyword Keyword')
hi('TSPunctSpecial', c.fg, '', '', '') cmd('hi! link sqlSpecial Keyword')
hi('TSConstant', c.yellow, '', '', '')
hi('TSConstBuiltin', c.blue, '', '', '') -- markdown
hi('TSConstMacro', c.yellow, '', '', '') hi('markdownCode', c.fg, '', 'italic', '')
hi('TSStringRegex', c.green, '', '', '') hi('markdownCodeBlock', c.fg, '', 'italic', '')
hi('TSString', c.green, '', '', '') hi('markdownH1', c.purple, '', 'bold', '')
hi('TSStringEscape', c.green, '', '', '') cmd('hi! link markdownH1Delimiter markdownH1')
hi('markdownH2', c.dark_blue, '', 'bold', '')
cmd('hi! link markdownH2Delimiter markdownH2')
hi('markdownH3', c.blue, '', 'bold', '')
cmd('hi! link markdownH3Delimiter markdownH3')
hi('markdownH4', c.cyan, '', 'bold', '')
cmd('hi! link markdownH4Delimiter markdownH4')
hi('markdownH5', c.teal, '', 'bold', '')
cmd('hi! link markdownH5Delimiter markdownH5')
hi('markdownH6', c.green, '', 'bold', '')
cmd('hi! link markdownH6Delimiter markdownH6')
-- html
hi('htmlLink', c.green, '', 'underline', '')
cmd('hi! link htmlH1 markdownH1')
cmd('hi! link htmlH2 markdownH2')
cmd('hi! link htmlH3 markdownH3')
cmd('hi! link htmlH4 markdownH4')
cmd('hi! link htmlH5 markdownH5')
cmd('hi! link htmlH6 markdownH6')
end
-- Treesitter (:h nvim-treesitter-highlights)
function M.highlight_treesitter()
cmd('hi! link TSAnnotation Annotation')
hi('TSCharacter', c.green, '', '', '') hi('TSCharacter', c.green, '', '', '')
hi('TSNumber', c.purple, '', '', '') hi('TSConstructor', c.blue, '', '', '')
hi('TSBoolean', c.purple, '', '', '') hi('TSConstant', c.yellow, '', '', '')
hi('TSFloat', c.purple, '', '', '') hi('TSFloat', c.purple, '', '', '')
hi('TSAttribute', c.teal, '', '', '') hi('TSNumber', c.purple, '', '', '')
hi('TSNamespace', c.fg, '', '', '') hi('TSString', c.green, '', '', '')
hi('TSMethod', c.cyan, '', '', '')
hi('TSField', c.fg, '', '', '') hi('TSAttribute', c.purple, '', '', '')
hi('TSProperty', c.fg, '', '', '') cmd('hi! link TSBoolean Boolean')
hi('TSConditional', c.blue, '', '', '') hi('TSConstBuiltin', c.teal, '', '', '')
hi('TSParameter', c.purple, '', '', '') hi('TSConstMacro', c.teal, '', '', '')
hi('TSParameterReference', c.purple, '', '', '') hi('TSError', c.red, '', '', '')
hi('TSRepeat', c.blue, '', '', '') hi('TSException', c.purple, '', '', '')
hi('TSLabel', c.blue, '', '', '') hi('TSField', c.teal, '', '', '')
hi('TSKeyword', c.blue, '', '', '') hi('TSFuncMacro', c.teal, '', '', '')
hi('TSKeywordFunction', c.blue, '', '', '')
hi('TSKeywordOperator', c.blue, '', '', '')
hi('TSOperator', c.blue, '', '', '')
hi('TSException', c.red, '', '', '')
hi('TSType', c.teal, '', '', '')
hi('TSTypeBuiltin', c.blue, '', '', '')
hi('TSStructure', c.blue, '', '', '')
hi('TSInclude', c.blue, '', '', '') hi('TSInclude', c.blue, '', '', '')
hi('TSVariableBuiltin', c.fg, '', '', '') hi('TSLabel', c.purple, '', '', '')
hi('TSNamespace', c.fg, '', '', '')
hi('TSOperator', c.blue, '', '', '')
hi('TSParameter', c.purple, '', 'italic', '')
hi('TSParameterReference', c.purple, '', 'italic', '')
hi('TSProperty', c.teal, '', '', '')
hi('TSPunctDelimiter', c.fg, '', '', '')
hi('TSPunctBracket', c.cyan, '', '', '')
hi('TSPunctSpecial', c.cyan, '', '', '')
hi('TSStringRegex', c.teal, '', '', '')
hi('TSStringEscape', c.purple, '', '', '')
hi('TSSymbol', c.purple, '', '', '')
hi('TSType', c.blue, '', '', '')
hi('TSTypeBuiltin', c.blue, '', '', '')
hi('TSTag', c.fg, '', '', '')
hi('TSTagDelimiter', c.purple, '', '', '')
hi('TSText', c.fg, '', '', '') hi('TSText', c.fg, '', '', '')
hi('TSStrong', c.cyan, '', 'bold', '') hi('TSTextReference', c.purple, '', '', '')
hi('TSEmphasis', c.cyan, '', 'bold,italic', '') hi('TSEmphasis', c.fg, '', 'bold,italic', '')
hi('TSUnderline', c.cyan, '', 'underline', '') cmd('hi! link TSUnderline Underline')
hi('TSTitle', c.cyan, '', '', '') hi('TSTitle', c.dark_blue, '', 'bold', '')
hi('TSLiteral', c.cyan, '', '', '') hi('TSLiteral', c.fg, '', '', '')
hi('TSURI', c.fg, '', '', '') hi('TSURI', c.green, '', 'underline', '')
hi('TSTag', c.blue, '', '', '')
hi('TSTagDelimiter', c.fg, '', '', '') cmd('hi! link TSComment Comment')
vim.api.nvim_command('hi! link TSAnnotation Annotation') hi('TSConditional', c.blue, '', 'bold', '')
vim.api.nvim_command('hi! link TSConstructor Function') hi('TSKeyword', c.blue, '', 'bold', '')
-- vim.api.nvim_command('hi! link TSError Error') hi('TSRepeat', c.blue, '', 'bold', '')
vim.api.nvim_command('hi! link TSFuncBuiltin Function') hi('TSKeywordFunction', c.blue, '', 'bold', '')
vim.api.nvim_command('hi! link TSFunction Function') hi('TSKeywordOperator', c.blue, '', 'bold', '')
vim.api.nvim_command('hi! link TSFuncMacro Function') cmd('hi! link TSFunction Function')
vim.api.nvim_command('hi! link TSVariable Variable') hi('TSMethod', c.teal, '', '', '')
cmd('hi! link TSFuncBuiltin Function')
cmd('hi! link TSVariable Variable')
cmd('hi! link TSVariableBuiltin Variable')
cmd('hi! link TSStrong Bold')
cmd('hi! link TSStructure Structure')
hi('TSNote', c.blue, '', 'bold', '')
hi('TSWarning', c.yellow, '', 'bold', '')
hi('TSDanger', c.red, '', 'bold', '')
end end
-- LSP groups -- LSP groups
local function highlight_lsp() function M.highlight_lsp()
hi('LspDiagnosticsDefaultError', c.red, '', '', '') hi('LspDiagnosticsDefaultError', c.red, '', '', '')
hi('LspDiagnosticsSignError', c.red, '', '', '') hi('LspDiagnosticsSignError', c.red, '', '', '')
hi('LspDiagnosticsFloatingError', c.red, '', '', '') hi('LspDiagnosticsFloatingError', c.red, '', '', '')
@ -277,29 +285,29 @@ local function highlight_lsp()
hi('LspReferenceText', c.fg, c.grey_bright, '', '') hi('LspReferenceText', c.fg, c.grey_bright, '', '')
hi('LspReferenceRead', c.fg, c.grey_bright, '', '') hi('LspReferenceRead', c.fg, c.grey_bright, '', '')
hi('LspReferenceWrite', c.fg, c.grey_bright, '', '') hi('LspReferenceWrite', c.fg, c.grey_bright, '', '')
vim.api.nvim_command('hi! link LspCodeLens Comment') cmd('hi! link LspCodeLens Comment')
-- Theses are for neovim 0.6 -- Theses are for neovim 0.6
-- vim.api.nvim_command('hi! link DiagnosticVirtualTextWarn LspDiagnosticsVirtualTextWarning') -- cmd('hi! link DiagnosticVirtualTextWarn LspDiagnosticsVirtualTextWarning')
-- vim.api.nvim_command('hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning') -- cmd('hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning')
-- vim.api.nvim_command('hi! link DiagnosticFloatingWarn LspDiagnosticsFloatingWarning') -- cmd('hi! link DiagnosticFloatingWarn LspDiagnosticsFloatingWarning')
-- vim.api.nvim_command('hi! link DiagnosticSignWarn LspDiagnosticsSignWarning') -- cmd('hi! link DiagnosticSignWarn LspDiagnosticsSignWarning')
-- vim.api.nvim_command('hi! link DiagnosticVirtualTextError LspDiagnosticsVirtualTextError') -- cmd('hi! link DiagnosticVirtualTextError LspDiagnosticsVirtualTextError')
-- vim.api.nvim_command('hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError') -- cmd('hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError')
-- vim.api.nvim_command('hi! link DiagnosticFloatingError LspDiagnosticsFloatingError') -- cmd('hi! link DiagnosticFloatingError LspDiagnosticsFloatingError')
-- vim.api.nvim_command('hi! link DiagnosticSignError LspDiagnosticsSignError') -- cmd('hi! link DiagnosticSignError LspDiagnosticsSignError')
-- vim.api.nvim_command('hi! link DiagnosticVirtualTextInfo LspDiagnosticsVirtualTextInformation') -- cmd('hi! link DiagnosticVirtualTextInfo LspDiagnosticsVirtualTextInformation')
-- vim.api.nvim_command('hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation') -- cmd('hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation')
-- vim.api.nvim_command('hi! link DiagnosticFloatingInfo LspDiagnosticsFloatingInformation') -- cmd('hi! link DiagnosticFloatingInfo LspDiagnosticsFloatingInformation')
-- vim.api.nvim_command('hi! link DiagnosticSignInfo LspDiagnosticsSignInformation') -- cmd('hi! link DiagnosticSignInfo LspDiagnosticsSignInformation')
-- vim.api.nvim_command('hi! link DiagnosticVirtualTextHint LspDiagnosticsVirtualTextHint') -- cmd('hi! link DiagnosticVirtualTextHint LspDiagnosticsVirtualTextHint')
-- vim.api.nvim_command('hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint') -- cmd('hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint')
-- vim.api.nvim_command('hi! link DiagnosticFloatingHint LspDiagnosticsFloatingHint') -- cmd('hi! link DiagnosticFloatingHint LspDiagnosticsFloatingHint')
-- vim.api.nvim_command('hi! link DiagnosticSignHint LspDiagnosticsSignHint') -- cmd('hi! link DiagnosticSignHint LspDiagnosticsSignHint')
end end
-- Specify groups for plugins -- Specify groups for plugins
local function highlight_plugins() function M.highlight_plugins()
-- nvim-cmp -- nvim-cmp
hi('CmpItemAbbr', c.fg, '', '', '') hi('CmpItemAbbr', c.fg, '', '', '')
hi('CmpItemAbbrMatch', c.yellow, '', '', '') hi('CmpItemAbbrMatch', c.yellow, '', '', '')
@ -325,11 +333,11 @@ local function highlight_plugins()
hi('HopNextKey', c.red, '', 'bold', '') hi('HopNextKey', c.red, '', 'bold', '')
hi('HopNextKey1', c.cyan, '', 'bold', '') hi('HopNextKey1', c.cyan, '', 'bold', '')
hi('HopNextKey2', c.dark_blue, '', '', '') hi('HopNextKey2', c.dark_blue, '', '', '')
vim.api.nvim_command('hi! link HopUnmatched LineNr') cmd('hi! link HopUnmatched LineNr')
-- vim-eft -- vim-eft
hi('EftChar', c.orange, '', 'bold,underline', '') hi('EftChar', c.orange, '', 'bold,underline', '')
vim.api.nvim_command('hi! link EftSubChar LineNr') cmd('hi! link EftSubChar LineNr')
-- dashboard-nvim / alpha-nvim -- dashboard-nvim / alpha-nvim
hi('DashboardHeader' , c.blue , '', 'bold' , '') hi('DashboardHeader' , c.blue , '', 'bold' , '')
@ -370,8 +378,8 @@ local function highlight_plugins()
hi('WindowPickerSwap', c.fg, c.orange, 'bold', '') hi('WindowPickerSwap', c.fg, c.orange, 'bold', '')
-- vim-illuminate -- vim-illuminate
vim.api.nvim_command('hi! link illuminatedWord Underline') cmd('hi! link illuminatedWord Underline')
vim.api.nvim_command('hi! link illuminatedCurWord Underline') cmd('hi! link illuminatedCurWord Underline')
-- trouble.nvim -- trouble.nvim
hi('LspTroubleText', c.blue, '', 'bold', '') hi('LspTroubleText', c.blue, '', 'bold', '')
@ -398,26 +406,4 @@ local function highlight_plugins()
hi('NeogitNotificationError', c.red, '', '', '') hi('NeogitNotificationError', c.red, '', '', '')
end end
-- Main function
function M.highlight()
-- Reset everything
vim.api.nvim_command('hi clear')
if vim.fn.exists('syntax_on') then vim.api.nvim_command('syntax reset') end
vim.opt.background = 'dark'
-- Load highlight groups
local async
async = vim.loop.new_async(vim.schedule_wrap(function()
set_vim_termcolors()
highlight_plugins()
highlight_treesitter()
highlight_lsp()
async:close()
end))
highlight_editors()
highlight_syntax()
async:send() -- Load the rest later
end
return M return M

View File

@ -1,6 +1,4 @@
local M = {} local onedark = {
M.colors = {
black = '#282C34', black = '#282C34',
grey1 = '#3E4452', grey1 = '#3E4452',
grey2 = '#4B5263', grey2 = '#4B5263',
@ -22,20 +20,4 @@ M.colors = {
highlight = '#9CA0A4' highlight = '#9CA0A4'
} }
local c = M.colors return onedark
local function hi(group, guifg, guibg, attr, guisp)
local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
vim.api.nvim_command(hl)
end
function M.highlight()
hi('ModeMsg', c.green, '', '', '')
end
return M

View File

@ -0,0 +1,10 @@
local M = {}
local c = require('themes.onedark.colors')
local hi = require('themes.util').highlight
function M.highlight_editor()
hi('ModeMsg', c.fg, '', '', '')
end
return M

View File

@ -0,0 +1,13 @@
local M = {}
function M.highlight(group, guifg, guibg, attr, guisp)
local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
vim.api.nvim_command(hl)
end
return M

View File

@ -9,9 +9,9 @@ if [ -d "${server_path}" ]; then
git pull git pull
else else
git clone https://github.com/sumneko/lua-language-server.git ${server_path} git clone https://github.com/sumneko/lua-language-server.git ${server_path}
cd ${server_path}
fi fi
cd ${server_path}
git submodule update --init --recursive git submodule update --init --recursive
# Build # Build

View File

@ -18,6 +18,9 @@ chmod 755 $HOME/.local/bin/fzf/adl
curl -fL "https://github.com/pystardust/ytfzf/raw/master/ytfzf" -o $HOME/.local/bin/fzf/ytfzf curl -fL "https://github.com/pystardust/ytfzf/raw/master/ytfzf" -o $HOME/.local/bin/fzf/ytfzf
chmod 755 $HOME/.local/bin/fzf/ytfzf chmod 755 $HOME/.local/bin/fzf/ytfzf
curl -fL "https://github.com/pystardust/ani-cli/raw/master/ani-cli" -o $HOME/.local/bin/ani-cli
chmod 755 $HOME/.local/bin/ani-cli
curl -fL "https://github.com/dilshod/xlsx2csv/raw/master/xlsx2csv.py" -o $HOME/.local/bin/xlsx2csv.py curl -fL "https://github.com/dilshod/xlsx2csv/raw/master/xlsx2csv.py" -o $HOME/.local/bin/xlsx2csv.py
chmod 755 $HOME/.local/bin/xlsx2csv.py chmod 755 $HOME/.local/bin/xlsx2csv.py

View File

@ -1,5 +1,5 @@
TLP_DEFAULT_MODE=BAT TLP_DEFAULT_MODE=BAT
#TLP_PS_IGNORE=BAT #TLP_PERSISTENT_DEFAULT=1
CPU_SCALING_GOVERNOR_ON_BAT=ondemand CPU_SCALING_GOVERNOR_ON_BAT=ondemand
CPU_SCALING_MIN_FREQ_ON_BAT=1400000 CPU_SCALING_MIN_FREQ_ON_BAT=1400000
@ -9,18 +9,16 @@ CPU_SCALING_MIN_FREQ_ON_AC=1400000
CPU_SCALING_MAX_FREQ_ON_AC=2100000 CPU_SCALING_MAX_FREQ_ON_AC=2100000
#DISK_DEVICES="nvme0n1 sda" #DISK_DEVICES="nvme0n1 sda"
DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0" DISK_SPINDOWN_TIMEOUT_ON_AC="keep keep"
DISK_SPINDOWN_TIMEOUT_ON_BAT="keep 1"
DISK_IOSCHED="mq-deadline mq-deadline" DISK_IOSCHED="mq-deadline mq-deadline"
PCIE_ASPM_ON_BAT=default PCIE_ASPM_ON_BAT=default
PCIE_ASPM_ON_AC=default PCIE_ASPM_ON_AC=default
RADEON_POWER_PROFILE_ON_BAT=auto #RESTORE_DEVICE_STATE_ON_STARTUP=1
RADEON_POWER_PROFILE_ON_AC=auto
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_STATE_ON_AC=performance
DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan" DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan" DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
START_CHARGE_THRESH_BAT0=70 START_CHARGE_THRESH_BAT0=70