Browse Source

Use LSP saga for more things

pull/14/head
Leslie Kerman 2 years ago
parent
commit
728f7b52a7
  1. 1
      lua/configs/autocomplete.lua
  2. 43
      lua/configs/grammar.lua
  3. 58
      lua/configs/outlinetree.lua
  4. 1
      lua/core/init.lua
  5. 37
      lua/core/keymaps.lua
  6. 7
      lua/core/plugins.lua

1
lua/configs/autocomplete.lua

@ -194,6 +194,7 @@ function M.config()
server_filetype_map = {}, server_filetype_map = {},
}) })
require('rust-tools').setup()
end end

43
lua/configs/grammar.lua

@ -1,26 +1,27 @@
local M = {} local M = {}
function M.config() function M.config()
vim.cmd([[ -- TODO: merge these into keymaps.lua
let g:grammarous#languagetool_cmd = 'languagetool' -- vim.cmd([[
nmap <leader>ec :GrammarousCheck<cr> -- let g:grammarous#languagetool_cmd = 'languagetool'
nmap <leader>eR :GrammarousReset<cr> -- nmap <leader>ec :GrammarousCheck<cr>
nmap <leader>er <Plug>(grammarous-reset) -- nmap <leader>eR :GrammarousReset<cr>
nmap <leader>eo <Plug>(grammarous-open-info-window) -- nmap <leader>er <Plug>(grammarous-reset)
nmap <leader>ex <Plug>(grammarous-close-info-window) -- nmap <leader>eo <Plug>(grammarous-open-info-window)
nmap <leader>ef <Plug>(grammarous-fixit) -- nmap <leader>ex <Plug>(grammarous-close-info-window)
nmap <leader>en <Plug>(grammarous-move-to-next-error) -- nmap <leader>ef <Plug>(grammarous-fixit)
nmap <leader>ep <Plug>(grammarous-move-to-previous-error) -- nmap <leader>en <Plug>(grammarous-move-to-next-error)
let g:grammarous#disabled_rules = { -- nmap <leader>ep <Plug>(grammarous-move-to-previous-error)
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES', 'ARROWS', 'SENTENCE_WHITESPACE', -- let g:grammarous#disabled_rules = {
\ 'WORD_CONTAINS_UNDERSCORE', 'COMMA_PARENTHESIS_WHITESPACE', -- \ '*' : ['WHITESPACE_RULE', 'EN_QUOTES', 'ARROWS', 'SENTENCE_WHITESPACE',
\ 'EN_UNPAIRED_BRACKETS', 'UPPERCASE_SENTENCE_START', -- \ 'WORD_CONTAINS_UNDERSCORE', 'COMMA_PARENTHESIS_WHITESPACE',
\ 'ENGLISH_WORD_REPEAT_BEGINNING_RULE', 'DASH_RULE', 'PLUS_MINUS', -- \ 'EN_UNPAIRED_BRACKETS', 'UPPERCASE_SENTENCE_START',
\ 'PUNCTUATION_PARAGRAPH_END', 'MULTIPLICATION_SIGN', 'PRP_CHECKOUT', -- \ 'ENGLISH_WORD_REPEAT_BEGINNING_RULE', 'DASH_RULE', 'PLUS_MINUS',
\ 'CAN_CHECKOUT', 'SOME_OF_THE', 'DOUBLE_PUNCTUATION', 'HELL', -- \ 'PUNCTUATION_PARAGRAPH_END', 'MULTIPLICATION_SIGN', 'PRP_CHECKOUT',
\ 'CURRENCY', 'POSSESSIVE_APOSTROPHE', 'ENGLISH_WORD_REPEAT_RULE', -- \ 'CAN_CHECKOUT', 'SOME_OF_THE', 'DOUBLE_PUNCTUATION', 'HELL',
\ 'NON_STANDARD_WORD'], -- \ 'CURRENCY', 'POSSESSIVE_APOSTROPHE', 'ENGLISH_WORD_REPEAT_RULE',
\ } -- \ 'NON_STANDARD_WORD'],
]]); -- \ }
-- ]]);
end end
return M return M

58
lua/configs/outlinetree.lua

