Mercurial > dotfiles
comparison dot_config/nvim/init.lua @ 448:d847c4df584b
Remove custom icons from status line
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sat, 04 Sep 2021 11:40:32 +0200 |
parents | aa15d8b06f04 |
children | 10fc275a8914 |
comparison
equal
deleted
inserted
replaced
447:aa15d8b06f04 | 448:d847c4df584b |
---|---|
93 'windwp/nvim-autopairs', | 93 'windwp/nvim-autopairs', |
94 config = function() | 94 config = function() |
95 local npairs = require 'nvim-autopairs' | 95 local npairs = require 'nvim-autopairs' |
96 local Rule = require 'nvim-autopairs.rule' | 96 local Rule = require 'nvim-autopairs.rule' |
97 | 97 |
98 require("nvim-autopairs.completion.cmp").setup { | 98 require('nvim-autopairs.completion.cmp').setup { |
99 map_cr = true, -- map <CR> on insert mode | 99 map_cr = true, -- map <CR> on insert mode |
100 map_complete = true, -- it will auto insert `(` after select function or method item | 100 map_complete = true, -- it will auto insert `(` after select function or method item |
101 auto_select = false, -- automatically select the first item | 101 auto_select = false, -- automatically select the first item |
102 } | 102 } |
103 | 103 |
142 | 142 |
143 npairs.get_rule("'"):with_pair(function() | 143 npairs.get_rule("'"):with_pair(function() |
144 return vim.bo.filetype ~= 'systemverilog' | 144 return vim.bo.filetype ~= 'systemverilog' |
145 end) | 145 end) |
146 end, | 146 end, |
147 after = { 'nvim-cmp' } | 147 after = { 'nvim-cmp' }, |
148 } | 148 } |
149 | 149 |
150 -- Moving around within lines | 150 -- Moving around within lines |
151 use { 'wellle/targets.vim', event = 'InsertEnter *' } | 151 use { 'wellle/targets.vim', event = 'InsertEnter *' } |
152 | 152 |
213 config = function() | 213 config = function() |
214 local cmp = require 'cmp' | 214 local cmp = require 'cmp' |
215 cmp.setup { | 215 cmp.setup { |
216 snippet = { | 216 snippet = { |
217 expand = function(args) | 217 expand = function(args) |
218 vim.fn["vsnip#anonymous"](args.body) | 218 vim.fn['vsnip#anonymous'](args.body) |
219 end, | 219 end, |
220 }, | 220 }, |
221 mapping = { | 221 mapping = { |
222 ['<C-p>'] = cmp.mapping.select_prev_item(), | 222 ['<C-p>'] = cmp.mapping.select_prev_item(), |
223 ['<C-n>'] = cmp.mapping.select_next_item(), | 223 ['<C-n>'] = cmp.mapping.select_next_item(), |
324 highlight = { colors.blue, colors.bg }, | 324 highlight = { colors.blue, colors.bg }, |
325 }, | 325 }, |
326 } | 326 } |
327 | 327 |
328 gls.left[2] = { | 328 gls.left[2] = { |
329 FileIcon = { | |
330 provider = 'FileIcon', | |
331 condition = condition.buffer_not_empty, | |
332 highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, | |
333 }, | |
334 } | |
335 | |
336 gls.left[3] = { | |
337 FileName = { | 329 FileName = { |
338 provider = 'FileName', | 330 provider = function() |
331 return require('galaxyline.provider_fileinfo').get_current_file_name '⊙' | |
332 end, | |
339 condition = condition.buffer_not_empty, | 333 condition = condition.buffer_not_empty, |
340 highlight = { colors.magenta, colors.bg, 'bold' }, | 334 highlight = { colors.magenta, colors.bg, 'bold' }, |
341 }, | 335 }, |
342 } | 336 } |
343 | 337 |
349 if tbl[vim.bo.filetype] then | 343 if tbl[vim.bo.filetype] then |
350 return false | 344 return false |
351 end | 345 end |
352 return true | 346 return true |
353 end, | 347 end, |
354 icon = require('nvim-nonicons').get 'server' .. ' LSP:', | |
355 highlight = { colors.green, colors.bg, 'bold' }, | 348 highlight = { colors.green, colors.bg, 'bold' }, |
356 }, | 349 }, |
357 } | 350 } |
358 | 351 |
359 gls.right[2] = { | 352 gls.right[2] = { |
574 local on_attach = function(client) | 567 local on_attach = function(client) |
575 local nnoremap = vim.keymap.nnoremap | 568 local nnoremap = vim.keymap.nnoremap |
576 local inoremap = vim.keymap.inoremap | 569 local inoremap = vim.keymap.inoremap |
577 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } | 570 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } |
578 nnoremap { '<c-]>', vim.lsp.buf.definition, silent = true } | 571 nnoremap { '<c-]>', vim.lsp.buf.definition, silent = true } |
579 nnoremap { | 572 nnoremap { |
580 'g<c-]>', | 573 'g<c-]>', |
581 function () | 574 function() |
582 local params = vim.lsp.util.make_position_params() | 575 local params = vim.lsp.util.make_position_params() |
583 opts = {} | 576 opts = {} |
584 local results_lsp = vim.lsp.buf_request_sync(0, "textDocument/definition", params, opts.timeout or 10000) | 577 local results_lsp = vim.lsp.buf_request_sync(0, 'textDocument/definition', params, opts.timeout or 10000) |
585 if not results_lsp or vim.tbl_isempty(results_lsp) then | 578 if not results_lsp or vim.tbl_isempty(results_lsp) then |
586 print("No results from textDocument/definition") | 579 print 'No results from textDocument/definition' |
587 return | 580 return |
588 end | 581 end |
589 for _, lsp_data in pairs(results_lsp) do | 582 for _, lsp_data in pairs(results_lsp) do |
590 if lsp_data ~= nil and lsp_data.result ~= nil and not vim.tbl_isempty(lsp_data.result) then | 583 if lsp_data ~= nil and lsp_data.result ~= nil and not vim.tbl_isempty(lsp_data.result) then |
591 for _, value in pairs(lsp_data.result) do | 584 for _, value in pairs(lsp_data.result) do |
592 local range = value.range or value.targetRange | 585 local range = value.range or value.targetRange |
593 if range ~= nil then | 586 if range ~= nil then |
594 local file = value.uri or value.targetUri | 587 local file = value.uri or value.targetUri |
595 if file ~=nil then | 588 if file ~= nil then |
596 vim.api.nvim_command [[split]] | 589 vim.api.nvim_command [[split]] |
597 vim.lsp.util.jump_to_location(value) | 590 vim.lsp.util.jump_to_location(value) |
598 return | 591 return |
599 end | |
600 end | 592 end |
601 end | 593 end |
602 end | 594 end |
603 end | 595 end |
604 -- try to call default lsp function | 596 end |
605 vim.lsp.buf.definition() | 597 -- try to call default lsp function |
598 vim.lsp.buf.definition() | |
606 end, | 599 end, |
607 silent = true | 600 silent = true, |
608 } | 601 } |
609 nnoremap { 'K', vim.lsp.buf.hover, silent = true } | 602 nnoremap { 'K', vim.lsp.buf.hover, silent = true } |
610 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } | 603 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } |
611 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } | 604 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } |
612 nnoremap { 'gr', vim.lsp.buf.references, silent = true } | 605 nnoremap { 'gr', vim.lsp.buf.references, silent = true } |