From 0dc3c5030b778d5256cad5d9529e9ecf7fbfb233 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sun, 14 Mar 2021 15:10:28 -0400 Subject: The Lua Journey Begins... --- lua/colorscheme.lua | 3 + lua/keymappings.lua | 36 +++++ lua/lsp-wrapper.lua | 254 ----------------------------------- lua/lsp-wrapper.vim | 37 ------ lua/lsp/bash-ls.lua | 3 - lua/lsp/css-ls.lua | 3 - lua/lsp/docker-ls.lua | 3 - lua/lsp/general-ls.lua | 15 --- lua/lsp/graphql-ls.lua | 3 - lua/lsp/html-ls.lua | 11 -- lua/lsp/init.lua | 0 lua/lsp/java-ls.lua | 8 -- lua/lsp/javascript-ls.lua | 3 - lua/lsp/json-ls.lua | 11 -- lua/lsp/lsp-config.lua | 61 --------- lua/lsp/lsp-kind.lua | 27 ---- lua/lsp/lua-ls.lua | 8 +- lua/lsp/python-ls.lua | 3 - lua/lsp/vim-ls.lua | 3 - lua/lsp/yaml-ls.lua | 3 - lua/nv-bufferline/init.lua | 13 ++ lua/nv-colorizer/init.lua | 12 ++ lua/nv-compe/init.lua | 73 ++++++++++ lua/nv-galaxyline/init.lua | 249 ++++++++++++++++++++++++++++++++++ lua/nv-gitsigns/init.lua | 37 ++++++ lua/nv-nvim-autopairs/init.lua | 40 ++++++ lua/nv-nvimtree/init.lua | 31 +++++ lua/nv-treesitter/init.lua | 16 +++ lua/plugins.lua | 69 ++++++++++ lua/plugins/colorizer-config.lua | 15 --- lua/plugins/compe-config.lua | 51 ------- lua/plugins/galaxyline-config.lua | 271 -------------------------------------- lua/plugins/lspsaga-config.lua | 2 - lua/plugins/nvimtree-config.lua | 31 ----- lua/plugins/telescope-config.lua | 73 ---------- lua/plugins/treesitter-config.lua | 34 ----- lua/settings.lua | 39 ++++++ 37 files changed, 622 insertions(+), 929 deletions(-) create mode 100644 lua/colorscheme.lua create mode 100644 lua/keymappings.lua delete mode 100644 lua/lsp-wrapper.lua delete mode 100644 lua/lsp-wrapper.vim delete mode 100644 lua/lsp/bash-ls.lua delete mode 100644 lua/lsp/css-ls.lua delete mode 100644 lua/lsp/docker-ls.lua delete mode 100644 lua/lsp/general-ls.lua delete mode 100644 lua/lsp/graphql-ls.lua delete mode 100644 lua/lsp/html-ls.lua create mode 100644 lua/lsp/init.lua delete mode 100644 lua/lsp/java-ls.lua delete mode 100644 lua/lsp/javascript-ls.lua delete mode 100644 lua/lsp/json-ls.lua delete mode 100644 lua/lsp/lsp-config.lua delete mode 100644 lua/lsp/lsp-kind.lua delete mode 100644 lua/lsp/python-ls.lua delete mode 100644 lua/lsp/vim-ls.lua delete mode 100644 lua/lsp/yaml-ls.lua create mode 100644 lua/nv-bufferline/init.lua create mode 100644 lua/nv-colorizer/init.lua create mode 100644 lua/nv-compe/init.lua create mode 100644 lua/nv-galaxyline/init.lua create mode 100644 lua/nv-gitsigns/init.lua create mode 100644 lua/nv-nvim-autopairs/init.lua create mode 100644 lua/nv-nvimtree/init.lua create mode 100644 lua/nv-treesitter/init.lua create mode 100644 lua/plugins.lua delete mode 100644 lua/plugins/colorizer-config.lua delete mode 100644 lua/plugins/compe-config.lua delete mode 100644 lua/plugins/galaxyline-config.lua delete mode 100644 lua/plugins/lspsaga-config.lua delete mode 100644 lua/plugins/nvimtree-config.lua delete mode 100644 lua/plugins/telescope-config.lua delete mode 100644 lua/plugins/treesitter-config.lua create mode 100644 lua/settings.lua (limited to 'lua') diff --git a/lua/colorscheme.lua b/lua/colorscheme.lua new file mode 100644 index 00000000..0090af8f --- /dev/null +++ b/lua/colorscheme.lua @@ -0,0 +1,3 @@ +vim.cmd('colorscheme nvcode') +vim.cmd('let g:nvcode_termcolors=256') +--vim.api.nvim_exec([[colorscheme nvcode]]) diff --git a/lua/keymappings.lua b/lua/keymappings.lua new file mode 100644 index 00000000..1d20f49e --- /dev/null +++ b/lua/keymappings.lua @@ -0,0 +1,36 @@ +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) +vim.g.mapleader = ' ' + +-- no hl +vim.api.nvim_set_keymap('n', 'h', ':set hlsearch!', { noremap = true, silent = true }) + +-- explorer +vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', { noremap = true, silent = true }) + + +-- better window movement +vim.api.nvim_set_keymap('n', '', 'h', { silent = true }) +vim.api.nvim_set_keymap('n', '', 'j', { silent = true }) +vim.api.nvim_set_keymap('n', '', 'k', { silent = true }) +vim.api.nvim_set_keymap('n', '', 'l', { silent = true }) + +-- better indenting +vim.api.nvim_set_keymap('v', '<', '', '>gv', { noremap = true, silent = true }) + +-- I hate escape +vim.api.nvim_set_keymap('i', 'jk', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('i', 'kj', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('i', 'jj', '', { noremap = true, silent = true }) + +-- Tab switch buffer +vim.api.nvim_set_keymap('n', '', ':bnext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':bprevious', { noremap = true, silent = true }) + +-- Move selected line / block of text in visual mode +vim.api.nvim_set_keymap('x', 'K', ':move \'<-2gv-gv\'', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('x', 'J', ':move \'>+1gv-gv\'', { noremap = true, silent = true }) + +-- TAB Complete +--vim.api.nvim_set_keymap('i', '', 'pumvisible() ? \"\\\" : \"\\\"', { noremap = true, silent = true }) + diff --git a/lua/lsp-wrapper.lua b/lua/lsp-wrapper.lua deleted file mode 100644 index 0771f1df..00000000 --- a/lua/lsp-wrapper.lua +++ /dev/null @@ -1,254 +0,0 @@ -local lsp_wrapper = {} - --- buf - -function lsp_wrapper.add_to_workspace_folder() - vim.lsp.buf.add_workspace_folder() -end - -function lsp_wrapper.clear_references() - vim.lsp.buf.clear_references() -end - -function lsp_wrapper.code_action() - vim.lsp.buf.code_action() -end - -function lsp_wrapper.declaration() - vim.lsp.buf.declaration() - vim.lsp.buf.clear_references() -end - -function lsp_wrapper.definition() - vim.lsp.buf.definition() - vim.lsp.buf.clear_references() -end - -function lsp_wrapper.document_highlight() - vim.lsp.buf.document_highlight() -end - -function lsp_wrapper.document_symbol() - vim.lsp.buf.document_symbol() -end - -function lsp_wrapper.formatting() - vim.lsp.buf.formatting() -end - -function lsp_wrapper.formatting_sync() - vim.lsp.buf.formatting_sync() -end - -function lsp_wrapper.hover() - vim.lsp.buf.hover() -end - -function lsp_wrapper.implementation() - vim.lsp.buf.implementation() -end - -function lsp_wrapper.incoming_calls() - vim.lsp.buf.incoming_calls() -end - -function lsp_wrapper.list_workspace_folders() - vim.lsp.buf.list_workspace_folders() -end - -function lsp_wrapper.outgoing_calls() - vim.lsp.buf.outgoing_calls() -end - -function lsp_wrapper.range_code_action() - vim.lsp.buf.range_code_action() -end - -function lsp_wrapper.range_formatting() - vim.lsp.buf.range_formatting() -end - -function lsp_wrapper.references() - vim.lsp.buf.references() - vim.lsp.buf.clear_references() -end - -function lsp_wrapper.remove_workspace_folder() - vim.lsp.buf.remove_workspace_folder() -end - -function lsp_wrapper.rename() - vim.lsp.buf.rename() -end - -function lsp_wrapper.signature_help() - vim.lsp.buf.signature_help() -end - -function lsp_wrapper.type_definition() - vim.lsp.buf.type_definition() -end - -function lsp_wrapper.workspace_symbol() - vim.lsp.buf.workspace_symbol() -end - --- diagnostic - -function lsp_wrapper.get_all() - vim.lsp.diagnostic.get_all() -end - -function lsp_wrapper.get_next() - vim.lsp.diagnostic.get_next() -end - -function lsp_wrapper.get_prev() - vim.lsp.diagnostic.get_prev() -end - -function lsp_wrapper.goto_next() - vim.lsp.diagnostic.goto_next() -end - -function lsp_wrapper.goto_prev() - vim.lsp.diagnostic.goto_prev() -end - -function lsp_wrapper.show_line_diagnostics() - vim.lsp.diagnostic.show_line_diagnostics() -end - --- misc - --- :lua print(vim.inspect(vim.lsp.buf_get_clients())) - --- autoformat --- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000) - -return lsp_wrapper - --- You can see more about the differences in types here: --- https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight - --- *hl-LspReferenceText* --- LspReferenceText used for highlighting "text" references --- *hl-LspReferenceRead* --- LspReferenceRead used for highlighting "read" references --- *hl-LspReferenceWrite* --- LspReferenceWrite used for highlighting "write" references - --- *lsp-highlight-diagnostics* --- All highlights defined for diagnostics begin with `LspDiagnostics` followed by --- the type of highlight (e.g., `Sign`, `Underline`, etc.) and then the Severity --- of the highlight (e.g. `Error`, `Warning`, etc.) - --- Sign, underline and virtual text highlights (by default) are linked to their --- corresponding LspDiagnosticsDefault highlight. - --- For example, the default highlighting for |hl-LspDiagnosticsSignError| is --- linked to |hl-LspDiagnosticsDefaultError|. To change the default (and --- therefore the linked highlights), use the |:highlight| command: > - --- highlight LspDiagnosticsDefaultError guifg="BrightRed" --- < - --- *hl-LspDiagnosticsDefaultError* --- LspDiagnosticsDefaultError --- Used as the base highlight group. --- Other LspDiagnostic highlights link to this by default (except Underline) - --- *hl-LspDiagnosticsDefaultWarning* --- LspDiagnosticsDefaultWarning --- Used as the base highlight group. --- Other LspDiagnostic highlights link to this by default (except Underline) - --- *hl-LspDiagnosticsDefaultInformation* --- LspDiagnosticsDefaultInformation --- Used as the base highlight group. --- Other LspDiagnostic highlights link to this by default (except Underline) - --- *hl-LspDiagnosticsDefaultHint* --- LspDiagnosticsDefaultHint --- Used as the base highlight group. --- Other LspDiagnostic highlights link to this by default (except Underline) - --- *hl-LspDiagnosticsVirtualTextError* --- LspDiagnosticsVirtualTextError --- Used for "Error" diagnostic virtual text. --- See |vim.lsp.diagnostic.set_virtual_text()| - --- *hl-LspDiagnosticsVirtualTextWarning* --- LspDiagnosticsVirtualTextWarning --- Used for "Warning" diagnostic virtual text. --- See |vim.lsp.diagnostic.set_virtual_text()| - --- *hl-LspDiagnosticsVirtualTextInformation* --- LspDiagnosticsVirtualTextInformation --- Used for "Information" diagnostic virtual text. --- See |vim.lsp.diagnostic.set_virtual_text()| - --- *hl-LspDiagnosticsVirtualTextHint* --- LspDiagnosticsVirtualTextHint --- Used for "Hint" diagnostic virtual text. --- See |vim.lsp.diagnostic.set_virtual_text()| - --- *hl-LspDiagnosticsUnderlineError* --- LspDiagnosticsUnderlineError --- Used to underline "Error" diagnostics. --- See |vim.lsp.diagnostic.set_underline()| - --- *hl-LspDiagnosticsUnderlineWarning* --- LspDiagnosticsUnderlineWarning --- Used to underline "Warning" diagnostics. --- See |vim.lsp.diagnostic.set_underline()| - --- *hl-LspDiagnosticsUnderlineInformation* --- LspDiagnosticsUnderlineInformation --- Used to underline "Information" diagnostics. --- See |vim.lsp.diagnostic.set_underline()| - --- *hl-LspDiagnosticsUnderlineHint* --- LspDiagnosticsUnderlineHint --- Used to underline "Hint" diagnostics. --- See |vim.lsp.diagnostic.set_underline()| - --- *hl-LspDiagnosticsFloatingError* --- LspDiagnosticsFloatingError --- Used to color "Error" diagnostic messages in diagnostics float. --- See |vim.lsp.diagnostic.show_line_diagnostics()| - --- *hl-LspDiagnosticsFloatingWarning* --- LspDiagnosticsFloatingWarning --- Used to color "Warning" diagnostic messages in diagnostics float. --- See |vim.lsp.diagnostic.show_line_diagnostics()| - --- *hl-LspDiagnosticsFloatingInformation* --- LspDiagnosticsFloatingInformation --- Used to color "Information" diagnostic messages in diagnostics float. --- See |vim.lsp.diagnostic.show_line_diagnostics()| - --- *hl-LspDiagnosticsFloatingHint* --- LspDiagnosticsFloatingHint --- Used to color "Hint" diagnostic messages in diagnostics float. --- See |vim.lsp.diagnostic.show_line_diagnostics()| - --- *hl-LspDiagnosticsSignError* --- LspDiagnosticsSignError --- Used for "Error" signs in sign column. --- See |vim.lsp.diagnostic.set_signs()| - --- *hl-LspDiagnosticsSignWarning* --- LspDiagnosticsSignWarning --- Used for "Warning" signs in sign column. --- See |vim.lsp.diagnostic.set_signs()| - --- *hl-LspDiagnosticsSignInformation* --- LspDiagnosticsSignInformation --- Used for "Information" signs in sign column. --- See |vim.lsp.diagnostic.set_signs()| - --- *hl-LspDiagnosticsSignHint* --- LspDiagnosticsSignHint --- Used for "Hint" signs in sign column. --- See |vim.lsp.diagnostic.set_signs()| diff --git a/lua/lsp-wrapper.vim b/lua/lsp-wrapper.vim deleted file mode 100644 index ca400bb6..00000000 --- a/lua/lsp-wrapper.vim +++ /dev/null @@ -1,37 +0,0 @@ -command! LspCodeAction lua require 'lsp-wrapper'.code_action() -command! LspDeclaration lua require 'lsp-wrapper'.declaration() -command! LspDefinition lua require 'lsp-wrapper'.definition() -command! LspDocumentSymbol lua require 'lsp-wrapper'.document_symbol() -command! LspFormatting lua require 'lsp-wrapper'.formatting() -command! LspFormattingSync lua require 'lsp-wrapper'.formatting_sync() -command! LspHover lua require 'lsp-wrapper'.hover() -command! LspImplementation lua require 'lsp-wrapper'.implementation() -command! LspRangeCodeAction lua require 'lsp-wrapper'.range_code_action() -command! LspRangeFormatting lua require 'lsp-wrapper'.range_formatting() -command! LspReferences lua require 'lsp-wrapper'.references() -command! LspRename lua require 'lsp-wrapper'.rename() -command! LspTypeDefinition lua require 'lsp-wrapper'.type_definition() -command! LspWorkspaceSymbol lua require 'lsp-wrapper'.workspace_symbol() -command! LspGotoNext lua require 'lsp-wrapper'.goto_next() -command! LspGotoPrev lua require 'lsp-wrapper'.goto_prev() -command! LspShowLineDiagnostics lua require 'lsp-wrapper'.show_line_diagnostics() -" command! LspAddToWorkspaceFolder lua require 'lsp-wrapper'.add_to_workspace_folder() -" command! LspRemoveWorkspaceFolder lua require 'lsp-wrapper'.remove_workspace_folder() -" command! LspListWorkspaceFolders lua require 'lsp-wrapper'.list_workspace_folders() -" command! LspClearReferences lua require 'lsp-wrapper'.clear_references() -" command! LspGetNext lua require 'lsp-wrapper'.get_next() -" command! LspGetPrev lua require 'lsp-wrapper'.get_prev() -" command! LspGetAll lua require 'lsp-wrapper'.get_all() -" command! LspIncomingCalls lua require 'lsp-wrapper'.incoming_calls() -" command! LspOutGoingCalls lua require 'lsp-wrapper'.outgoing_calls() -" command! LspDocumentHighlight lua require 'lsp-wrapper'.document_highlight() - -" Java - -" command! FileType java LspCodeAction lua require('jdtls').code_action(true) -" command! FileType java LspCodeAction lua require('jdtls').code_action(false, 'refactor') - -" nnoremap lua require'jdtls'.organize_imports() -" nnoremap crv lua require('jdtls').extract_variable() -" vnoremap crv lua require('jdtls').extract_variable(true) -" vnoremap crm lua require('jdtls').extract_method(true) diff --git a/lua/lsp/bash-ls.lua b/lua/lsp/bash-ls.lua deleted file mode 100644 index ae3e7d70..00000000 --- a/lua/lsp/bash-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm i -g bash-language-server -require'lspconfig'.bashls.setup{} - diff --git a/lua/lsp/css-ls.lua b/lua/lsp/css-ls.lua deleted file mode 100644 index 337fd585..00000000 --- a/lua/lsp/css-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g vscode-css-languageserver-bin -require'lspconfig'.cssls.setup{} - diff --git a/lua/lsp/docker-ls.lua b/lua/lsp/docker-ls.lua deleted file mode 100644 index 32b8b946..00000000 --- a/lua/lsp/docker-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g dockerfile-language-server-nodejs -require'lspconfig'.dockerls.setup{} - diff --git a/lua/lsp/general-ls.lua b/lua/lsp/general-ls.lua deleted file mode 100644 index fa28dbcf..00000000 --- a/lua/lsp/general-ls.lua +++ /dev/null @@ -1,15 +0,0 @@ -require"lspconfig".efm.setup { - init_options = {documentFormatting = true}, - filetypes = {"lua"}, - settings = { - rootMarkers = {".git/"}, - languages = { - lua = { - { - formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb", - formatStdin = true - } - } - } - } -} diff --git a/lua/lsp/graphql-ls.lua b/lua/lsp/graphql-ls.lua deleted file mode 100644 index 6369446d..00000000 --- a/lua/lsp/graphql-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g graphql-language-service-cli -require'lspconfig'.graphql.setup{} - diff --git a/lua/lsp/html-ls.lua b/lua/lsp/html-ls.lua deleted file mode 100644 index b27650a6..00000000 --- a/lua/lsp/html-ls.lua +++ /dev/null @@ -1,11 +0,0 @@ --- npm install -g vscode-html-languageserver-bin ---Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -require'lspconfig'.html.setup { - capabilities = capabilities, -} - - -require'lspconfig'.html.setup{} diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/lsp/java-ls.lua b/lua/lsp/java-ls.lua deleted file mode 100644 index 689b71eb..00000000 --- a/lua/lsp/java-ls.lua +++ /dev/null @@ -1,8 +0,0 @@ --- In Vimscript --- augroup lsp --- au! --- au FileType java lua require('jdtls').start_or_attach({cmd = {'java-linux-ls'}}) --- augroup end --- find_root looks for parent directories relative to the current buffer containing one of the given arguments. --- require'lspconfig'.jdtls.setup {cmd = {'java-linux-ls'}} -require('jdtls').start_or_attach({cmd = {'java-linux-ls'}, root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'})}) diff --git a/lua/lsp/javascript-ls.lua b/lua/lsp/javascript-ls.lua deleted file mode 100644 index 62ca0675..00000000 --- a/lua/lsp/javascript-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g typescript typescript-language-server -require'lspconfig'.tsserver.setup{} - diff --git a/lua/lsp/json-ls.lua b/lua/lsp/json-ls.lua deleted file mode 100644 index 474f1803..00000000 --- a/lua/lsp/json-ls.lua +++ /dev/null @@ -1,11 +0,0 @@ --- npm install -g vscode-json-languageserver -require'lspconfig'.jsonls.setup { - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0}) - end - } - } -} - diff --git a/lua/lsp/lsp-config.lua b/lua/lsp/lsp-config.lua deleted file mode 100644 index 74b82865..00000000 --- a/lua/lsp/lsp-config.lua +++ /dev/null @@ -1,61 +0,0 @@ --- 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 - --- 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()') --- 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', '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) - --- -- *vim.lsp.buf.code_action() - --- -- 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=Pink --- -- hi LspReferenceText cterm=bold ctermbg=red guibg=Pink --- -- hi LspReferenceWrite cterm=bold ctermbg=red guibg=Pink --- -- 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 --- -- and map buffer local keybindings when the language server attaches --- local servers = { "pyright", "rust_analyzer", "tsserver" } --- for _, lsp in ipairs(servers) do --- nvim_lsp[lsp].setup { on_attach = on_attach } --- end - - -vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"}) -vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) -vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) -vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) diff --git a/lua/lsp/lsp-kind.lua b/lua/lsp/lsp-kind.lua deleted file mode 100644 index 7ac3fefa..00000000 --- a/lua/lsp/lsp-kind.lua +++ /dev/null @@ -1,27 +0,0 @@ --- commented options are defaults -require('lspkind').init({ - with_text = false, - symbol_map = { - Text = '  ', - Method = '  ', - Function = '  ', - Constructor = '  ', - Variable = '[]', - Class = '  ', - Interface = ' 蘒', - Module = '  ', - Property = '  ', - Unit = ' 塞 ', - Value = '  ', - Enum = ' 練', - Keyword = '  ', - Snippet = '  ', - Color = '', - File = '', - Folder = ' ﱮ ', - EnumMember = '  ', - Constant = '  ', - Struct = '  ' - }, -}) - diff --git a/lua/lsp/lua-ls.lua b/lua/lsp/lua-ls.lua index c04219a9..c2bd79c0 100644 --- a/lua/lsp/lua-ls.lua +++ b/lua/lsp/lua-ls.lua @@ -5,11 +5,11 @@ local sumneko_root_path = "" local sumneko_binary = "" if vim.fn.has("mac") == 1 then - sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lua-language-server" - sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lua-language-server/bin/macOS/lua-language-server" + sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/ls/lua-language-server" + sumneko_binary = "/Users/" .. USER .. "/.config/nvim/ls/lua-language-server/bin/macOS/lua-language-server" elseif vim.fn.has("unix") == 1 then - sumneko_root_path = "/home/" .. USER .. "/.config/nvim/lua-language-server" - sumneko_binary = "/home/" .. USER .. "/.config/nvim/lua-language-server/bin/Linux/lua-language-server" + sumneko_root_path = "/home/" .. USER .. "/.config/nvim/ls/lua-language-server" + sumneko_binary = "/home/" .. USER .. "/.config/nvim/ls/lua-language-server/bin/Linux/lua-language-server" else print("Unsupported system for sumneko") end diff --git a/lua/lsp/python-ls.lua b/lua/lsp/python-ls.lua deleted file mode 100644 index 0be71acb..00000000 --- a/lua/lsp/python-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm i -g pyright -require'lspconfig'.pyright.setup{} - diff --git a/lua/lsp/vim-ls.lua b/lua/lsp/vim-ls.lua deleted file mode 100644 index ac1e6e19..00000000 --- a/lua/lsp/vim-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g vim-language-server -require'lspconfig'.vimls.setup{} - diff --git a/lua/lsp/yaml-ls.lua b/lua/lsp/yaml-ls.lua deleted file mode 100644 index 6b2de91e..00000000 --- a/lua/lsp/yaml-ls.lua +++ /dev/null @@ -1,3 +0,0 @@ --- npm install -g yaml-language-server -require'lspconfig'.yamlls.setup{} - diff --git a/lua/nv-bufferline/init.lua b/lua/nv-bufferline/init.lua new file mode 100644 index 00000000..760bb517 --- /dev/null +++ b/lua/nv-bufferline/init.lua @@ -0,0 +1,13 @@ +require'bufferline'.setup{} +vim.api.nvim_set_keymap('n', '', ':BufferLineCycleNext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':BufferLineCyclePrev', { noremap = true, silent = true }) + + +--" These commands will move the current buffer backwards or forwards in the bufferline +--nnoremap :BufferLineMoveNext +--nnoremap :BufferLineMovePrev + +--" These commands will sort buffers by directory, language, or a custom criteria +--nnoremap be :BufferLineSortByExtension +--nnoremap bd :BufferLineSortByDirectory +--nnoremap :lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end) diff --git a/lua/nv-colorizer/init.lua b/lua/nv-colorizer/init.lua new file mode 100644 index 00000000..1b22f7f7 --- /dev/null +++ b/lua/nv-colorizer/init.lua @@ -0,0 +1,12 @@ +require'colorizer'.setup( + {'*';}, + { + RGB = true; -- #RGB hex codes + RRGGBB = true; -- #RRGGBB hex codes + -- names = true; -- "Name" codes like Blue + RRGGBBAA = true; -- #RRGGBBAA hex codes + rgb_fn = true; -- CSS rgb() and rgba() functions + hsl_fn = true; -- CSS hsl() and hsla() functions + css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn + }) diff --git a/lua/nv-compe/init.lua b/lua/nv-compe/init.lua new file mode 100644 index 00000000..4dcfe26a --- /dev/null +++ b/lua/nv-compe/init.lua @@ -0,0 +1,73 @@ +require'compe'.setup { + enabled = true; + autocomplete = true; + debug = false; + min_length = 1; + preselect = 'enable'; + throttle_time = 80; + source_timeout = 200; + incomplete_delay = 400; + max_abbr_width = 100; + max_kind_width = 100; + max_menu_width = 100; + documentation = true; + + source = { + path = true; + buffer = true; + calc = true; + vsnip = true; + nvim_lsp = true; + nvim_lua = true; + spell = true; + tags = true; + snippets_nvim = true; + treesitter = true; + }; +} + + + + + +local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +local check_back_space = function() + local col = vim.fn.col('.') - 1 + if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + return true + else + return false + end +end + +-- Use (s-)tab to: +--- move to prev/next item in completion menuone +--- jump to prev/next snippet's placeholder +_G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#available", {1}) == 1 then + return t "(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "" + else + return vim.fn['compe#complete']() + end +end +_G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + return t "" + end +end + +vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) diff --git a/lua/nv-galaxyline/init.lua b/lua/nv-galaxyline/init.lua new file mode 100644 index 00000000..79cf2af0 --- /dev/null +++ b/lua/nv-galaxyline/init.lua @@ -0,0 +1,249 @@ +-- require'nvim-web-devicons'.setup() + +local gl = require('galaxyline') +local gls = gl.section +gl.short_line_list = {'LuaTree','vista','dbui'} + +local colors = { + bg = '#282c34', + yellow = '#fabd2f', + cyan = '#008080', + darkblue = '#081633', + green = '#608B4E', + orange = '#FF8800', + purple = '#5d4d7a', + magenta = '#d16d9e', + grey = '#c0c0c0', + blue = '#569CD6', + red = '#D16969' +} + +local buffer_not_empty = function() + if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then + return true + end + return false +end + +-- gls.left[1] = { +-- FirstElement = { +-- -- provider = function() return '▋' end, +-- provider = function() return ' ' end, +-- highlight = {colors.bg,colors.bg} +-- }, +-- } +-- gls.left[2] = { +-- ViMode = { +-- provider = function() +-- local alias = {n = 'NORMAL',i = 'INSERT',c= 'COMMAND',V= 'VISUAL', [''] = 'VISUAL'} +-- return alias[vim.fn.mode()] +-- end, +-- separator = ' ', +-- separator_highlight = {colors.yellow,function() +-- if not buffer_not_empty() then +-- return colors.purple +-- end +-- return colors.purple +-- end}, +-- highlight = {colors.grey,colors.purple,'bold'}, +-- }, +-- } +gls.left[2] = { + ViMode = { + provider = function() + -- auto change color according the vim mode + local mode_color = {n = colors.purple, + i = colors.green, + v = colors.blue, + [''] = colors.blue, + V = colors.blue, + c = colors.purple, + no = colors.magenta, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.red, + cv = colors.red, + ce=colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red} + vim.api.nvim_command('hi GalaxyViMode guibg='..mode_color[vim.fn.mode()]) + return ' NVCode ' + end, + separator = ' ', + separator_highlight = {colors.yellow,function() + if not buffer_not_empty() then + return colors.bg + end + return colors.bg + end}, + highlight = {colors.grey,colors.bg,'bold'}, + }, +} +-- gls.left[3] ={ +-- FileIcon = { +-- separator = ' ', +-- provider = 'FileIcon', +-- condition = buffer_not_empty, +-- highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg}, +-- }, +-- } +-- gls.left[4] = { +-- FileName = { +-- provider = {'FileSize'}, +-- condition = buffer_not_empty, +-- separator = ' ', +-- separator_highlight = {colors.purple,colors.bg}, +-- highlight = {colors.magenta,colors.bg} +-- } +-- } + +gls.left[3] = { + GitIcon = { + provider = function() return ' ' end, + condition = buffer_not_empty, + highlight = {colors.orange,colors.bg}, + } +} +gls.left[4] = { + GitBranch = { + provider = 'GitBranch', + separator = ' ', + separator_highlight = {colors.purple,colors.bg}, + condition = buffer_not_empty, + highlight = {colors.grey,colors.bg}, + } +} + +local checkwidth = function() + local squeeze_width = vim.fn.winwidth(0) / 2 + if squeeze_width > 40 then + return true + end + return false +end + +gls.left[5] = { + DiffAdd = { + provider = 'DiffAdd', + condition = checkwidth, + -- separator = ' ', + -- separator_highlight = {colors.purple,colors.bg}, + icon = '  ', + highlight = {colors.green,colors.bg}, + } +} +gls.left[6] = { + DiffModified = { + provider = 'DiffModified', + condition = checkwidth, + -- separator = ' ', + -- separator_highlight = {colors.purple,colors.bg}, + icon = '  ', + highlight = {colors.blue,colors.bg}, + } +} +gls.left[7] = { + DiffRemove = { + provider = 'DiffRemove', + condition = checkwidth, + -- separator = ' ', + -- separator_highlight = {colors.purple,colors.bg}, + icon = '  ', + highlight = {colors.red,colors.bg}, + } +} +gls.left[8] = { + LeftEnd = { + provider = function() return ' ' end, + separator = ' ', + separator_highlight = {colors.purple,colors.bg}, + highlight = {colors.purple,colors.bg} + } +} +gls.left[9] = { + DiagnosticError = { + provider = 'DiagnosticError', + icon = '  ', + highlight = {colors.red,colors.bg} + } +} +gls.left[10] = { + Space = { + provider = function () return '' end + } +} +gls.left[11] = { + DiagnosticWarn = { + provider = 'DiagnosticWarn', + icon = '  ', + highlight = {colors.yellow,colors.bg}, + } +} +gls.left[12] = { + DiagnosticHint = { + provider = 'DiagnosticHint', + icon = '  ', + highlight = {colors.blue,colors.bg}, + } +} +gls.left[13] = { + DiagnosticInfo = { + provider = 'DiagnosticInfo', + icon = '  ', + highlight = {colors.orange,colors.bg}, + } +} +gls.right[1]= { + FileFormat = { + provider = 'FileFormat', + separator = ' ', + separator_highlight = {colors.bg,colors.bg}, + highlight = {colors.grey,colors.bg}, + } +} +gls.right[2] = { + LineInfo = { + provider = 'LineColumn', + separator = ' | ', + separator_highlight = {colors.darkblue,colors.bg}, + highlight = {colors.grey,colors.bg}, + }, +} +gls.right[3] = { + PerCent = { + provider = 'LinePercent', + separator = ' |', + separator_highlight = {colors.darkblue,colors.bg}, + highlight = {colors.grey,colors.bg}, + } +} +gls.right[4] = { + ScrollBar = { + provider = 'ScrollBar', + highlight = {colors.yellow,colors.purple}, + } +} + +-- gls.short_line_left[1] = { +-- BufferType = { +-- provider = 'FileTypeName', +-- separator = ' ', +-- separator_highlight = {colors.purple,colors.bg}, +-- highlight = {colors.grey,colors.purple} +-- } +-- } + +gls.short_line_left[1] = { + LeftEnd = { + provider = function() return ' ' end, + separator = ' ', + separator_highlight = {colors.purple,colors.bg}, + highlight = {colors.purple,colors.bg} + } +} diff --git a/lua/nv-gitsigns/init.lua b/lua/nv-gitsigns/init.lua new file mode 100644 index 00000000..7d183247 --- /dev/null +++ b/lua/nv-gitsigns/init.lua @@ -0,0 +1,37 @@ +require('gitsigns').setup { + signs = { + -- TODO add hl to colorscheme + add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hb'] = 'lua require"gitsigns".blame_line()', + + -- Text objects + ['o ih'] = ':lua require"gitsigns".text_object()', + ['x ih'] = ':lua require"gitsigns".text_object()' + }, + watch_index = { + interval = 1000 + }, + sign_priority = 6, + update_debounce = 200, + status_formatter = nil, -- Use default + use_decoration_api = false +} diff --git a/lua/nv-nvim-autopairs/init.lua b/lua/nv-nvim-autopairs/init.lua new file mode 100644 index 00000000..6810a774 --- /dev/null +++ b/lua/nv-nvim-autopairs/init.lua @@ -0,0 +1,40 @@ +require('nvim-autopairs').setup() + +local pairs_map = { + ["'"] = "'", + ['"'] = '"', + ['('] = ')', + ['['] = ']', + ['{'] = '}', + ['`'] = '`', +} +local disable_filetype = { "TelescopePrompt" } +local break_line_filetype = nil -- mean all file type +local html_break_line_filetype = {'html' , 'vue' , 'typescriptreact' , 'svelte' , 'javascriptreact'} +local ignored_next_char = "%w" + +local remap = vim.api.nvim_set_keymap +local npairs = require('nvim-autopairs') + +-- skip it, if you use another global object +_G.MUtils= {} + +vim.g.completion_confirm_key = "" +MUtils.completion_confirm=function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + vim.fn["compe#confirm"]() + return npairs.esc("") + else + vim.defer_fn(function() + vim.fn["compe#confirm"]("") + end, 20) + return npairs.esc("") + end + else + return npairs.check_break_line_char() + end +end + + +remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) diff --git a/lua/nv-nvimtree/init.lua b/lua/nv-nvimtree/init.lua new file mode 100644 index 00000000..3803765a --- /dev/null +++ b/lua/nv-nvimtree/init.lua @@ -0,0 +1,31 @@ +local tree_cb = require'nvim-tree.config'.nvim_tree_callback +vim.g.nvim_tree_bindings = { + -- mappings + [""] = tree_cb("edit"), + ["l"] = tree_cb("edit"), + ["o"] = tree_cb("edit"), + ["<2-LeftMouse>"] = tree_cb("edit"), + ["<2-RightMouse>"] = tree_cb("cd"), + [""] = tree_cb("cd"), + ["v"] = tree_cb("vsplit"), + ["s"] = tree_cb("split"), + [""] = tree_cb("tabnew"), + ["h"] = tree_cb("close_node"), + [""] = tree_cb("close_node"), + [""] = tree_cb("close_node"), + [""] = tree_cb("preview"), + ["I"] = tree_cb("toggle_ignored"), + ["H"] = tree_cb("toggle_dotfiles"), + ["R"] = tree_cb("refresh"), + ["a"] = tree_cb("create"), + ["d"] = tree_cb("remove"), + ["r"] = tree_cb("rename"), + [""] = tree_cb("full_rename"), + ["x"] = tree_cb("cut"), + ["c"] = tree_cb("copy"), + ["p"] = tree_cb("paste"), + ["[c"] = tree_cb("prev_git_item"), + ["]c"] = tree_cb("next_git_item"), + ["-"] = tree_cb("dir_up"), + ["q"] = tree_cb("close") +} diff --git a/lua/nv-treesitter/init.lua b/lua/nv-treesitter/init.lua new file mode 100644 index 00000000..f0ecf6ac --- /dev/null +++ b/lua/nv-treesitter/init.lua @@ -0,0 +1,16 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + }, + playground = { + enable = true, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false -- Whether the query persists across vim sessions + }, + rainbow = { + enable = false + } +} + diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 00000000..4830dfd2 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,69 @@ +local execute = vim.api.nvim_command +local fn = vim.fn + +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + + +if fn.empty(fn.glob(install_path)) > 0 then + execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) + execute 'packadd packer.nvim' +end + + +return require('packer').startup(function() + -- Packer can manage itself as an optional plugin + use {'wbthomason/packer.nvim', opt = true} + + -- Information + use 'nanotee/nvim-lua-guide' + + -- LSP + use 'neovim/nvim-lspconfig' + use 'glepnir/lspsaga.nvim' + use 'onsails/lspkind-nvim' + use 'kosayoda/nvim-lightbulb' + use 'mfussenegger/nvim-jdtls' + + -- Debugging + use 'mfussenegger/nvim-dap' + + -- Autocomplete + use 'hrsh7th/nvim-compe' + use 'hrsh7th/vim-vsnip' + + -- Treesitter + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + use 'nvim-treesitter/playground' + use 'p00f/nvim-ts-rainbow' + + -- Icons + use 'kyazdani42/nvim-web-devicons' + + -- Status Line and Bufferline + use 'glepnir/galaxyline.nvim' + use {'akinsho/nvim-bufferline.lua', requires = 'kyazdani42/nvim-web-devicons'} + + -- Telescope + use 'nvim-lua/popup.nvim' + use 'nvim-lua/plenary.nvim' + use 'nvim-telescope/telescope.nvim' + use 'nvim-telescope/telescope-media-files.nvim' + + -- Explorer + use 'kyazdani42/nvim-tree.lua' + + + -- Color + use 'christianchiarulli/nvcode-color-schemes.vim' + use 'norcalli/nvim-colorizer.lua' + + -- Git + use 'TimUntersberger/neogit' + use {'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } + + -- General Plugins + use 'windwp/nvim-autopairs' + use 'kevinhwang91/nvim-bqf' + use 'unblevable/quick-scope' + use 'airblade/vim-rooter' +end) diff --git a/lua/plugins/colorizer-config.lua b/lua/plugins/colorizer-config.lua deleted file mode 100644 index e990d505..00000000 --- a/lua/plugins/colorizer-config.lua +++ /dev/null @@ -1,15 +0,0 @@ -require'colorizer'.setup( - {'*';}, - { - RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - -- names = true; -- "Name" codes like Blue - RRGGBBAA = true; -- #RRGGBBAA hex codes - rgb_fn = true; -- CSS rgb() and rgba() functions - hsl_fn = true; -- CSS hsl() and hsla() functions - css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn - }) - - - diff --git a/lua/plugins/compe-config.lua b/lua/plugins/compe-config.lua deleted file mode 100644 index 75630c6d..00000000 --- a/lua/plugins/compe-config.lua +++ /dev/null @@ -1,51 +0,0 @@ --- TODO we need snippet support and to maybe get better docs idk - - -vim.cmd [[set shortmess+=c]] -vim.o.completeopt = "menuone,noselect" - -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - incomplete_delay = 400; - allow_prefix_unmatch = false; - max_abbr_width = 1000; - max_kind_width = 1000; - max_menu_width = 1000000; - documentation = true; - - source = { - path = true; - buffer = true; - calc = true; - vsnip = true; - nvim_lsp = true; - nvim_lua = true; - spell = true; - tags = true; - snippets_nvim = true; - treesitter = true; - }; -} - -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end -_G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "(vsnip-jump-prev)" - else - return t "" - end -end - -vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) diff --git a/lua/plugins/galaxyline-config.lua b/lua/plugins/galaxyline-config.lua deleted file mode 100644 index e416b2c3..00000000 --- a/lua/plugins/galaxyline-config.lua +++ /dev/null @@ -1,271 +0,0 @@ --- require'nvim-web-devicons'.setup() - -local gl = require('galaxyline') -local gls = gl.section -gl.short_line_list = {'LuaTree','vista','dbui'} - -local colors = { - bg = '#282c34', - yellow = '#fabd2f', - cyan = '#008080', - darkblue = '#081633', - green = '#608B4E', - orange = '#FF8800', - purple = '#5d4d7a', - magenta = '#d16d9e', - grey = '#c0c0c0', - blue = '#569CD6', - red = '#D16969' -} - -local buffer_not_empty = function() - if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then - return true - end - return false -end - --- gls.left[1] = { --- FirstElement = { --- -- provider = function() return '▋' end, --- provider = function() return ' ' end, --- highlight = {colors.bg,colors.bg} --- }, --- } --- gls.left[2] = { --- ViMode = { --- provider = function() --- local alias = {n = 'NORMAL',i = 'INSERT',c= 'COMMAND',V= 'VISUAL', [''] = 'VISUAL'} --- return alias[vim.fn.mode()] --- end, --- separator = ' ', --- separator_highlight = {colors.yellow,function() --- if not buffer_not_empty() then --- return colors.purple --- end --- return colors.purple --- end}, --- highlight = {colors.grey,colors.purple,'bold'}, --- }, --- } -gls.left[2] = { - ViMode = { - provider = function() - -- auto change color according the vim mode - local mode_color = {n = colors.purple, - i = colors.green, - v = colors.blue, - [''] = colors.blue, - V = colors.blue, - c = colors.purple, - no = colors.magenta, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.red, - Rv = colors.red, - cv = colors.red, - ce=colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red} - vim.api.nvim_command('hi GalaxyViMode guibg='..mode_color[vim.fn.mode()]) - return ' NVCode ' - end, - separator = ' ', - separator_highlight = {colors.yellow,function() - if not buffer_not_empty() then - return colors.bg - end - return colors.bg - end}, - highlight = {colors.grey,colors.bg,'bold'}, - }, -} --- gls.left[3] ={ --- FileIcon = { --- separator = ' ', --- provider = 'FileIcon', --- condition = buffer_not_empty, --- highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg}, --- }, --- } --- gls.left[4] = { --- FileName = { --- provider = {'FileSize'}, --- condition = buffer_not_empty, --- separator = ' ', --- separator_highlight = {colors.purple,colors.bg}, --- highlight = {colors.magenta,colors.bg} --- } --- } - -gls.left[3] = { - GitIcon = { - provider = function() return ' ' end, - condition = buffer_not_empty, - highlight = {colors.orange,colors.bg}, - } -} -gls.left[4] = { - GitBranch = { - provider = 'GitBranch', - separator = ' ', - separator_highlight = {colors.purple,colors.bg}, - condition = buffer_not_empty, - highlight = {colors.grey,colors.bg}, - } -} - -local checkwidth = function() - local squeeze_width = vim.fn.winwidth(0) / 2 - if squeeze_width > 40 then - return true - end - return false -end - -gls.left[5] = { - DiffAdd = { - provider = 'DiffAdd', - condition = checkwidth, - -- separator = ' ', - -- separator_highlight = {colors.purple,colors.bg}, - icon = '  ', - highlight = {colors.green,colors.bg}, - } -} -gls.left[6] = { - DiffModified = { - provider = 'DiffModified', - condition = checkwidth, - -- separator = ' ', - -- separator_highlight = {colors.purple,colors.bg}, - icon = '  ', - highlight = {colors.blue,colors.bg}, - } -} -gls.left[7] = { - DiffRemove = { - provider = 'DiffRemove', - condition = checkwidth, - -- separator = ' ', - -- separator_highlight = {colors.purple,colors.bg}, - icon = '  ', - highlight = {colors.red,colors.bg}, - } -} -gls.left[8] = { - LeftEnd = { - provider = function() return ' ' end, - separator = ' ', - separator_highlight = {colors.purple,colors.bg}, - highlight = {colors.purple,colors.bg} - } -} -gls.left[9] = { - DiagnosticError = { - provider = 'DiagnosticError', - icon = '  ', - highlight = {colors.red,colors.bg} - } -} -gls.left[10] = { - Space = { - provider = function () return '' end - } -} -gls.left[11] = { - DiagnosticWarn = { - provider = 'DiagnosticWarn', - icon = '  ', - highlight = {colors.yellow,colors.bg}, - } -} -gls.left[12] = { - DiagnosticHint = { - provider = 'DiagnosticHint', - icon = '  ', - highlight = {colors.blue,colors.bg}, - } -} -gls.left[13] = { - DiagnosticInfo = { - provider = 'DiagnosticInfo', - icon = '  ', - highlight = {colors.orange,colors.bg}, - } -} -gls.right[1]= { - FileFormat = { - provider = 'FileFormat', - separator = ' ', - separator_highlight = {colors.bg,colors.bg}, - highlight = {colors.grey,colors.bg}, - } -} -gls.right[2] = { - LineInfo = { - provider = 'LineColumn', - separator = ' | ', - separator_highlight = {colors.darkblue,colors.bg}, - highlight = {colors.grey,colors.bg}, - }, -} -gls.right[3] = { - PerCent = { - provider = 'LinePercent', - separator = ' |', - separator_highlight = {colors.darkblue,colors.bg}, - highlight = {colors.grey,colors.bg}, - } -} -gls.right[4] = { - ScrollBar = { - provider = 'ScrollBar', - highlight = {colors.yellow,colors.purple}, - } -} - --- gls.short_line_left[1] = { --- BufferType = { --- provider = 'FileTypeName', --- separator = ' ', --- separator_highlight = {colors.purple,colors.bg}, --- highlight = {colors.grey,colors.purple} --- } --- } - -gls.short_line_left[1] = { - LeftEnd = { - provider = function() return ' ' end, - separator = ' ', - separator_highlight = {colors.purple,colors.bg}, - highlight = {colors.purple,colors.bg} - } -} - --- gls.short_line_right[1] = { --- BufferIcon = { --- provider= 'BufferIcon', --- separator = ' ', --- separator_highlight = {colors.purple,colors.bg}, --- highlight = {colors.grey,colors.purple} --- } --- } --- function! s:my_bookmark_color() abort --- let s:scl_guibg = matchstr(execute('hi SignColumn'), 'guibg=\zs\S*') --- if empty(s:scl_guibg) --- let s:scl_guibg = 'NONE' --- endif --- exe 'hi MyBookmarkSign guifg=' . s:scl_guibg --- endfunction --- call s:my_bookmark_color() " don't remove this line! - --- augroup UserGitSignColumnColor --- autocmd! --- autocmd ColorScheme * call s:my_bookmark_color() --- augroup END diff --git a/lua/plugins/lspsaga-config.lua b/lua/plugins/lspsaga-config.lua deleted file mode 100644 index 139597f9..00000000 --- a/lua/plugins/lspsaga-config.lua +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/lua/plugins/nvimtree-config.lua b/lua/plugins/nvimtree-config.lua deleted file mode 100644 index 3803765a..00000000 --- a/lua/plugins/nvimtree-config.lua +++ /dev/null @@ -1,31 +0,0 @@ -local tree_cb = require'nvim-tree.config'.nvim_tree_callback -vim.g.nvim_tree_bindings = { - -- mappings - [""] = tree_cb("edit"), - ["l"] = tree_cb("edit"), - ["o"] = tree_cb("edit"), - ["<2-LeftMouse>"] = tree_cb("edit"), - ["<2-RightMouse>"] = tree_cb("cd"), - [""] = tree_cb("cd"), - ["v"] = tree_cb("vsplit"), - ["s"] = tree_cb("split"), - [""] = tree_cb("tabnew"), - ["h"] = tree_cb("close_node"), - [""] = tree_cb("close_node"), - [""] = tree_cb("close_node"), - [""] = tree_cb("preview"), - ["I"] = tree_cb("toggle_ignored"), - ["H"] = tree_cb("toggle_dotfiles"), - ["R"] = tree_cb("refresh"), - ["a"] = tree_cb("create"), - ["d"] = tree_cb("remove"), - ["r"] = tree_cb("rename"), - [""] = tree_cb("full_rename"), - ["x"] = tree_cb("cut"), - ["c"] = tree_cb("copy"), - ["p"] = tree_cb("paste"), - ["[c"] = tree_cb("prev_git_item"), - ["]c"] = tree_cb("next_git_item"), - ["-"] = tree_cb("dir_up"), - ["q"] = tree_cb("close") -} diff --git a/lua/plugins/telescope-config.lua b/lua/plugins/telescope-config.lua deleted file mode 100644 index c9ea4b90..00000000 --- a/lua/plugins/telescope-config.lua +++ /dev/null @@ -1,73 +0,0 @@ -local actions = require('telescope.actions') --- Global remapping ------------------------------- --- '--color=never', -require('telescope').load_extension('media_files') -require('telescope').setup { - defaults = { - vimgrep_arguments = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, - prompt_position = "top", - prompt_prefix = " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "descending", - layout_strategy = "horizontal", - layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - file_ignore_patterns = {}, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - shorten_path = true, - winblend = 0, - width = 0.75, - preview_cutoff = 120, - results_height = 1, - results_width = 0.8, - border = {}, - borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, - color_devicons = true, - use_less = true, - set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - -- To disable a keymap, put [map] = false - -- So, to not map "", just put - -- [""] = false, - - -- Otherwise, just set the mapping to the function that you want it to be. - -- [""] = actions.select_horizontal, - - -- Add up multiple actions - [""] = actions.select_default + actions.center - - -- You can perform as many actions in a row as you like - -- [""] = actions.select_default + actions.center + my_cool_custom_action, - }, - n = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous - -- [""] = actions.close, - -- [""] = my_cool_custom_action, - } - } - }, - require'telescope'.setup { - extensions = { - media_files = { - -- filetypes whitelist - -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} - filetypes = {"png", "webp", "jpg", "jpeg"}, - find_cmd = "rg" -- find command (defaults to `fd`) - } - } - } -} diff --git a/lua/plugins/treesitter-config.lua b/lua/plugins/treesitter-config.lua deleted file mode 100644 index 30b65d82..00000000 --- a/lua/plugins/treesitter-config.lua +++ /dev/null @@ -1,34 +0,0 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - highlight = { - enable = true, -- false will disable the whole extension - }, - playground = { - enable = true, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false -- Whether the query persists across vim sessions - }, - rainbow = { - enable = false - } -} - - --- require'nvim-treesitter.configs'.setup { --- refactor = { --- highlight_current_scope = { enable = false }, --- }, --- } - --- require'nvim-treesitter.configs'.setup { --- refactor = { --- smart_rename = { --- enable = true, --- keymaps = { --- smart_rename = "grr", --- }, --- }, --- }, --- } - diff --git a/lua/settings.lua b/lua/settings.lua new file mode 100644 index 00000000..fbf24713 --- /dev/null +++ b/lua/settings.lua @@ -0,0 +1,39 @@ +--vim.o.iskeyword="+=-" --treat dash separated words as a word text object" +--vim.o.shortmess="c" --Don't pass messages to |ins-completion-menu|. + +--vim.o.formatoptions="cro" --Stop newline continution of comments +vim.o.hidden=true --Required to keep multiple buffers open multiple buffers +vim.o.wrap=false --Display long lines as just one line +--vim.o.whichwrap="+=<,>,[,],h,l" +vim.o.encoding="utf-8" --The encoding displayed +vim.o.pumheight=10 --Makes popup menu smaller +vim.o.fileencoding="utf-8" --The encoding written to file +vim.o.ruler=true -- " Show the cursor position all the time +vim.o.cmdheight=2 --More space for displaying messages +vim.o.mouse="a" --Enable your mouse +vim.o.splitbelow=true --Horizontal splits will automatically be below +vim.o.termguicolors=true +vim.o.splitright=true --Vertical splits will automatically be to the right +vim.o.t_Co="256" --Support 256 colors +vim.o.conceallevel=0 --So that I can see `` in markdown files +vim.o.tabstop=2 --Insert 2 spaces for a tab +vim.o.shiftwidth=2 --Change the number of space characters inserted for indentation +vim.o.smarttab=true --Makes tabbing smarter will realize you have 2 vs 4 +vim.o.expandtab=true --Converts tabs to spaces +vim.o.smartindent=true --Makes indenting smart +vim.o.autoindent=true --Good auto indent +vim.o.laststatus=2 --Always display the status line +--vim.o.number=true --Line numbers +vim.wo.number = true +vim.o.cursorline=true --Enable highlighting of the current line +vim.o.background="dark" --tell vim what the background color looks like +vim.o.showtabline=2 --Always show tabs +vim.o.showmode=false --We don't need to see things like -- INSERT -- anymore +vim.o.backup=false --This is recommended by coc +vim.o.writebackup=false --This is recommended by coc +vim.o.signcolumn="yes" --Always show the signcolumn, otherwise it would shift the text each time +vim.o.updatetime=300 --Faster completion +vim.o.timeoutlen=1000 --By default timeoutlen is 1000 ms +vim.o.clipboard="unnamedplus" --Copy paste between vim and everything else +vim.o.incsearch=true +vim.o.guifont="JetBrainsMono\\ Nerd\\ Font\\ Mono:h18" -- cgit v1.2.3