From 7cc46f0771352a1ac486df9bdeb5826712d11d33 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sat, 15 Jul 2023 17:03:48 +0100 Subject: Add new colour scheme --- vim/nvim/init.lua | 211 ++---------------------------------------------------- 1 file changed, 4 insertions(+), 207 deletions(-) (limited to 'vim/nvim/init.lua') diff --git a/vim/nvim/init.lua b/vim/nvim/init.lua index e830296..54839fb 100644 --- a/vim/nvim/init.lua +++ b/vim/nvim/init.lua @@ -1,4 +1,3 @@ - require('plugins') vim.api.nvim_exec( @@ -17,215 +16,13 @@ set expandtab set signcolumn=number let g:airline_theme='lucius' set termguicolors -colorscheme darcula-solid - +colorscheme onedark +highlight Normal guibg=NONE highlight Comment cterm=italic gui=italic ]], false) -- -local capabilities = require("cmp_nvim_lsp").default_capabilities() - --- Mappings. --- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap=true, silent=true } -vim.keymap.set('n', 'e', "TroubleToggle", opts) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(client, bufnr) - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap=true, silent=true, buffer=bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) -end - - -local lsp_flags = { - -- This is the default in Nvim 0.7+ - debounce_text_changes = 150, -} -require('lspconfig')['hls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} -require('lspconfig')['tsserver'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} -require('lspconfig')['quick_lint_js'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} -require('clangd_extensions').setup() -require('lspconfig')['pylsp'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} - -require('lspconfig')['yamlls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} -require('lspconfig')['bashls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - capabilities = capabilities, -} - -vim.diagnostic.config({ - underline = true, - signs = true, - virtual_text = false, - float = { - show_header = true, - source = 'if_many', - focusable = false, - transparent = true, - }, - update_in_insert = true, -- default to false - severity_sort = false, -- default to false -}) - -vim.api.nvim_exec([[ autocmd InsertEnter * :lua vim.diagnostic.config({virtual_text = true}) ]], false) -vim.api.nvim_exec([[ autocmd InsertLeave * :lua vim.diagnostic.config({virtual_text = false}) ]], false) -vim.api.nvim_exec([[ autocmd CursorMoved * :lua vim.diagnostic.open_float({ silent=true }) ]], false) - --- vim.api.nvim_set_hl(0, 'FloatBorder', {bg='None', fg='#FFFFFF'}) --- vim.api.nvim_set_hl(0, 'NormalFloat', {bg='#3B4252'}) --- vim.api.nvim_set_hl(0, 'TelescopeNormal', {bg='#3B4252'}) --- vim.api.nvim_set_hl(0, 'TelescopeBorder', {bg='#3B4252'}) - -local luasnip = require 'luasnip' - -local lspkind = require('lspkind') - --- nvim-cmp setup -local cmp = require 'cmp' -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol_text', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - }) - }, - window = { - documentation = cmp.config.window.bordered(), - completion = cmp.config.window.bordered(), - }, -} - -local api = require('cmp.utils.api') -local types = require('cmp.types') -local highlight = require('cmp.utils.highlight') -local autocmd = require('cmp.utils.autocmd') - -vim.api.nvim_set_hl(0, 'CmpItemAbbr', { link = 'CmpItemAbbrDefault', default = true }) -vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { link = 'CmpItemAbbrDeprecatedDefault', default = true }) -vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { link = 'CmpItemAbbrMatchDefault', default = true }) -vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'CmpItemAbbrMatchFuzzyDefault', default = true }) -vim.api.nvim_set_hl(0, 'CmpItemKind', { link = 'CmpItemKindDefault', default = true }) -vim.api.nvim_set_hl(0, 'CmpItemMenu', { link = 'CmpItemMenuDefault', default = true }) -for kind in pairs(types.lsp.CompletionItemKind) do - if type(kind) == 'string' then - local name = ('CmpItemKind%s'):format(kind) - vim.api.nvim_set_hl(0, name, { link = ('%sDefault'):format(name), default = true }) - end -end - -autocmd.subscribe('ColorScheme', function() - highlight.inherit('CmpItemAbbrDefault', 'Pmenu', { bg = 'NONE', default = false }) - highlight.inherit('CmpItemAbbrDeprecatedDefault', 'Comment', { bg = 'NONE', default = false }) - highlight.inherit('CmpItemAbbrMatchDefault', 'Pmenu', { bg = 'NONE', default = false }) - highlight.inherit('CmpItemAbbrMatchFuzzyDefault', 'Pmenu', { bg = 'NONE', default = false }) - highlight.inherit('CmpItemKindDefault', 'Special', { bg = 'NONE', default = false }) - highlight.inherit('CmpItemMenuDefault', 'Pmenu', { bg = 'NONE', default = false }) - for name in pairs(types.lsp.CompletionItemKind) do - if type(name) == 'string' then - vim.api.nvim_set_hl(0, ('CmpItemKind%sDefault'):format(name), { link = 'CmpItemKind', default = false }) - end - end -end) -autocmd.emit('ColorScheme') - - -vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - update_in_insert = true, - } -) - -local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } -for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) -end +require('keybindings') +require('config') -require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - additional_vim_regex_highlighting = { "haskell" }, - }, -} -- cgit v1.2.3-70-g09d2