add toggle lsp diagnostic

This commit is contained in:
ksyasuda 2022-05-19 01:26:07 -07:00
parent 164aa942e0
commit c70f3ec15a
3 changed files with 20 additions and 5 deletions

View File

@ -181,18 +181,19 @@ if has('nvim')
source ~/.config/nvim/plugin-confs/github-theme.lua source ~/.config/nvim/plugin-confs/github-theme.lua
source ~/.config/nvim/plugin-confs/onedarkpro.lua source ~/.config/nvim/plugin-confs/onedarkpro.lua
source ~/.config/nvim/lua/toggle_lsp_diagnostics.lua
" makes fzf match colorscheme (I think) " makes fzf match colorscheme (I think)
augroup fzf_preview augroup fzf_preview
autocmd! autocmd!
autocmd User fzf_preview#rpc#initialized call s:fzf_preview_settings() " fzf_preview#remote#initialized or fzf_preview#coc#initialized autocmd User fzf_preview#rpc#initialized call s:fzf_preview_settings()
augroup END augroup END
function! s:fzf_preview_settings() abort function! s:fzf_preview_settings() abort
let g:fzf_preview_command = 'COLORTERM=truecolor ' . g:fzf_preview_command let g:fzf_preview_command = 'COLORTERM=truecolor ' . g:fzf_preview_command
let g:fzf_preview_grep_preview_cmd = 'COLORTERM=truecolor ' . g:fzf_preview_grep_preview_cmd let g:fzf_preview_grep_preview_cmd = 'COLORTERM=truecolor ' . g:fzf_preview_grep_preview_cmd
endfunction endfunction
" make terminal not have line numbers " make terminal not have line numbers
autocmd TermOpen * setlocal nonumber norelativenumber autocmd TermOpen * setlocal nonumber norelativenumber
else else
source ~/.vim/keybindings.vim source ~/.vim/keybindings.vim

View File

@ -128,3 +128,6 @@ nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr> nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr> nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xx <cmd>TroubleToggle<cr> nnoremap <leader>xx <cmd>TroubleToggle<cr>
nmap <leader>y "+
vmap <leader>y "+

View File

@ -0,0 +1,11 @@
local diagnostics_active = true
local toggle_diagnostics = function()
diagnostics_active = not diagnostics_active
if diagnostics_active then
vim.diagnostic.show()
else
vim.diagnostic.hide()
end
end
vim.keymap.set('n', '<leader>td', toggle_diagnostics)