nvim-web-devicons custom icons fix

This commit is contained in:
siduck76 2021-03-08 08:45:52 +05:30
parent 82f4566872
commit 98201bcd16
4 changed files with 9 additions and 64 deletions

View file

@ -1,8 +1,12 @@
-- load plugins -- load plugins
require('pluginsList.lua') require('pluginsList.lua')
require('web-devicons.lua')
require('utils.lua') require('utils.lua')
require('nvimTree.lua') require('nvimTree.lua')
require('bufferline.lua')
require('statusline.lua')
require('gitsigns.lua') require('gitsigns.lua')
require('lsp_config.lua') require('lsp_config.lua')
@ -22,10 +26,7 @@ g.indentLine_enabled = 1
g.indentLine_char_list = {''} g.indentLine_char_list = {''}
require('treesitter.lua') require('treesitter.lua')
require('statusline.lua')
require('bufferline.lua')
require('mappings.lua') require('mappings.lua')
require('web-devicons.lua')
-- highlights -- highlights
cmd("hi LineNr guibg=NONE") cmd("hi LineNr guibg=NONE")

View file

@ -1,62 +1,2 @@
vim.cmd [[ packadd nvim-lspconfig ]] vim.cmd [[ packadd nvim-lspconfig ]]
vim.cmd [[ packadd completion-nvim ]] 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', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", 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! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> 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', '<Tab>', 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', { noremap = true, expr = true })
vim.api.nvim_set_keymap('i', '<S-Tab>', 'pumvisible() ? "\\<C-p>" : "\\<S-Tab>"', { noremap = true, expr = true })

View file

@ -3,8 +3,11 @@ local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
return require('packer').startup(function() return require('packer').startup(function()
use { 'kyazdani42/nvim-web-devicons'} use { 'kyazdani42/nvim-web-devicons'}
use { 'kyazdani42/nvim-tree.lua'}
use {'neovim/nvim-lspconfig'} use {'neovim/nvim-lspconfig'}
use {'nvim-lua/completion-nvim'} use {'nvim-lua/completion-nvim'}
use {'SirVer/ultisnips'}
use {'hrsh7th/nvim-compe'}
use {'wbthomason/packer.nvim', opt = true} use {'wbthomason/packer.nvim', opt = true}
use { 'nvim-lua/plenary.nvim'} use { 'nvim-lua/plenary.nvim'}
use { 'lewis6991/gitsigns.nvim'} use { 'lewis6991/gitsigns.nvim'}
@ -12,7 +15,6 @@ return require('packer').startup(function()
use { 'tweekmonster/startuptime.vim'} use { 'tweekmonster/startuptime.vim'}
use { 'akinsho/nvim-bufferline.lua'} use { 'akinsho/nvim-bufferline.lua'}
use { '907th/vim-auto-save'} use { '907th/vim-auto-save'}
use { 'kyazdani42/nvim-tree.lua'}
use { 'nvim-treesitter/nvim-treesitter'} use { 'nvim-treesitter/nvim-treesitter'}
use { 'chriskempson/base16-vim'} use { 'chriskempson/base16-vim'}
use { 'norcalli/nvim-colorizer.lua'} use { 'norcalli/nvim-colorizer.lua'}

View file

@ -1,3 +1,5 @@
vim.cmd [[packadd nvim-web-devicons]]
require'nvim-web-devicons'.setup { require'nvim-web-devicons'.setup {
override = { override = {