diff --git a/init.vim b/init.vim index a810dd18..51f6cab4 100644 --- a/init.vim +++ b/init.vim @@ -25,7 +25,6 @@ else source ~/.config/nvim/themes/nvcode.vim " Plugin Configuration - luafile ~/.config/nvim/lua/lsp/general-ls.lua source ~/.config/nvim/keys/which-key.vim source ~/.config/nvim/plug-config/vim-commentary.vim source ~/.config/nvim/plug-config/rnvimr.vim @@ -48,6 +47,8 @@ else source ~/.config/nvim/plug-config/lsp-saga.vim source ~/.config/nvim/plug-config/lightbulb.vim source ~/.config/nvim/lua/lsp-wrapper.vim + source ~/.config/nvim/plug-config/lsp-config.vim + luafile ~/.config/nvim/lua/lsp/general-ls.lua luafile ~/.config/nvim/lua/plugins/galaxyline-config.lua luafile ~/.config/nvim/lua/plugins/nvimtree-config.lua luafile ~/.config/nvim/lua/plugins/treesitter-config.lua @@ -57,7 +58,6 @@ else luafile ~/.config/nvim/lua/plugins/compe-config.lua luafile ~/.config/nvim/lua/plugins/lspsaga-config.lua " LSP: https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md - source ~/.config/nvim/plug-config/lsp-config.vim luafile ~/.config/nvim/lua/lsp/lsp-config.lua luafile ~/.config/nvim/lua/lsp/lua-ls.lua luafile ~/.config/nvim/lua/lsp/python-ls.lua diff --git a/keys/which-key.vim b/keys/which-key.vim index 6f9c795a..77c222a0 100644 --- a/keys/which-key.vim +++ b/keys/which-key.vim @@ -177,10 +177,10 @@ let g:which_key_map.s = { \ 'a' : [':Telescope lsp_code_actions' , 'code_actions'], \ 'A' : [':Telescope builtin' , 'all'], \ 'b' : [':Telescope buffers' , 'buffers'], - \ 'B' : [':Telescope git_branches' , 'git_branches'], + \ 'B' : [':Telescope git_branches' , 'git branches'], \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], - \ 'c' : [':Telescope git_bcommits' , 'git_bcommits'], + \ 'c' : [':Telescope git_commits' , 'git_commits'], \ 'C' : [':Telescope git_bcommits' , 'git_bcommits'], \ 'f' : [':Telescope find_files' , 'files'], \ 'F' : [':Telescope git_files' , 'git_files'], @@ -188,12 +188,13 @@ let g:which_key_map.s = { \ 'G' : [':Telescope current_buffer_tags' , 'buffer_tags'], \ 'h' : [':Telescope command_history' , 'history'], \ 'H' : [':Telescope help_tags' , 'help_tags'], + \ 'i' : [':Telescope media_files' , 'media files'], \ 'k' : [':Telescope keymaps' , 'keymaps'], \ 'l' : [':Telescope loclist' , 'loclist'], \ 'm' : [':Telescope marks' , 'marks'], + \ 'M' : [':Telescope man_pages' , 'man_pages'], \ 'o' : [':Telescope vim_options' , 'vim_options'], \ 'O' : [':Telescope oldfiles' , 'oldfiles'], - \ 'M' : [':Telescope man_pages' , 'man_pages'], \ 'p' : [':Telescope fd' , 'fd'], \ 'P' : [':Telescope spell_suggest' , 'spell_suggest'], \ 's' : [':Telescope git_status' , 'git_status'], @@ -248,9 +249,6 @@ let g:which_key_map.g = { \ } " \ 'A' : [':Git add %' , 'add current'], " \ 'S' : [':!git status' , 'status'], -" -" -" let g:which_key_map.G = { \ 'name' : '+gist' , @@ -268,29 +266,32 @@ let g:which_key_map.G = { " l is for language server protocol let g:which_key_map.l = { \ 'name' : '+lsp' , - \ 'a' : [':Lspsaga code_action' , 'code action'], + \ 'a' : [':Lspsaga code_action' , 'quickfix'], \ 'A' : [':Lspsaga range_code_action' , 'selected action'], - \ 'd' : [':LspDefinition' , 'definition'], - \ 'D' : [':LspDeclaration' , 'workspace_diagnostics'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], \ 'f' : [':LspFormatting' , 'format'], - \ 'h' : [':Lspsaga hover_doc' , 'hover_doc'], \ 'H' : [':Lspsaga signature_help' , 'signature_help'], - \ 'K' : [':LspHover' , 'hover'], - \ 'i' : [':LspImplementation' , 'lsp_info'], \ 'I' : [':LspInfo' , 'lsp_info'], \ 'l' : [':Lspsaga lsp_finder' , 'lsp_finder'], \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], - \ 'n' : [':Lspsaga diagnostic_jump_next' , 'next_diagnostic'], \ 'o' : [':Vista!!' , 'outline'], - \ 'p' : [':Lspsaga diagnostic_jump_prev' , 'prev diagnostic'], - \ 'q' : [':Lspsaga code_action' , 'quickfix'], - \ 'r' : [':LspReferences' , 'references'], - \ 'R' : [':LspRename' , 'rename'], + \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], + \ 'q' : [':Telescope quickfix' , 'quickfix'], + \ 'r' : [':LspRename' , 'rename'], \ 'T' : [':LspTypeDefinition' , 'type defintion'], \ 'x' : [':cclose' , 'close quickfix'], - \ 'y' : [':LspDocumentSymbol' , 'document symbols'], - \ 'Y' : [':LspWorkspaceSymbol' , 'workspace symbols'], + \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], + \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], \ } + " \ 'D' : [':LspDeclaration' , 'workspace_diagnostics'], + " \ 'r' : [':Telescope lsp_references' , 'references'], + " \ 'p' : [':Lspsaga diagnostic_jump_prev' , 'prev diagnostic'], + " \ 'n' : [':Lspsaga diagnostic_jump_next' , 'next_diagnostic'], + " \ 'q' : [':Lspsaga code_action' , 'quickfix'], + " \ 'i' : [':LspImplementation' , 'lsp_info'], + " \ 'h' : [':Lspsaga hover_doc' , 'hover_doc'], + " \ 'K' : [':LspHover' , 'hover'], " t is for terminal let g:which_key_map.t = { @@ -309,52 +310,4 @@ let g:which_key_map.t = { \ 'u' : [':FloatermNew ncdu' , 'ncdu'], \ } -" w is for wiki -" let g:which_key_map.w = { -" \ 'name' : '+wiki' , -" \ 'w' : ['VimwikiIndex' , 'ncdu'], -" \ 'n' : ['(wiki-open)' , 'ncdu'], -" \ 'j' : ['(wiki-journal)' , 'ncdu'], -" \ 'R' : ['(wiki-reload)' , 'ncdu'], -" \ 'c' : ['(wiki-code-run)' , 'ncdu'], -" \ 'b' : ['(wiki-graph-find-backlinks)' , 'ncdu'], -" \ 'g' : ['(wiki-graph-in)' , 'ncdu'], -" \ 'G' : ['(wiki-graph-out)' , 'ncdu'], -" \ 'l' : ['(wiki-link-toggle)' , 'ncdu'], -" \ 'd' : ['(wiki-page-delete)' , 'ncdu'], -" \ 'r' : ['(wiki-page-rename)' , 'ncdu'], -" \ 't' : ['(wiki-page-toc)' , 'ncdu'], -" \ 'T' : ['(wiki-page-toc-local)' , 'ncdu'], -" \ 'e' : ['(wiki-export)' , 'ncdu'], -" \ 'u' : ['(wiki-list-uniq)' , 'ncdu'], -" \ 'U' : ['(wiki-list-uniq-local)' , 'ncdu'], -" \ } - -" Global -" VimwikiIndex -" VimwikiTabIndex -" VimwikiUISelect -" VimwikiDiaryIndex -" VimwikiMakeDiaryNote -" VimwikiTabMakeDiaryNote -" VimwikiMakeYesterdayDiaryNote -" VimwikiMakeTomorrowDiaryNote -" -" " Local -" Vimwiki2HTML -" Vimwiki2HTMLBrowse -" VimwikiDiaryGenerateLinks -" VimwikiFollowLink -" VimwikiSplitLink -" VimwikiVSplitLink -" VimwikiTabnewLink -" VimwikiGoBackLink -" VimwikiNextLink -" VimwikiPrevLink -" VimwikiGoto -" VimwikiDeleteLink -" VimwikiRenameLink -" VimwikiAddHeaderLevel - -" Register which key map call which_key#register('', "g:which_key_map") diff --git a/lua/plugins/telescope-config.lua b/lua/plugins/telescope-config.lua index d8e38ca8..c9ea4b90 100644 --- a/lua/plugins/telescope-config.lua +++ b/lua/plugins/telescope-config.lua @@ -1,76 +1,73 @@ local actions = require('telescope.actions') -- Global remapping ------------------------------ - -- '--color=never', -require('telescope').setup{ - defaults = { - vimgrep_arguments = { - 'rg', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case' +-- '--color=never', +require('telescope').load_extension('media_files') +require('telescope').setup { + defaults = { + vimgrep_arguments = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, + prompt_position = "top", + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, + file_sorter = require'telescope.sorters'.get_fuzzy_file, + file_ignore_patterns = {}, + generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, + shorten_path = true, + winblend = 0, + width = 0.75, + preview_cutoff = 120, + results_height = 1, + results_width = 0.8, + border = {}, + borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, + color_devicons = true, + use_less = true, + set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, + file_previewer = require'telescope.previewers'.vim_buffer_cat.new, + grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, + qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, + + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + -- To disable a keymap, put [map] = false + -- So, to not map "", just put + -- [""] = false, + + -- Otherwise, just set the mapping to the function that you want it to be. + -- [""] = actions.select_horizontal, + + -- Add up multiple actions + [""] = actions.select_default + actions.center + + -- You can perform as many actions in a row as you like + -- [""] = actions.select_default + actions.center + my_cool_custom_action, + }, + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous + -- [""] = actions.close, + -- [""] = my_cool_custom_action, + } + } }, - prompt_position = "bottom", - prompt_prefix = " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "descending", - layout_strategy = "horizontal", - layout_defaults = { - horizontal = { - mirror = false, - }, - vertical = { - mirror = false, - }, - }, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - file_ignore_patterns = {}, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - shorten_path = true, - winblend = 0, - width = 0.75, - preview_cutoff = 120, - results_height = 1, - results_width = 0.8, - border = {}, - borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, - color_devicons = true, - use_less = true, - set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - -- To disable a keymap, put [map] = false - -- So, to not map "", just put - -- [""] = false, - - -- Otherwise, just set the mapping to the function that you want it to be. - -- [""] = actions.select_horizontal, - - -- Add up multiple actions - [""] = actions.select_default + actions.center, - - -- You can perform as many actions in a row as you like - -- [""] = actions.select_default + actions.center + my_cool_custom_action, - }, - n = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - -- [""] = actions.close, - -- [""] = my_cool_custom_action, - }, - }, - } + require'telescope'.setup { + extensions = { + media_files = { + -- filetypes whitelist + -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} + filetypes = {"png", "webp", "jpg", "jpeg"}, + find_cmd = "rg" -- find command (defaults to `fd`) + } + } + } } diff --git a/plug-config/lsp-config.vim b/plug-config/lsp-config.vim index d7bab5ff..82916f79 100644 --- a/plug-config/lsp-config.vim +++ b/plug-config/lsp-config.vim @@ -3,10 +3,14 @@ nnoremap gd lua vim.lsp.buf.definition() nnoremap gD lua vim.lsp.buf.declaration() nnoremap gr lua vim.lsp.buf.references() nnoremap gi lua vim.lsp.buf.implementation() -nnoremap K lua vim.lsp.buf.hover() +nnoremap ca :Lspsaga code_action +" nnoremap K lua vim.lsp.buf.hover() +nnoremap K :Lspsaga hover_doc nnoremap lua vim.lsp.buf.signature_help() -nnoremap lua vim.lsp.diagnostic.goto_prev() -nnoremap lua vim.lsp.diagnostic.goto_next() +" nnoremap lua vim.lsp.diagnostic.goto_prev() +" nnoremap lua vim.lsp.diagnostic.goto_next() +nnoremap :Lspsaga diagnostic_jump_prev +nnoremap :Lspsaga diagnostic_jump_next " autoformat autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) diff --git a/plug-config/rnvimr.vim b/plug-config/rnvimr.vim index 8011e1d8..64eed471 100644 --- a/plug-config/rnvimr.vim +++ b/plug-config/rnvimr.vim @@ -1,5 +1,5 @@ " Make Ranger replace netrw and be the file explorer -" let g:rnvimr_ex_enable = 1 +let g:rnvimr_ex_enable = 1 let g:rnvimr_draw_border = 1 diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index 2cb35d6a..349f1355 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -70,6 +70,7 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'nvim-lua/popup.nvim' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' + Plug 'nvim-telescope/telescope-media-files.nvim' " Intellisense Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/nvim-compe' @@ -78,6 +79,7 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'kosayoda/nvim-lightbulb' Plug 'mfussenegger/nvim-jdtls' Plug 'mfussenegger/nvim-dap' + " https://github.com/mhartington/formatter.nvim look into this " File Explorer Plug 'kyazdani42/nvim-tree.lua' " Themes @@ -104,6 +106,8 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'norcalli/nvim-colorizer.lua' " live server Plug 'turbio/bracey.vim' + " Better quickfix + Plug 'kevinhwang91/nvim-bqf' endif call plug#end()