diff options
| author | Christian Chiarulli <[email protected]> | 2021-03-09 23:55:11 -0500 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-09 23:55:11 -0500 | 
| commit | 474f961b2a31c0fe8281188150c08cc2849bf4df (patch) | |
| tree | 8a25933cd7a63eddbcab05220d702a6ba7c7f2b6 /lua/plugins | |
| parent | 56f65b12a446fe05483a23585dd4e3104205b062 (diff) | |
Native LSP, more Lua, less CoC
Diffstat (limited to 'lua/plugins')
| -rw-r--r-- | lua/plugins/colorizer-config.lua | 15 | ||||
| -rw-r--r-- | lua/plugins/compe-config.lua | 73 | ||||
| -rw-r--r-- | lua/plugins/galaxyline-config.lua | 271 | ||||
| -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 | 76 | ||||
| -rw-r--r-- | lua/plugins/treesitter-config.lua | 33 | 
7 files changed, 501 insertions, 0 deletions
| diff --git a/lua/plugins/colorizer-config.lua b/lua/plugins/colorizer-config.lua new file mode 100644 index 00000000..e990d505 --- /dev/null +++ b/lua/plugins/colorizer-config.lua @@ -0,0 +1,15 @@ +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 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/plugins/galaxyline-config.lua b/lua/plugins/galaxyline-config.lua new file mode 100644 index 00000000..e416b2c3 --- /dev/null +++ b/lua/plugins/galaxyline-config.lua @@ -0,0 +1,271 @@ +-- 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 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/plugins/telescope-config.lua b/lua/plugins/telescope-config.lua new file mode 100644 index 00000000..d8e38ca8 --- /dev/null +++ b/lua/plugins/telescope-config.lua @@ -0,0 +1,76 @@ +local actions = require('telescope.actions') +-- Global remapping +------------------------------ +      -- '--color=never', +require('telescope').setup{ +  defaults = { +    vimgrep_arguments = { +      'rg', +      '--no-heading', +      '--with-filename', +      '--line-number', +      '--column', +      '--smart-case' +    }, +    prompt_position = "bottom", +    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 = { +      ["<C-j>"] = actions.move_selection_next, +      ["<C-k>"] = actions.move_selection_previous, +        -- To disable a keymap, put [map] = false +        -- So, to not map "<C-n>", just put +        -- ["<c-x>"] = false, + +        -- Otherwise, just set the mapping to the function that you want it to be. +        -- ["<C-i>"] = actions.select_horizontal, + +        -- Add up multiple actions +        ["<CR>"] = actions.select_default + actions.center, + +        -- You can perform as many actions in a row as you like +        -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action, +      }, +      n = { +      ["<C-j>"] = actions.move_selection_next, +      ["<C-k>"] = actions.move_selection_previous, +        -- ["<esc>"] = actions.close, +        -- ["<C-i>"] = my_cool_custom_action, +      }, +    }, +  } +} diff --git a/lua/plugins/treesitter-config.lua b/lua/plugins/treesitter-config.lua new file mode 100644 index 00000000..b9549a46 --- /dev/null +++ b/lua/plugins/treesitter-config.lua @@ -0,0 +1,33 @@ +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 +  }, +} + +require "nvim-treesitter.configs".setup { +  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 +  } +} + +-- 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", +--       }, +--     }, +--   }, +-- } + | 
