diff --git a/profiles/nvim/nvim.nix b/profiles/nvim/nvim.nix index b63dbb3a..fdfcf5a7 100644 --- a/profiles/nvim/nvim.nix +++ b/profiles/nvim/nvim.nix @@ -76,9 +76,6 @@ in csv-vim rainbow_parentheses-vim vim-surround - bufferline-nvim - feline-nvim - nvim-web-devicons vim-devicons # kitaab stuff vimwiki @@ -86,6 +83,7 @@ in vim-zettel telescope-nvim plenary-nvim + bufferline-nvim # lsp stuff ale nvim-lspconfig @@ -278,314 +276,56 @@ in " lua config lua <'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [''] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - }, { - { name = 'buffer' }, - }) - }) - -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' }, - { name = "nvim_lsp"}, - { name = "path" }, - { name = 'conjure'}, - { name = 'cmp_tabnine'}, - } - }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }) +-- Setup nvim-cmp. +local cmp = require'cmp' +cmp.setup({ + mapping = { + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [''] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + }, { + { name = 'buffer' }, + }) +}) +-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' }, + { name = "nvim_lsp"}, + { name = "path" }, + { name = 'conjure'}, + { name = 'cmp_tabnine'}, + } +}) +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) - -- Setup lspconfig. - local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) - require'lspconfig'nvim_lsp.setup {} - require'lspconfig'clojure_lsp.setup {} - require'lspconfig'rnix.setup {} - require'lspconfig'pylsp.setup {} - require'lspconfig'terraform_lsp.setup {} +-- Setup lspconfig. +-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- require'lspconfig'nvim_lsp.setup {} +-- require'lspconfig'clojure_lsp.setup {} +-- require'lspconfig'rnix.setup {} +-- require'lspconfig'pylsp.setup {} +-- require'lspconfig'terraform_lsp.setup {} - -- Feline - local colors = require 'theme.colors' - local lsp = require 'feline.providers.lsp' - local vi_mode_utils = require 'feline.providers.vi_mode' - local vi_mode_colors = { - NORMAL = colors.green, - INSERT = colors.red, - VISUAL = colors.magenta, - OP = colors.green, - BLOCK = colors.blue, - REPLACE = colors.violet, - ['V-REPLACE'] = colors.violet, - ENTER = colors.cyan, - MORE = colors.cyan, - SELECT = colors.orange, - COMMAND = colors.green, - SHELL = colors.green, - TERM = colors.green, - NONE = colors.yellow - } - local icons = { - linux = ' ', - macos = ' ', - windows = ' ', - errs = ' ', - warns = ' ', - infos = ' ', - hints = ' ', - lsp = ' ', - git = '' - } - local function file_osinfo() - local os = vim.bo.fileformat:upper() - local icon - if os == 'UNIX' then - icon = icons.linux - elseif os == 'MAC' then - icon = icons.macos - else - icon = icons.windows - end - return icon .. os - end - local function lsp_diagnostics_info() - return { - errs = lsp.get_diagnostics_count('Error'), - warns = lsp.get_diagnostics_count('Warning'), - infos = lsp.get_diagnostics_count('Information'), - hints = lsp.get_diagnostics_count('Hint') - } - end - local function diag_enable(f, s) - return function() - local diag = f()[s] - return diag and diag ~= 0 - end - end - local function diag_of(f, s) - local icon = icons[s] - return function() - local diag = f()[s] - return icon .. diag - end - end - local function vimode_hl() - return { - name = vi_mode_utils.get_mode_highlight_name(), - fg = vi_mode_utils.get_mode_color() - } - end - -- LuaFormatter off - local comps = { - vi_mode = { - left = { - provider = '▊', - hl = vimode_hl, - right_sep = ' ' - }, - right = { - provider = '▊', - hl = vimode_hl, - left_sep = ' ' - } - }, - file = { - info = { - provider = 'file_info', - hl = { - fg = colors.blue, - style = 'bold' - } - }, - encoding = { - provider = 'file_encoding', - left_sep = ' ', - hl = { - fg = colors.violet, - style = 'bold' - } - }, - type = { - provider = 'file_type' - }, - os = { - provider = file_osinfo, - left_sep = ' ', - hl = { - fg = colors.violet, - style = 'bold' - } - } - }, - line_percentage = { - provider = 'line_percentage', - left_sep = ' ', - hl = { - style = 'bold' - } - }, - scroll_bar = { - provider = 'scroll_bar', - left_sep = ' ', - hl = { - fg = colors.blue, - style = 'bold' - } - }, - diagnos = { - err = { - provider = diag_of(lsp_diagnostics_info, 'errs'), - left_sep = ' ', - enabled = diag_enable(lsp_diagnostics_info, 'errs'), - hl = { - fg = colors.red - } - }, - warn = { - provider = diag_of(lsp_diagnostics_info, 'warns'), - left_sep = ' ', - enabled = diag_enable(lsp_diagnostics_info, 'warns'), - hl = { - fg = colors.yellow - } - }, - info = { - provider = diag_of(lsp_diagnostics_info, 'infos'), - left_sep = ' ', - enabled = diag_enable(lsp_diagnostics_info, 'infos'), - hl = { - fg = colors.blue - } - }, - hint = { - provider = diag_of(lsp_diagnostics_info, 'hints'), - left_sep = ' ', - enabled = diag_enable(lsp_diagnostics_info, 'hints'), - hl = { - fg = colors.cyan - } - }, - }, - lsp = { - name = { - provider = 'lsp_client_names', - left_sep = ' ', - icon = icons.lsp, - hl = { - fg = colors.yellow - } - } - }, - git = { - branch = { - provider = 'git_branch', - icon = icons.git, - left_sep = ' ', - hl = { - fg = colors.violet, - style = 'bold' - }, - }, - add = { - provider = 'git_diff_added', - hl = { - fg = colors.green - } - }, - change = { - provider = 'git_diff_changed', - hl = { - fg = colors.orange - } - }, - remove = { - provider = 'git_diff_removed', - hl = { - fg = colors.red - } - } - } - } - local properties = { - force_inactive = { - filetypes = { - 'NvimTree', - 'dbui', - 'packer', - 'startify', - 'fugitive', - 'fugitiveblame' - }, - buftypes = {'terminal'}, - bufnames = {} - } - } - local components = { - left = { - active = { - comps.vi_mode.left, - comps.file.info, - comps.lsp.name, - comps.diagnos.err, - comps.diagnos.warn, - comps.diagnos.hint, - comps.diagnos.info - }, - inactive = { - comps.vi_mode.left, - comps.file.info - } - }, - mid = { - active = {}, - inactive = {} - }, - right = { - active = { - comps.git.add, - comps.git.change, - comps.git.remove, - comps.file.os, - comps.git.branch, - comps.line_percentage, - comps.scroll_bar, - comps.vi_mode.right - }, - inactive = {} - } - } - -- LuaFormatter on - require'feline'.setup { - default_bg = colors.bg, - default_fg = colors.fg, - components = components, - properties = properties, - vi_mode_colors = vi_mode_colors - } - - -- Buffeline - require('bufferline').setup {} - EOF +-- Bufferline +require('bufferline').setup {} +EOF ''; }; }