Add treesitter, clangd-lsp config and refactor

This commit is contained in:
Victor Timofei 2022-12-09 15:23:16 +02:00
parent 4dfd12ec93
commit 259fdcd1e8
Signed by: vtimofei
GPG Key ID: B790DCEBE281403A
8 changed files with 115 additions and 43 deletions

View File

@ -1,5 +1,9 @@
vim.g.tokyonight_transparent_sidebar = true
vim.g.tokyonight_transparent = true
vim.opt.background = "dark"
local g = vim.g
local opt = vim.opt
local cmd = vim.cmd
vim.cmd("colorscheme tokyonight")
g.tokyonight_transparent_sidebar = true
g.tokyonight_transparent = true
opt.background = "dark"
cmd("colorscheme tokyonight")

View File

@ -4,3 +4,4 @@ require("vtimofei.cmp")
require("vtimofei.lsp")
require("vtimofei.plugins")
require("vtimofei.telescope")
require("vtimofei.treesitter")

View File

@ -0,0 +1,17 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local remap = require('vtimofei.lsp.remap')
local lsp_conf = require('lspconfig')
lsp_conf.clangd.setup{
capabilities = capabilities,
on_attach = function()
remap.hover()
remap.definition()
remap.type_definition()
remap.implementation()
remap.diagnostics_next()
remap.diagnostics_prev()
remap.rename()
remap.code_action()
end
}

View File

@ -2,3 +2,4 @@ require('vtimofei.lsp.gopls')
require('vtimofei.lsp.rust_analyzer')
require('vtimofei.lsp.sumneko_lua')
require('vtimofei.lsp.tsserver')
require('vtimofei.lsp.clangd')

View File

@ -1,25 +1,25 @@
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'folke/tokyonight.nvim'
use 'neovim/nvim-lspconfig'
use 'nvim-lua/plenary.nvim'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'L3MON4D3/LuaSnip'
use 'saadparwaiz1/cmp_luasnip'
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end,
}
use {
'nvim-telescope/telescope.nvim', branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
use 'wbthomason/packer.nvim'
use 'folke/tokyonight.nvim'
use 'neovim/nvim-lspconfig'
use 'nvim-lua/plenary.nvim'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'L3MON4D3/LuaSnip'
use 'saadparwaiz1/cmp_luasnip'
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end,
}
use {
'nvim-telescope/telescope.nvim', branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
end)

View File

@ -1,17 +1,20 @@
vim.opt.guicursor = ""
local opt = vim.opt
local g = vim.g
vim.opt.nu = true
vim.opt.relativenumber = true
opt.guicursor = ""
vim.opt.tabstop = 8
vim.opt.softtabstop = 8
vim.opt.shiftwidth = 8
vim.opt.expandtab = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
opt.nu = true
opt.relativenumber = true
vim.opt.smartindent = true
opt.tabstop = 8
opt.softtabstop = 8
opt.shiftwidth = 8
opt.expandtab = true
opt.hlsearch = false
opt.incsearch = true
vim.opt.wrap = false
opt.smartindent = true
vim.g.mapleader = " "
opt.wrap = false
g.mapleader = " "

View File

@ -1,6 +1,8 @@
vim.keymap.set("n", "<leader>dl", "<cmd>Telescope diagnostics<CR>")
vim.keymap.set("n", "<leader>tr", "<cmd>Telescope lsp_references<CR>")
vim.keymap.set("n", "<leader>ti", "<cmd>Telescope lsp_implementations<CR>")
vim.keymap.set("n", "<leader>fw", "<cmd>Telescope live_grep<CR>")
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<CR>")
vim.keymap.set("n", "<leader>tc", "<cmd>Telescope colorscheme<CR>")
local keymap = vim.keymap;
keymap.set("n", "<leader>dl", "<cmd>Telescope diagnostics<CR>")
keymap.set("n", "<leader>tr", "<cmd>Telescope lsp_references<CR>")
keymap.set("n", "<leader>ti", "<cmd>Telescope lsp_implementations<CR>")
keymap.set("n", "<leader>fw", "<cmd>Telescope live_grep<CR>")
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<CR>")
keymap.set("n", "<leader>tc", "<cmd>Telescope colorscheme<CR>")

View File

@ -0,0 +1,44 @@
local tr = require('nvim-treesitter.configs')
tr.setup {
sync_install = false,
ensure_installed = {
"go",
"gowork",
"gomod",
"proto",
"rust",
"c",
"cpp",
"python",
"lua",
"awk",
"bash",
"java",
"cmake",
"make",
"dockerfile",
"json",
"yaml",
"toml",
"yang",
"diff",
"git_rebase",
"gitcommit",
"comment",
"markdown",
"regex",
"help",
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
local vim = vim
local opt = vim.opt
opt.foldmethod = "expr"
opt.foldexpr = "nvim_treesitter#foldexpr()"