From e29721fd0804d3e5ce31351974cd973946ed27f4 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Sun, 10 Oct 2021 19:27:07 +0200 Subject: [PATCH] improved icons and added rest/http client --- lua/keys.lua | 1 + lua/plugins.lua | 70 ++++++++++++++++++++++++++++++++++---- lua/plugins/java-lsp.lua | 54 +++++++++++++++++++++++++++++ lua/plugins/lsp.lua | 32 ++++++++--------- lua/plugins/nvim-tree.lua | 2 +- spell/de.utf-8.add | 1 + spell/de.utf-8.add.spl | Bin 160 -> 175 bytes 7 files changed, 135 insertions(+), 25 deletions(-) diff --git a/lua/keys.lua b/lua/keys.lua index 3fea0d5..d8d7ac0 100644 --- a/lua/keys.lua +++ b/lua/keys.lua @@ -4,6 +4,7 @@ vim.api.nvim_set_keymap("n", "fb", "lua require('telescope.builtin' vim.api.nvim_set_keymap("n", "fh", "lua require('telescope.builtin').help_tags()", {silent = true}) vim.api.nvim_set_keymap("n", "t", "TodoTelescope", {silent = true}) vim.api.nvim_set_keymap("", "q:", "", {silent = true}) +vim.api.nvim_set_keymap("n", "h", "RestNvim", {silent = true}) function _G.toggle_venn() local venn_enabled = vim.inspect(vim.b.venn_enabled) diff --git a/lua/plugins.lua b/lua/plugins.lua index aa17ee8..39dc872 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -26,6 +26,34 @@ return require("packer").startup( require("monokai").setup() end } + use { + "kyazdani42/nvim-web-devicons", + config = function() + require("nvim-web-devicons").set_icon { + ["test.ts"] = { + icon = "", + color = "#519aba", + name = "TsTest" + }, + ["test.tsx"] = { + icon = "", + color = "#519aba", + name = "TsTest" + }, + ["test.js"] = { + icon = "", + color = "#cbcb41", + name = "JsTest" + }, + ["test.jsx"] = { + icon = "", + color = "#cbcb41", + name = "JsTest" + } + } + end + } + use { "glepnir/galaxyline.nvim", branch = "main", @@ -36,6 +64,7 @@ return require("packer").startup( } use { "kyazdani42/nvim-tree.lua", + after = "nvim-web-devicons", config = function() require "plugins/nvim-tree" end, @@ -66,6 +95,14 @@ return require("packer").startup( run = ":TSUpdate", -- after = "nvim-compe", config = function() + local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() + parser_configs.http = { + install_info = { + url = "https://github.com/NTBBloodbath/tree-sitter-http", + files = {"src/parser.c"}, + branch = "main" + } + } local npairs = require("nvim-autopairs") npairs.setup( { @@ -93,7 +130,11 @@ return require("packer").startup( } } end, - requires = {"JoosepAlviste/nvim-ts-context-commentstring", "windwp/nvim-ts-autotag", "windwp/nvim-autopairs"} + requires = { + "JoosepAlviste/nvim-ts-context-commentstring", + "windwp/nvim-ts-autotag", + "windwp/nvim-autopairs" + } } use { "mhartington/formatter.nvim", @@ -118,12 +159,6 @@ return require("packer").startup( "jose-elias-alvarez/null-ls.nvim" } } - --[[ use { - "hrsh7th/nvim-compe", - config = function() - require "plugins/compe" - end - } ]] use { "nvim-telescope/telescope.nvim", config = function() @@ -232,5 +267,26 @@ return require("packer").startup( end } use "aklt/plantuml-syntax" + use { + "NTBBloodbath/rest.nvim", + requires = {"nvim-lua/plenary.nvim"}, + config = function() + require("rest-nvim").setup( + { + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150 + }, + -- Jump to request line on run + jump_to_request = false + } + ) + end + } end ) diff --git a/lua/plugins/java-lsp.lua b/lua/plugins/java-lsp.lua index 17399a8..01489fc 100644 --- a/lua/plugins/java-lsp.lua +++ b/lua/plugins/java-lsp.lua @@ -235,4 +235,58 @@ function M.setup() require("jdtls").start_or_attach(config) end +local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) +end +local opts = {noremap = true, silent = true} +buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) +buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) +buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) +buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) +buf_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) +buf_set_keymap("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) +buf_set_keymap("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) +buf_set_keymap("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) +buf_set_keymap("n", "D", "lua vim.lsp.buf.type_definition()", opts) +buf_set_keymap("n", "", "lua vim.lsp.buf.rename()", opts) +buf_set_keymap("n", "a", "lua require('jdtls').code_action()", opts) +buf_set_keymap("v", "a", "lua require('jdtls').code_action(true)", opts) +buf_set_keymap("n", "r", "lua require('jdtls').code_action(false, 'refactor')", opts) +buf_set_keymap("n", "gr", 'lua vim.lsp.buf.references() && vim.cmd("copen")', opts) +buf_set_keymap("n", "d", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) +buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) +buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) +buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) +buf_set_keymap("n", "fc", "lua vim.lsp.buf.formatting()", opts) +-- Java specific +buf_set_keymap("n", "rt", "lua require'jdtls'.test_class()", opts) +buf_set_keymap("n", "rn", "lua require'jdtls'.test_nearest_method()", opts) +buf_set_keymap("v", "ev", "lua require('jdtls').extract_variable(true)", opts) +buf_set_keymap("n", "ev", "lua require('jdtls').extract_variable()", opts) +buf_set_keymap("v", "em", "lua require('jdtls').extract_method(true)", opts) +vim.fn.sign_define( + "DiagnosticSignError", + {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} +) +vim.fn.sign_define( + "DiagnosticSignWarning", + {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} +) +vim.fn.sign_define( + "DiagnosticSignWarn", + {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} +) +vim.fn.sign_define( + "DiagnosticSignHint", + {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} +) +vim.fn.sign_define( + "DiagnosticSignInformation", + {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} +) +vim.fn.sign_define( + "DiagnosticSignInfo", + {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} +) + return M diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 41f9250..e2b0c3f 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -7,22 +7,19 @@ vim.lsp.handlers["textDocument/implementation"] = require "lsputil.locations".im vim.lsp.handlers["textDocument/documentSymbol"] = require "lsputil.symbols".document_handler vim.lsp.handlers["workspace/symbol"] = require "lsputil.symbols".workspace_handler -vim.fn.sign_define( - "DiagnosticSignError", - {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} -) -vim.fn.sign_define( - "DiagnosticSignWarning", - {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} -) -vim.fn.sign_define( - "DiagnosticSignHint", - {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} -) -vim.fn.sign_define( - "DiagnosticSignInformation", - {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} -) +local signError = vim.fn.sign_getdefined("DiagnosticSignError") +signError["text"] = "" +signError["texthl"] = "DiagnosticSignError" +vim.fn.sign_define("DiagnosticSignError", signError) +local signWarn = vim.fn.sign_getdefined("DiagnosticSignWarn") +signWarn["text"] = "" +signWarn["texthl"] = "DiagnosticSignWarn" +vim.fn.sign_define("DiagnosticSignWarn", signWarn) +local signHint = vim.fn.sign_getdefined("DiagnosticSignHint") +signHint["text"] = "" +signHint["texthl"] = "DiagnosticSignHint" +vim.fn.sign_define("DiagnosticSignHint", signHint) +vim.fn.sign_define("DiagnosticSignInfo", signHint) --- Completion Icons require("lspkind").init({}) @@ -37,6 +34,7 @@ require "lspconfig".pyright.setup {} require "lspconfig".tsserver.setup {} require "lspconfig".vimls.setup {} require "lspconfig".yamlls.setup {} +require "lspconfig".texlab.setup {} --- ESLINT @@ -131,7 +129,7 @@ require "lspconfig".tsserver.setup { on_attach = on_attach, cmd = {"java-language-server"} } ]] -local servers = {"pyright", "bashls", "clangd", "cssls"} +local servers = {"pyright", "bashls", "clangd", "cssls", "texlab"} for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index 68bc833..95aef0f 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -1,6 +1,6 @@ vim.g.nvim_tree_ignore = {".git", "node_modules", ".cache"} vim.g.nvim_tree_indent_markers = 1 -vim.api.nvim_set_keymap("", "", ":NvimTreeFindFile", {silent = true}) +vim.api.nvim_set_keymap("", "", ":NvimTreeFindFile:NvimTreeFocus", {silent = true}) vim.g.nvim_tree_icons = { default = "", diff --git a/spell/de.utf-8.add b/spell/de.utf-8.add index 3e24e00..27f094a 100644 --- a/spell/de.utf-8.add +++ b/spell/de.utf-8.add @@ -9,3 +9,4 @@ config #echnic technic/! ConfigManager +Grenning diff --git a/spell/de.utf-8.add.spl b/spell/de.utf-8.add.spl index f2b59dbae2f6d4e95178a843d64a0efa695b1eaa..1fe195d5bd008149cd2b59874af2218b4e094bfe 100644 GIT binary patch delta 82 zcmZ3$xSmls%+t5HAT=k)=syDkLl#?Na$5RCA$>i@BF0q4JRr;j;&etPCZ^1MAS;zI e87Py;n8wJ+z+hj(m<6J(6DKB0FxpS7QUd^JkrOBY delta 67 zcmZ3_xPVb8%+t5HAT=k)=syDkLp*C@a@s^;eFdh>e8xP+RK{e+BF03