feat: some stuff

This commit is contained in:
2022-05-03 11:40:07 +02:00
parent b0e54888bb
commit df0bcb87cf
15 changed files with 89 additions and 212 deletions

View File

@@ -1,31 +1,34 @@
local command_center = require("command_center")
local noremap = {noremap = true}
local noremap = { noremap = true }
command_center.add({
{
description = "Search inside current buffer",
cmd = "Telescope current_buffer_fuzzy_find",
keybindings = { "n", "<leader>fl", noremap },
}, {
}, {
-- If no descirption is specified, command is used to replace descirption by default
-- You can change this behavior in settigns
cmd = "Telescope find_files",
},
{
-- If no keybindings specified, no keybindings will be displayed or registered
description = "Find hidden files",
cmd = "Telescope find_files hidden=true",
},
{
},
{
-- If no keybindings specified, no keybindings will be displayed or registered
description = "Find hidden files",
cmd = "Telescope find_files hidden=true",
},
{
-- You can specify multiple keybindings for the same command ...
description = "Show document symbols",
cmd = "Telescope lsp_document_symbols",
},
{
},
{
description = "Show function signaure (hover)",
cmd = "lua vim.lsp.buf.hover()",
},{
description="(TS) Organize Imports",
}, {
description = "(TS) Organize Imports",
cmd = "OrganizeImports"
}, {
description = "ZenMode",
cmd = "<CMD>ZenMode<CR>"
}
})

View File

@@ -1,58 +1,17 @@
local lsp = require "lspconfig"
local lsp_status = require("lsp-status")
-- local ts_utils = require("nvim-lsp-ts-utils")
require 'nvim-lightbulb'.setup {
-- LSP client names to ignore
-- Example: {"sumneko_lua", "null-ls"}
ignore = {},
sign = {
enabled = true,
-- Priority of the gutter sign
priority = 10,
},
float = {
enabled = false,
-- Text to show in the popup float
text = "💡",
-- Available keys for window options:
-- - height of floating window
-- - width of floating window
-- - wrap_at character to wrap at for computing height
-- - max_width maximal width of floating window
-- - max_height maximal height of floating window
-- - pad_left number of columns to pad contents at left
-- - pad_right number of columns to pad contents at right
-- - pad_top number of lines to pad contents at top
-- - pad_bottom number of lines to pad contents at bottom
-- - offset_x x-axis offset of the floating window
-- - offset_y y-axis offset of the floating window
-- - anchor corner of float to place at the cursor (NW, NE, SW, SE)
-- - winblend transparency of the window (0-100)
win_opts = {},
},
virtual_text = {
enabled = false,
-- Text to show at virtual text
text = "💡",
-- highlight mode to use for virtual text (replace, combine, blend), see :help nvim_buf_set_extmark() for reference
hl_mode = "replace",
},
status_text = {
enabled = false,
-- Text to provide when code actions are available
text = "💡",
-- Text to provide when no actions are available
text_unavailable = ""
}
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.setup {
ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" }
}
local lsp = require "lspconfig"
local lsp_format = require("lsp-format");
lsp_format.setup {}
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
lsp.sumneko_lua.setup {
on_attach = lsp_format.on_attach,
settings = {
Lua = {
runtime = {
@@ -77,5 +36,43 @@ lsp.sumneko_lua.setup {
}
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
lsp.jsonls.setup {
capabilities = capabilities,
on_attach = lsp_format.on_attach,
settings = {
json = {
schemas = {
{
description = 'TypeScript compiler configuration file',
fileMatch = { 'tsconfig.json', 'tsconfig.*.json' },
url = 'http://json.schemastore.org/tsconfig'
},
{
description = 'ESLint config',
fileMatch = { '.eslintrc.json', '.eslintrc' },
url = 'http://json.schemastore.org/eslintrc'
},
{
description = 'Prettier config',
fileMatch = { '.prettierrc', '.prettierrc.json', 'prettier.config.json' },
url = 'http://json.schemastore.org/prettierrc'
},
}
},
}
}
lsp.svelte.setup {
on_attach = lsp_format.on_attach
}
lsp.tsserver.setup {
on_attach = lsp_format.on_attach
}
-- Ltex Language Server
require("grammar-guard").init()

View File

@@ -1,34 +0,0 @@
local lsp_installer = require("nvim-lsp-installer")
local lsp_format = require("lsp-format");
lsp_format.setup {}
local function organize_imports()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(0)},
title = ""
}
vim.lsp.buf.execute_command(params)
end
lsp_installer.on_server_ready(
function(server)
local opts = {
on_attach = lsp_format.on_attach
}
if server.name == "tsserver" then
opts.commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports"
}
}
end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
server:setup(opts)
end
)

View File

@@ -22,8 +22,6 @@ augroup SaveManualFolds
augroup END
]]
vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()]]
vim.api.nvim_create_autocmd("BufWritePre", {
callback = function()
vim.lsp.buf.formatting_sync();

View File

@@ -12,10 +12,11 @@ return require("packer").startup(
use "nvim-lualine/lualine.nvim"
-- Layout Plugins
use { "folke/zen-mode.nvim", config = function() require("zen-mode").setup {} end }
use "rcarriga/nvim-notify"
use "kyazdani42/nvim-web-devicons"
use "kyazdani42/nvim-tree.lua"
use "nvim-lua/popup.nvim"
-- use "mhinz/vim-startify"
use 'goolord/alpha-nvim'
use { "terrortylor/nvim-comment", config = function() require('nvim_comment').setup() end }
use "windwp/nvim-autopairs"
@@ -25,13 +26,6 @@ return require("packer").startup(
use "nvim-telescope/telescope.nvim"
use "gfeiyou/command-center.nvim"
-- Postman like features
-- use "NTBBloodbath/rest.nvim"
-- Obsidian / Roam like features
-- use "lervag/wiki.vim"
use "rcarriga/nvim-notify"
-- Lsp Errors
use "folke/lsp-colors.nvim"
@@ -45,6 +39,7 @@ return require("packer").startup(
}
-- Syntax / Autocomplete
use "tpope/vim-surround"
use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp"
@@ -57,7 +52,6 @@ return require("packer").startup(
use "L3MON4D3/LuaSnip"
use "saadparwaiz1/cmp_luasnip"
use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim"
use "brymer-meneses/grammar-guard.nvim"
use {
"nvim-treesitter/nvim-treesitter",

1
configs/nvim/lua/lua Symbolic link
View File

@@ -0,0 +1 @@
/home/max/.dotfiles/configs/lua