all repos — dotfiles @ 64c26d063600be17fb491d7aef2857324d72fba3

linux dotfiles

nvim: add basic lsp support and pyright
Prithu Goswami pg@prithu.dev
Fri, 09 Sep 2022 15:01:30 +0530
commit

64c26d063600be17fb491d7aef2857324d72fba3

parent

ce55dc4cbf1f46ab89198931a541808316d232d6

M config/nvim/.gitignoreconfig/nvim/.gitignore

@@ -1,1 +1,1 @@

-./plugin/packer_compiled.lua +plugin/packer_compiled.lua
M config/nvim/init.luaconfig/nvim/init.lua

@@ -2,6 +2,7 @@ require 'plugins'

require 'options' require 'keymaps' require 'completion' +require 'lsp' vim.cmd('colorscheme darkplus')
M config/nvim/lua/completion.luaconfig/nvim/lua/completion.lua

@@ -15,7 +15,6 @@ local col = vim.fn.col "." - 1

return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" end ---   פּ ﯟ   some other good icons local kind_icons = { Text = "", Method = "m",

@@ -43,7 +42,6 @@ Event = "",

Operator = "", TypeParameter = "", } --- find more here: https://www.nerdfonts.com/cheat-sheet cmp.setup { snippet = {

@@ -100,6 +98,7 @@ -- Kind icons

vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind vim_item.menu = ({ + nvim_lsp = "[LSP]", luasnip = "[Snippet]", buffer = "[Buffer]", path = "[Path]",

@@ -108,6 +107,7 @@ return vim_item

end, }, sources = { + { name = "nvim_lsp" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" },
A config/nvim/lua/lsp/init.lua

@@ -0,0 +1,7 @@

+local status_ok, lspconfig = pcall(require, "lspconfig") +if not status_ok then + return +end + + +lspconfig.pyright.setup{}
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -9,15 +9,14 @@ ]])

return require('packer').startup(function(use) use 'wbthomason/packer.nvim' - use 'rstacruz/vim-closer' - use 'tpope/vim-fugitive' - use 'tpope/vim-surround' - use 'tpope/vim-commentary' + -- themes use 'ayu-theme/ayu-vim' use 'folke/tokyonight.nvim' use 'LunarVim/Colorschemes' - use 'L3MON4D3/LuaSnip' + + -- lsp + use 'neovim/nvim-lspconfig' -- completion use 'hrsh7th/nvim-cmp'

@@ -25,12 +24,17 @@ use 'hrsh7th/cmp-buffer'

use 'hrsh7th/cmp-path' use 'hrsh7th/cmp-cmdline' use 'hrsh7th/cmp-nvim-lsp' + use 'L3MON4D3/LuaSnip' use 'saadparwaiz1/cmp_luasnip' use 'rafamadriz/friendly-snippets' + -- tpope deserves his own section. All hail lord tpope! + use 'tpope/vim-fugitive' + use 'tpope/vim-surround' + use 'tpope/vim-commentary' + use 'rstacruz/vim-closer' use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', cmd = 'MarkdownPreview'} - use { 'kyazdani42/nvim-tree.lua', requires = {