@ -1,58 +0,0 @@
local M = {}
function M.config()
-- symbols_outline config
vim.g.symbols_outline = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = true,
position = 'right',
relative_width = true,
width = 15,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "TSURI" },
Module = { icon = "", hl = "TSNamespace" },
Namespace = { icon = "", hl = "TSNamespace" },
Package = { icon = "", hl = "TSNamespace" },
Class = { icon = "𝓒", hl = "TSType" },
Method = { icon = "ƒ", hl = "TSMethod" },
Property = { icon = "", hl = "TSMethod" },
Field = { icon = "", hl = "TSField" },
Constructor = { icon = "", hl = "TSConstructor" },
Enum = { icon = "", hl = "TSType" },
Interface = { icon = "", hl = "TSType" },
Function = { icon = "", hl = "TSFunction" },
Variable = { icon = "", hl = "TSConstant" },
Constant = { icon = "", hl = "TSConstant" },
String = { icon = "𝓐", hl = "TSString" },
Number = { icon = "#", hl = "TSNumber" },
Boolean = { icon = "", hl = "TSBoolean" },
Array = { icon = "", hl = "TSConstant" },
Object = { icon = "⦿", hl = "TSType" },
Key = { icon = "", hl = "TSType" },
Null = { icon = "NULL", hl = "TSType" },
EnumMember = { icon = "", hl = "TSField" },
Struct = { icon = "𝓢", hl = "TSType" },
Event = { icon = "", hl = "TSType" },
Operator = { icon = "+", hl = "TSOperator" },
TypeParameter = { icon = "𝙏", hl = "TSParameter" }
}
}
end
return M

1
lua/core/init.lua

@ -47,7 +47,6 @@ require("configs.autocomplete").config()
require("configs.statusline").config() require("configs.statusline").config()
require("configs.filetree").config() require("configs.filetree").config()
require("configs.treesitter").config() require("configs.treesitter").config()
require("configs.outlinetree").config()
require("configs.startscreen").config() require("configs.startscreen").config()
require("configs.git").config() require("configs.git").config()
require("configs.bufferline").config() require("configs.bufferline").config()

37
lua/core/keymaps.lua

@ -13,14 +13,6 @@ vim.keymap.set('n', '<F9>', function() require'telescope.builtin'.find_files{} e
vim.keymap.set('n', '<F10>', function() require'telescope.builtin'.git_files{} end) vim.keymap.set('n', '<F10>', function() require'telescope.builtin'.git_files{} end)
vim.keymap.set('n', '<F11>', function() require'telescope.builtin'.buffers{} end) vim.keymap.set('n', '<F11>', function() require'telescope.builtin'.buffers{} end)
vim.keymap.set({'n', 'i'}, '<C-p>', function() require'telescope.builtin'.registers{} end) vim.keymap.set({'n', 'i'}, '<C-p>', function() require'telescope.builtin'.registers{} end)
-- c: quick command
vim.keymap.set('n', '<leader>ce', ':e<space>')
vim.keymap.set('n', '<leader>cw', ':w<cr>')
vim.keymap.set('n', '<leader>cW', ':wa<cr>')
vim.keymap.set('n', '<leader>cE', ':e!<cr>')
vim.keymap.set('n', '<leader>cq', ':q<cr>')
vim.keymap.set('n', '<leader>cQ', ':q!<cr>')
vim.keymap.set('n', '<leader>cx', ':x<cr>')
-- w: window -- w: window
vim.keymap.set('n', '<leader>wh', '<c-w>h') vim.keymap.set('n', '<leader>wh', '<c-w>h')
vim.keymap.set('n', '<leader>wj', '<c-w>j') vim.keymap.set('n', '<leader>wj', '<c-w>j')
@ -49,38 +41,37 @@ vim.keymap.set('n', '<leader>sw', '/\\<lt>\\><left><left>')
-- l: general -- l: general
-- g: goto -- g: goto
-- w: workspace -- w: workspace
-- c: lsp saga -- c: inlay hints
vim.keymap.set('n', '<leader>le', vim.diagnostic.open_float) vim.keymap.set('n', '<leader>le', ':Lspsaga show_line_diagnostics<cr>')
vim.keymap.set('n', '<leader>lE', ':Lspsaga show_cursor_diagnostics<cr>')
vim.keymap.set('n', '<leader>lq', vim.diagnostic.setloclist) vim.keymap.set('n', '<leader>lq', vim.diagnostic.setloclist)
vim.keymap.set('n', '<leader>lk', vim.lsp.buf.hover) vim.keymap.set('n', '<leader>lk', vim.lsp.buf.hover)
vim.keymap.set('n', '<leader>lr', vim.lsp.buf.rename) vim.keymap.set("n", "<leader>ld", ':Lspsaga preview_definition<cr>')
vim.keymap.set('n', '<leader>lr', ':Lspsaga rename<cr>')
vim.keymap.set('n', '<leader>lh', vim.lsp.buf.signature_help) vim.keymap.set('n', '<leader>lh', vim.lsp.buf.signature_help)
vim.keymap.set('n', '<leader>la', vim.lsp.buf.code_action) vim.keymap.set('n', '<leader>la', vim.lsp.buf.code_action)
vim.keymap.set('n', '<leader>lf', vim.lsp.buf.formatting) vim.keymap.set('n', '<leader>lf', vim.lsp.buf.formatting)
vim.keymap.set('n', '<leader>lb', ':SymbolsOutline<cr>') vim.keymap.set('n', '<leader>lb', ':LSoutlineToggle<cr>')
vim.keymap.set("n", "<leader>la", ':Lspsaga code_action<cr>')
vim.keymap.set("n", "<leader>lu", ':Lspsaga lsp_finder<cr>')
vim.keymap.set("n", "<F12>", ':Lspsaga code_action<cr>')
vim.keymap.set('n', "<leader>it", function() require('rust-tools.inlay_hints').toggle_inlay_hints() end)
vim.keymap.set('n', "<leader>is", function() require('rust-tools.inlay_hints').set_inlay_hints() end)
vim.keymap.set('n', "<leader>id", function() require('rust-tools.inlay_hints').diable_inlay_hints() end)
vim.keymap.set('n', '<f4>', ':SymbolsOutline<cr>') vim.keymap.set('n', '<f4>', ':SymbolsOutline<cr>')
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration) vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration)
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition) vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition)
vim.keymap.set('n', '<leader>gt', vim.lsp.buf.type_definition) vim.keymap.set('n', '<leader>gt', vim.lsp.buf.type_definition)
vim.keymap.set('n', '<leader>gi', vim.lsp.buf.implementation) vim.keymap.set('n', '<leader>gi', vim.lsp.buf.implementation)
vim.keymap.set('n', '<leader>gp', vim.diagnostic.goto_prev) vim.keymap.set('n', '<leader>gp', ':Lspsaga diagnostic_jump_prev<cr>')
vim.keymap.set('n', '<leader>gn', vim.diagnostic.goto_next) vim.keymap.set('n', '<leader>gn', ':Lspsaga diagnostic_jump_next<cr>')
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references) vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references)
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder) vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder)
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder) vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder)
vim.keymap.set('n', '<leader>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end) vim.keymap.set('n', '<leader>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end)
vim.keymap.set("n", "<leader>ca", ':Lspsaga code_action<cr>')
vim.keymap.set("n", "<F12>", ':Lspsaga code_action<cr>')
vim.keymap.set("n", "<leader>cf", ':Lspsaga lsp_finder<cr>')
vim.keymap.set("n", "<leader>cr", ':Lspsaga rename<cr>')
vim.keymap.set("n", "<leader>cp", ':Lspsaga preview_definition<cr>')
vim.keymap.set("n", "<leader>el", ':Lspsaga show_line_diagnostics<cr>')
vim.keymap.set("n", "<leader>ew", ':Lspsaga show_cursor_diagnostics<cr>')
vim.keymap.set("n", "<leader>en", ':Lspsaga diagnostic_jump_next<cr>')
vim.keymap.set("n", "<leader>ep", ':Lspsaga diagnostic_jump_prev<cr>')
-- t: terminal -- t: terminal
vim.keymap.set('n', '<leader>tt', ':FloatermToggle<cr>') vim.keymap.set('n', '<leader>tt', ':FloatermToggle<cr>')
vim.keymap.set('n', '<f5>', ':FloatermToggle<cr>') vim.keymap.set('n', '<f5>', ':FloatermToggle<cr>')

