From 98201bcd162477e1f0b837f2b1ac0d16f43afa0d Mon Sep 17 00:00:00 2001 From: siduck76 Date: Mon, 8 Mar 2021 08:45:52 +0530 Subject: [PATCH] nvim-web-devicons custom icons fix --- init.lua | 7 +++-- lua/lsp_config/lua.lua | 60 ---------------------------------------- lua/pluginsList/lua.lua | 4 ++- lua/web-devicons/lua.lua | 2 ++ 4 files changed, 9 insertions(+), 64 deletions(-) diff --git a/init.lua b/init.lua index 944ca21..acbc4b1 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,12 @@ -- load plugins require('pluginsList.lua') +require('web-devicons.lua') require('utils.lua') require('nvimTree.lua') +require('bufferline.lua') +require('statusline.lua') + require('gitsigns.lua') require('lsp_config.lua') @@ -22,10 +26,7 @@ g.indentLine_enabled = 1 g.indentLine_char_list = {'▏'} require('treesitter.lua') -require('statusline.lua') -require('bufferline.lua') require('mappings.lua') -require('web-devicons.lua') -- highlights cmd("hi LineNr guibg=NONE") diff --git a/lua/lsp_config/lua.lua b/lua/lsp_config/lua.lua index a2969e8..ae47404 100644 --- a/lua/lsp_config/lua.lua +++ b/lua/lsp_config/lua.lua @@ -1,62 +1,2 @@ vim.cmd [[ packadd nvim-lspconfig ]] vim.cmd [[ packadd completion-nvim ]] - -require'lspconfig'.html.setup{} - -local nvim_lsp = require('lspconfig') -local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - require"completion".on_attach(client) - - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - - -- Set some keybinds conditional on server capabilities - if client.resolved_capabilities.document_formatting then - buf_set_keymap("n", "f", "lua vim.lsp.buf.formatting()", opts) - elseif client.resolved_capabilities.document_range_formatting then - buf_set_keymap("n", "f", "lua vim.lsp.buf.range_formatting()", opts) - end - - -- Set autocommands conditional on server_capabilities - if client.resolved_capabilities.document_highlight then - vim.api.nvim_exec([[ - hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow - hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow - hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow - augroup lsp_document_highlight - autocmd! * - autocmd CursorHold lua vim.lsp.buf.document_highlight() - autocmd CursorMoved lua vim.lsp.buf.clear_references() - augroup END - ]], false) - end -end - --- Use a loop to conveniently both setup defined servers -local servers = { "html" , "cssls" , "tsserver"} -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { on_attach = on_attach } -end - --- keybinds -vim.api.nvim_set_keymap('i', '', 'pumvisible() ? "\\" : "\\"', { noremap = true, expr = true }) -vim.api.nvim_set_keymap('i', '', 'pumvisible() ? "\\" : "\\"', { noremap = true, expr = true }) diff --git a/lua/pluginsList/lua.lua b/lua/pluginsList/lua.lua index 5000e57..2d243b3 100644 --- a/lua/pluginsList/lua.lua +++ b/lua/pluginsList/lua.lua @@ -3,8 +3,11 @@ local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]]) return require('packer').startup(function() use { 'kyazdani42/nvim-web-devicons'} + use { 'kyazdani42/nvim-tree.lua'} use {'neovim/nvim-lspconfig'} use {'nvim-lua/completion-nvim'} + use {'SirVer/ultisnips'} + use {'hrsh7th/nvim-compe'} use {'wbthomason/packer.nvim', opt = true} use { 'nvim-lua/plenary.nvim'} use { 'lewis6991/gitsigns.nvim'} @@ -12,7 +15,6 @@ return require('packer').startup(function() use { 'tweekmonster/startuptime.vim'} use { 'akinsho/nvim-bufferline.lua'} use { '907th/vim-auto-save'} - use { 'kyazdani42/nvim-tree.lua'} use { 'nvim-treesitter/nvim-treesitter'} use { 'chriskempson/base16-vim'} use { 'norcalli/nvim-colorizer.lua'} diff --git a/lua/web-devicons/lua.lua b/lua/web-devicons/lua.lua index 16728b1..41b20ea 100644 --- a/lua/web-devicons/lua.lua +++ b/lua/web-devicons/lua.lua @@ -1,3 +1,5 @@ +vim.cmd [[packadd nvim-web-devicons]] + require'nvim-web-devicons'.setup { override = {