diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lsp-wrapper.lua | 258 | ||||
| -rw-r--r-- | lua/lsp-wrapper.vim | 27 | ||||
| -rw-r--r-- | lua/lsp/bash-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/css-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/docker-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/graphql-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/html-ls.lua | 11 | ||||
| -rw-r--r-- | lua/lsp/javascript-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/json-ls.lua | 11 | ||||
| -rw-r--r-- | lua/lsp/lsp-config.lua | 61 | ||||
| -rw-r--r-- | lua/lsp/lsp-kind.lua | 27 | ||||
| -rw-r--r-- | lua/lsp/lua-ls.lua | 42 | ||||
| -rw-r--r-- | lua/lsp/python-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/vim-ls.lua | 3 | ||||
| -rw-r--r-- | lua/lsp/yaml-ls.lua | 3 | ||||
| -rw-r--r-- | lua/plugins/colorizer-config.lua (renamed from lua/plug-colorizer.lua) | 0 | ||||
| -rw-r--r-- | lua/plugins/compe-config.lua | 73 | ||||
| -rw-r--r-- | lua/plugins/galaxyline-config.lua (renamed from lua/nvcodeline.lua) | 0 | ||||
| -rw-r--r-- | lua/plugins/lspsaga-config.lua | 2 | ||||
| -rw-r--r-- | lua/plugins/nvimtree-config.lua | 31 | ||||
| -rw-r--r-- | lua/plugins/telescope-config.lua (renamed from lua/config-telescope.lua) | 0 | ||||
| -rw-r--r-- | lua/plugins/treesitter-config.lua (renamed from lua/treesitter.lua) | 0 | 
22 files changed, 567 insertions, 0 deletions
| diff --git a/lua/lsp-wrapper.lua b/lua/lsp-wrapper.lua new file mode 100644 index 00000000..7df60a7f --- /dev/null +++ b/lua/lsp-wrapper.lua @@ -0,0 +1,258 @@ +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 new file mode 100644 index 00000000..cd3dc165 --- /dev/null +++ b/lua/lsp-wrapper.vim @@ -0,0 +1,27 @@ +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() diff --git a/lua/lsp/bash-ls.lua b/lua/lsp/bash-ls.lua new file mode 100644 index 00000000..ae3e7d70 --- /dev/null +++ b/lua/lsp/bash-ls.lua @@ -0,0 +1,3 @@ +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup{} + diff --git a/lua/lsp/css-ls.lua b/lua/lsp/css-ls.lua new file mode 100644 index 00000000..337fd585 --- /dev/null +++ b/lua/lsp/css-ls.lua @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 00000000..32b8b946 --- /dev/null +++ b/lua/lsp/docker-ls.lua @@ -0,0 +1,3 @@ +-- npm install -g dockerfile-language-server-nodejs +require'lspconfig'.dockerls.setup{} + diff --git a/lua/lsp/graphql-ls.lua b/lua/lsp/graphql-ls.lua new file mode 100644 index 00000000..6369446d --- /dev/null +++ b/lua/lsp/graphql-ls.lua @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 00000000..b27650a6 --- /dev/null +++ b/lua/lsp/html-ls.lua @@ -0,0 +1,11 @@ +-- 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/javascript-ls.lua b/lua/lsp/javascript-ls.lua new file mode 100644 index 00000000..62ca0675 --- /dev/null +++ b/lua/lsp/javascript-ls.lua @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 00000000..474f1803 --- /dev/null +++ b/lua/lsp/json-ls.lua @@ -0,0 +1,11 @@ +-- 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 new file mode 100644 index 00000000..74b82865 --- /dev/null +++ b/lua/lsp/lsp-config.lua @@ -0,0 +1,61 @@ +-- 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', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) +--   -- buf_set_keymap('n', 'gd', ':lua vim.lsp.buf.definition()') +--   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>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) + +-- -- *vim.lsp.buf.code_action() + +--   -- 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=Pink +--   --     hi LspReferenceText cterm=bold ctermbg=red guibg=Pink +--   --     hi LspReferenceWrite cterm=bold ctermbg=red guibg=Pink +--   --     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 +-- -- 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 new file mode 100644 index 00000000..7ac3fefa --- /dev/null +++ b/lua/lsp/lsp-kind.lua @@ -0,0 +1,27 @@ +-- 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 new file mode 100644 index 00000000..95e72216 --- /dev/null +++ b/lua/lsp/lua-ls.lua @@ -0,0 +1,42 @@ +-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) +-- TODO fix for different systems and put variable for user + +-- local system_name +-- if vim.fn.has("mac") == 1 then +--   system_name = "macOS" +-- elseif vim.fn.has("unix") == 1 then +--   system_name = "Linux" +-- elseif vim.fn.has('win32') == 1 then +--   system_name = "Windows" +-- else +--   print("Unsupported system for sumneko") +-- end + +-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use +local sumneko_root_path = "/Users/chris/.config/nvim/lua-language-server" +local sumneko_binary = "/Users/chris/.config/nvim/lua-language-server/bin/macOS/lua-language-server" + +require'lspconfig'.sumneko_lua.setup { +  cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; +  settings = { +    Lua = { +      runtime = { +        -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) +        version = 'LuaJIT', +        -- Setup your lua path +        path = vim.split(package.path, ';'), +      }, +      diagnostics = { +        -- Get the language server to recognize the `vim` global +        globals = {'vim'}, +      }, +      workspace = { +        -- Make the server aware of Neovim runtime files +        library = { +          [vim.fn.expand('$VIMRUNTIME/lua')] = true, +          [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, +        }, +      }, +    }, +  }, +} diff --git a/lua/lsp/python-ls.lua b/lua/lsp/python-ls.lua new file mode 100644 index 00000000..0be71acb --- /dev/null +++ b/lua/lsp/python-ls.lua @@ -0,0 +1,3 @@ +-- npm i -g pyright +require'lspconfig'.pyright.setup{} + diff --git a/lua/lsp/vim-ls.lua b/lua/lsp/vim-ls.lua new file mode 100644 index 00000000..ac1e6e19 --- /dev/null +++ b/lua/lsp/vim-ls.lua @@ -0,0 +1,3 @@ +-- npm install -g vim-language-server +require'lspconfig'.vimls.setup{} + diff --git a/lua/lsp/yaml-ls.lua b/lua/lsp/yaml-ls.lua new file mode 100644 index 00000000..6b2de91e --- /dev/null +++ b/lua/lsp/yaml-ls.lua @@ -0,0 +1,3 @@ +-- npm install -g yaml-language-server +require'lspconfig'.yamlls.setup{} + diff --git a/lua/plug-colorizer.lua b/lua/plugins/colorizer-config.lua index e990d505..e990d505 100644 --- a/lua/plug-colorizer.lua +++ b/lua/plugins/colorizer-config.lua diff --git a/lua/plugins/compe-config.lua b/lua/plugins/compe-config.lua new file mode 100644 index 00000000..6033c0e7 --- /dev/null +++ b/lua/plugins/compe-config.lua @@ -0,0 +1,73 @@ +-- TODO we need snippet support and to maybe get better docs idk + +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; +  max_abbr_width = 100; +  max_kind_width = 100; +  max_menu_width = 100; +  documentation = false; + +  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 "<C-n>" +  -- elseif vim.fn.call("vsnip#available", {1}) == 1 then +    -- return t "<Plug>(vsnip-expand-or-jump)" +  -- elseif check_back_space() then +    -- return t "<Tab>" +  -- else +    -- return vim.fn['compe#complete']() +  -- end +-- end +_G.s_tab_complete = function() +  if vim.fn.pumvisible() == 1 then +    return t "<C-p>" +  elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then +    return t "<Plug>(vsnip-jump-prev)" +  else +    return t "<S-Tab>" +  end +end + +-- vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) diff --git a/lua/nvcodeline.lua b/lua/plugins/galaxyline-config.lua index e416b2c3..e416b2c3 100644 --- a/lua/nvcodeline.lua +++ b/lua/plugins/galaxyline-config.lua diff --git a/lua/plugins/lspsaga-config.lua b/lua/plugins/lspsaga-config.lua new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/lua/plugins/lspsaga-config.lua @@ -0,0 +1,2 @@ + + diff --git a/lua/plugins/nvimtree-config.lua b/lua/plugins/nvimtree-config.lua new file mode 100644 index 00000000..8eeec88d --- /dev/null +++ b/lua/plugins/nvimtree-config.lua @@ -0,0 +1,31 @@ +local tree_cb = require'nvim-tree.config'.nvim_tree_callback +vim.g.nvim_tree_bindings = { +	-- mappings +	["<CR>"]           = tree_cb("edit"), +	["l"]              = tree_cb("edit"), +	["o"]              = tree_cb("edit"), +	["<2-LeftMouse>"]  = tree_cb("edit"), +	["<2-RightMouse>"] = tree_cb("cd"), +	["<C-]>"]          = tree_cb("cd"), +	["v"]              = tree_cb("vsplit"), +	["s"]              = tree_cb("split"), +	["<C-t>"]          = tree_cb("tabnew"), +	["h"]              = tree_cb("close_node"), +	["<BS>"]           = tree_cb("close_node"), +	["<S-CR>"]         = tree_cb("close_node"), +	["<Tab>"]          = 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"), +	["<C-r>"]          = 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/config-telescope.lua b/lua/plugins/telescope-config.lua index d8e38ca8..d8e38ca8 100644 --- a/lua/config-telescope.lua +++ b/lua/plugins/telescope-config.lua diff --git a/lua/treesitter.lua b/lua/plugins/treesitter-config.lua index b9549a46..b9549a46 100644 --- a/lua/treesitter.lua +++ b/lua/plugins/treesitter-config.lua | 
