diff --git a/init.vim b/init.vim index c826623..135c08f 100644 --- a/init.vim +++ b/init.vim @@ -84,6 +84,7 @@ call plug#begin('~/.vim/plugged') Plug 'neovim/nvim-lspconfig' Plug 'anott03/nvim-lspinstall' Plug 'nvim-lua/completion-nvim' +Plug 'nvim-lua/lsp-status.nvim' " Inserting unicode characters. Plug 'chrisbra/unicode.vim' @@ -113,6 +114,10 @@ Plug 'szymonmaszke/vimpyter' " Firenvim allows to use neovim as the " firefox text editor. Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } + +" This is a tree manager +Plug 'kyazdani42/nvim-web-devicons' +Plug 'kyazdani42/nvim-tree.lua' call plug#end() "===================== Language Server Configuration =========================== @@ -126,20 +131,24 @@ call plug#end() " Install ccls from snap or flatpack. lua << EOF +local nvim_lsp_status = require('lsp-status') +nvim_lsp_status.register_progress() local nvim_lsp = require('lspconfig') -- This basically enables autocompletion local on_attach = function(_, bufnr) vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') require'completion'.on_attach() + -- also attach lsp-status + nvim_lsp_status.on_attach(_, bufnr) end -- Enable the language servers. -nvim_lsp.ccls.setup{on_attach=on_attach} -nvim_lsp.vimls.setup{on_attach=on_attach} -nvim_lsp.pyls.setup{on_attach=on_attach} -nvim_lsp.bashls.setup{on_attach=on_attach} -nvim_lsp.yamlls.setup{on_attach=on_attach} +nvim_lsp.ccls.setup{on_attach=on_attach, capabilities=nvim_lsp_status.capabilities} +nvim_lsp.vimls.setup{on_attach=on_attach, capabilities=nvim_lsp_status.capabilities} +nvim_lsp.pyls.setup{on_attach=on_attach, capabilities=nvim_lsp_status.capabilities} +nvim_lsp.bashls.setup{on_attach=on_attach, capabilities=nvim_lsp_status.capabilities} +nvim_lsp.yamlls.setup{on_attach=on_attach, capabilities=nvim_lsp_status.capabilities} EOF @@ -167,6 +176,14 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( }) EOF +" Statusline +function! LspStatus() abort + if luaeval('#vim.lsp.buf_get_clients() > 0') + return luaeval("require('lsp-status').status()") + endif + + return '' +endfunction "========================= Settings For Autocompletion ========================= "=============================================================================== @@ -253,3 +270,13 @@ if exists('g:started_by_firenvim') colorscheme morning set guifont=:h9 endif + + +"==================== Statusline Settings ====================================== +"=============================================================================== + +set statusline= +set statusline+=%-f\ %-y%-r%< +set statusline+=%=%-0.20{LspStatus()} +set statusline+=%=%l,%v +set laststatus=2