mirror of
https://github.com/Ajetski/dotfiles.git
synced 2025-09-30 11:33:18 -09:00
add auto install lsp
This commit is contained in:
parent
d637c844be
commit
30380008b4
@ -15,6 +15,7 @@ vim.o.showmatch = true -- highlight matching parentheses / brackets [{
|
|||||||
vim.o.laststatus = 2 -- always show statusline (even with only single window)
|
vim.o.laststatus = 2 -- always show statusline (even with only single window)
|
||||||
vim.o.ruler = true -- show line and column number of the cursor on right side of statusline
|
vim.o.ruler = true -- show line and column number of the cursor on right side of statusline
|
||||||
vim.o.visualbell = true -- blink cursor on error, instead of beeping
|
vim.o.visualbell = true -- blink cursor on error, instead of beeping
|
||||||
|
vim.cmd('set invlist')
|
||||||
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>", "<Plug>(easymotion-bd-jk)", { noremap = true })
|
vim.api.nvim_set_keymap("n", "<leader>", "<Plug>(easymotion-bd-jk)", { noremap = true })
|
||||||
@ -38,6 +39,7 @@ vim.call('plug#begin', '~/.config/nvim/plugged')
|
|||||||
Plug 'nvim-telescope/telescope.nvim' -- fancy fuzzyfinder
|
Plug 'nvim-telescope/telescope.nvim' -- fancy fuzzyfinder
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
|
Plug "williamboman/nvim-lsp-installer"
|
||||||
Plug 'neovim/nvim-lspconfig'
|
Plug 'neovim/nvim-lspconfig'
|
||||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||||
Plug 'hrsh7th/cmp-buffer'
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
@ -51,7 +53,7 @@ vim.call('plug#begin', '~/.config/nvim/plugged')
|
|||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
|
||||||
-- Lang Support
|
-- Lang Support
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
Plug 'evanleck/vim-svelte'
|
Plug 'evanleck/vim-svelte'
|
||||||
Plug 'pantharshit00/vim-prisma'
|
Plug 'pantharshit00/vim-prisma'
|
||||||
@ -99,8 +101,6 @@ cmp.setup({
|
|||||||
{ name = 'buffer' }
|
{ name = 'buffer' }
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
-- Mappings.
|
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap=true, silent=true }
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
@ -138,15 +138,17 @@ vim.api.nvim_create_autocmd(
|
|||||||
{ pattern = { "*" }, command = "if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif" }
|
{ pattern = { "*" }, command = "if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif" }
|
||||||
)
|
)
|
||||||
|
|
||||||
local lsp_flags = {
|
require("nvim-lsp-installer").setup {
|
||||||
|
automatic_installation = true
|
||||||
}
|
}
|
||||||
require('lspconfig')['tsserver'].setup{
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
lspconfig.sumneko_lua.setup {}
|
||||||
|
lspconfig.tsserver.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
|
||||||
}
|
}
|
||||||
require('lspconfig')['rust_analyzer'].setup{
|
lspconfig.rust_analyzer.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
|
||||||
|
|
||||||
-- Server-specific settings...
|
-- Server-specific settings...
|
||||||
settings = {
|
settings = {
|
||||||
@ -155,11 +157,8 @@ require('lspconfig')['rust_analyzer'].setup{
|
|||||||
}
|
}
|
||||||
require('lspconfig')['svelte'].setup{
|
require('lspconfig')['svelte'].setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- fuzzy finder config
|
-- fuzzy finder config
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
@ -175,6 +174,9 @@ telescope.setup({
|
|||||||
["<esc>"] = actions.close,
|
["<esc>"] = actions.close,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
file_ignore_patterns = {
|
||||||
|
"node_modules"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
pickers = {},
|
pickers = {},
|
||||||
extensions = {},
|
extensions = {},
|
||||||
@ -182,21 +184,26 @@ telescope.setup({
|
|||||||
|
|
||||||
-- keymaps
|
-- keymaps
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap=true, silent=true }
|
||||||
vim.keymap.set("n", "<c-s>", ":wa<cr>:echo 'File saved.'<cr>")
|
local loudOpts = { noremap=true }
|
||||||
|
vim.keymap.set("n", "<c-s>", ":wa<cr>:echo 'File saved.'<cr>", loudOpts)
|
||||||
vim.keymap.set("n", "<c-t>", ":NERDTreeToggle<cr>", opts)
|
vim.keymap.set("n", "<c-t>", ":NERDTreeToggle<cr>", opts)
|
||||||
vim.keymap.set("n", "<leader>tt", ":TransparentToggle<cr>", opts)
|
vim.keymap.set("n", "<leader>tt", ":TransparentToggle<cr>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>tz", ":Goyo 150<cr>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>tr", ":set relativenumber!<cr>")
|
||||||
|
vim.keymap.set("n", "<leader>ti", ":set invlist!<cr>")
|
||||||
vim.keymap.set("n", "gt", ":bn<cr>", opts)
|
vim.keymap.set("n", "gt", ":bn<cr>", opts)
|
||||||
vim.keymap.set("n", "gT", ":bp<cr>", opts)
|
vim.keymap.set("n", "gT", ":bp<cr>", opts)
|
||||||
vim.keymap.set("n", "<cr>", ":nohlsearch<cr><cr>", opts)
|
vim.keymap.set("n", "<cr>", ":nohlsearch<cr><cr>", opts)
|
||||||
vim.keymap.set("n", "<leader>ff", ":Telescope find_files<cr>", opts)
|
vim.keymap.set("n", "<leader>ff", ":Telescope find_files<cr>", opts)
|
||||||
|
vim.keymap.set('n', '<leader>fk', ':Telescope keymaps<cr>', opts)
|
||||||
vim.keymap.set("n", "<c-p>", ":Telescope find_files<cr>", opts)
|
vim.keymap.set("n", "<c-p>", ":Telescope find_files<cr>", opts)
|
||||||
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<cr>", opts)
|
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<cr>", opts)
|
||||||
vim.keymap.set("n", "<leader>fb", ":Telescope buffers<cr>", opts)
|
vim.keymap.set("n", "<leader>fb", ":Telescope buffers<cr>", opts)
|
||||||
vim.keymap.set("n", "<leader>fh", ":Telescope help_tags<cr>", opts)
|
vim.keymap.set("n", "<leader>fh", ":Telescope help_tags<cr>", opts)
|
||||||
vim.keymap.set("n", "<f1>", "", opts)
|
vim.keymap.set("n", "<f1>", "", opts)
|
||||||
vim.keymap.set("i", "<f1>", "", opts)
|
vim.keymap.set("i", "<f1>", "", opts)
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user