add color names, highlighing on hover, and keybindings

This commit is contained in:
ksyasuda
2023-08-16 02:29:56 -07:00
parent 9579c18f98
commit d0ea29e2b5
6 changed files with 133 additions and 78 deletions

View File

@@ -9,28 +9,85 @@ local db = require('dashboard')
-- db.preview_file_width = 70
vim.cmd('source $HOME/.config/nvim/static/nvim-dashboard.vim')
db.custom_center = {
{icon = '',
desc = 'Recently latest session ',
shortcut = 'SPC s l',
action ='SessionLoad'},
{icon = '',
desc = 'Recently opened files ',
action = 'Telescope oldfiles',
shortcut = 'SPC f h'},
{icon = '',
desc = 'Find File ',
action = 'Telescope find_files find_command=rg,--hidden,--files',
shortcut = 'SPC f f'},
{icon = ' ',
desc ='File Browser ',
action = 'Telescope file_browser',
shortcut = 'SPC f b'},
{icon = ' ',
desc = 'Find word ',
action = 'Telescope live_grep',
shortcut = 'SPC f w'},
{icon = '',
desc = 'Open Personal dotfiles ',
action = ':e ~/.config/nvim/init.vim',
shortcut = 'SPC f d'},
{
icon = ' ',
desc = 'Recently latest session ',
shortcut = 'SPC s l',
action = 'SessionLoad'
}, {
icon = '',
desc = 'Recently opened files ',
action = 'Telescope oldfiles',
shortcut = 'SPC f h'
}, {
desc = 'Find File ',
icon = ' ',
action = 'Telescope find_files find_command=rg,--hidden,--files',
shortcut = 'SPC f f'
}, {
icon = ' ',
desc = 'File Browser ',
action = 'Telescope file_browser',
shortcut = 'SPC f b'
}, {
icon = ' ',
desc = 'Find word ',
action = 'Telescope live_grep',
shortcut = 'SPC f w'
}, {
icon = '',
desc = 'Open Personal dotfiles ',
action = ':e ~/.config/nvim/init.vim',
shortcut = 'SPC f d'
}
}
require('dashboard').setup {
theme = 'doom', -- theme is doom and hyper default is hyper
disable_move = false, -- default is false disable move keymap for hyper
shortcut_type = 'number', -- shorcut type 'letter' or 'number'
change_to_vcs_root = false, -- default is false,for open file in hyper mru. it will change to the root of vcs
config = {
header = { "NVIM DASHBOARD" }, -- your header
center = {
{
icon = '',
icon_hl = 'Title',
desc = 'Open Recent',
desc_hl = 'String',
key = '1',
keymap = 'SPC f r',
key_hl = 'Number',
action = 'lua print(1)'
}, {
icon = '',
icon_hl = 'Title',
desc = 'Find File',
desc_hl = 'String',
key = '2',
key_hl = 'Number',
keymap = 'SPC f f',
action = 'lua print(2)'
}
-- {
-- icon = ' ',
-- desc = 'Find Dotfiles',
-- key = 'f',
-- keymap = 'SPC f d',
-- action = 'lua print(3)'
-- }
},
footer = {} -- your footer
},
hide = {
statusline = true, -- hide statusline default is true
tabline = true, -- hide the tabline
winbar = true -- hide winbar
}
-- preview = {
-- command = "bat", -- preview command
-- file_path -- preview file path
-- file_height -- preview file height
-- file_width -- preview file width
-- },
}

View File

@@ -6,6 +6,29 @@ local lspconfig = require('lspconfig')
local luasnip = require 'luasnip'
local highlight = require('cmp.utils.highlight')
local highlight_symbol_under_cursor = function()
vim.cmd [[
hi! LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
hi! LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
hi! LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
]]
vim.api.nvim_create_augroup('lsp_document_highlight', { clear = false })
vim.api.nvim_clear_autocmds({
buffer = bufnr,
group = 'lsp_document_highlight'
})
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.document_highlight
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.clear_references
})
end
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
@@ -221,12 +244,13 @@ for _, lsp in ipairs(servers) do
if lsp == 'lua_ls' then
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
on_attach = highlight_symbol_under_cursor(),
capabilities = capabilities,
callSnippet = "Replace"
}
else
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
on_attach = highlight_symbol_under_cursor(),
capabilities = capabilities
}
end

View File

@@ -63,3 +63,5 @@ ts.setup({
ts.load_extension('dap')
ts.load_extension('fzf')
ts.load_extension('glyph')
ts.load_extension('color_names')
ts.load_extension('notify')

View File

@@ -123,6 +123,7 @@ wk.register({
f = {
name = "Find File",
b = "File Browser",
c = "File Color",
f = "Find in Current Directory",
g = "Live Grep",
r = "File Recent"
@@ -207,6 +208,13 @@ wk.register({
P = "Ipython (fullscreen)",
t = "Split Terminal"
},
T = {
name = "Telescope",
c = "Color Names",
g = "Glyph",
n = "Notifications",
t = "Telescope"
},
w = {
name = "Workspace",
a = "Add Folder",