7
lua/core/plugins.lua

@ -19,7 +19,7 @@ return require('packer').startup(function()
use 'sainnhe/sonokai' use 'sainnhe/sonokai'
use 'tiagovla/tokyodark.nvim' use 'tiagovla/tokyodark.nvim'
use 'projekt0n/github-nvim-theme' use 'projekt0n/github-nvim-theme'
use 'joshdick/onedark.vim' -- use 'joshdick/onedark.vim'
-- use { 'catppuccin/nvim', as='catppuccin' } -- use { 'catppuccin/nvim', as='catppuccin' }
-- use { 'sonph/onehalf', rtp='vim/' } -- use { 'sonph/onehalf', rtp='vim/' }
-- use 'liuchengxu/space-vim-dark' -- use 'liuchengxu/space-vim-dark'
@ -28,6 +28,7 @@ return require('packer').startup(function()
use 'NLKNguyen/papercolor-theme' use 'NLKNguyen/papercolor-theme'
use 'liuchengxu/space-vim-dark' use 'liuchengxu/space-vim-dark'
use 'sainnhe/edge' use 'sainnhe/edge'
use 'B4mbus/oxocarbon-lua.nvim'
-- file tree -- file tree
use { use {
@ -45,6 +46,7 @@ return require('packer').startup(function()
use 'hrsh7th/nvim-cmp' use 'hrsh7th/nvim-cmp'
use 'L3MON4D3/LuaSnip' use 'L3MON4D3/LuaSnip'
use 'nvim-treesitter/nvim-treesitter' use 'nvim-treesitter/nvim-treesitter'
use 'simrat39/rust-tools.nvim'
-- git -- git
use { use {
@ -58,9 +60,6 @@ return require('packer').startup(function()
requires = 'kyazdani42/nvim-web-devicons' requires = 'kyazdani42/nvim-web-devicons'
} }
-- tagbar
use 'simrat39/symbols-outline.nvim'
-- floating terminal -- floating terminal
use 'voldikss/vim-floaterm' use 'voldikss/vim-floaterm'

Loading…
Cancel
Save