diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-12 21:22:47 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-12 21:22:47 +0100 |
commit | 7cf73775036c3424dd5e2a85effe3883cf0b0ca8 (patch) | |
tree | 61d7584b44d0c8074676bb2a1cfba00dc3a6babc /lua/plugins/config | |
parent | b42618906aad70a735ea9272403e5e2657230fcc (diff) |
Refactor the file structure
Diffstat (limited to 'lua/plugins/config')
-rw-r--r-- | lua/plugins/config/cmp.lua | 132 | ||||
-rw-r--r-- | lua/plugins/config/colorscheme.lua | 9 | ||||
-rw-r--r-- | lua/plugins/config/init.lua | 6 | ||||
-rw-r--r-- | lua/plugins/config/telescope.lua | 100 | ||||
-rw-r--r-- | lua/plugins/config/treesitter.lua | 19 |
5 files changed, 0 insertions, 266 deletions
diff --git a/lua/plugins/config/cmp.lua b/lua/plugins/config/cmp.lua deleted file mode 100644 index 27114ca..0000000 --- a/lua/plugins/config/cmp.lua +++ /dev/null @@ -1,132 +0,0 @@ --- Configuration for completion plugin. - -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end - -local snip_status_ok, luasnip = pcall(require, "luasnip") -if not snip_status_ok then - return -end - -require("luasnip/loaders/from_vscode").lazy_load() - -local check_backspace = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") -end - -local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", -} - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - ["<C-k>"] = cmp.mapping.select_prev_item(), - ["<C-j>"] = cmp.mapping.select_next_item(), - ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. - ["<C-e>"] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - ["<CR>"] = cmp.mapping.confirm({ select = true }), - ["<Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() - end - end, { - "i", - "s", - }), - ["<S-Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { - "i", - "s", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - nvim_lsp = "[LSP]", - nvim_lua = "[NVIM_LUA]", - luasnip = "[Snippet]", - buffer = "[Buffer]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }, - -- TODO: check out more sources - sources = { - { name = "nvim_lsp" }, - { name = "nvim_lua" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - experimental = { - ghost_text = false, - native_menu = false, - }, -}) diff --git a/lua/plugins/config/colorscheme.lua b/lua/plugins/config/colorscheme.lua deleted file mode 100644 index 5f0654d..0000000 --- a/lua/plugins/config/colorscheme.lua +++ /dev/null @@ -1,9 +0,0 @@ --- Neovim colorscheme. - -local colorscheme = "default" - -local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) -if not status_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return -end diff --git a/lua/plugins/config/init.lua b/lua/plugins/config/init.lua deleted file mode 100644 index bfbf750..0000000 --- a/lua/plugins/config/init.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Loads all plugin configs. - -require("plugins.config.colorscheme") -require("plugins.config.cmp") -require("plugins.config.telescope") -require("plugins.config.treesitter") diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua deleted file mode 100644 index ff65505..0000000 --- a/lua/plugins/config/telescope.lua +++ /dev/null @@ -1,100 +0,0 @@ --- Telescope a highly extendable fuzzy finder over lists. - -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -telescope.load_extension("media_files") - -local actions = require("telescope.actions") - -telescope.setup({ - defaults = { - - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - - mappings = { - i = { - ["<C-n>"] = actions.cycle_history_next, - ["<C-p>"] = actions.cycle_history_prev, - - ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous, - - ["<C-c>"] = actions.close, - - ["<Down>"] = actions.move_selection_next, - ["<Up>"] = actions.move_selection_previous, - - ["<CR>"] = actions.select_default, - ["<C-x>"] = actions.select_horizontal, - ["<C-v>"] = actions.select_vertical, - ["<C-t>"] = actions.select_tab, - - ["<C-u>"] = actions.preview_scrolling_up, - ["<C-d>"] = actions.preview_scrolling_down, - - ["<PageUp>"] = actions.results_scrolling_up, - ["<PageDown>"] = actions.results_scrolling_down, - - ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, - ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, - ["<C-q>"] = actions.send_to_qflist + actions.open_qflist, - ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, - ["<C-l>"] = actions.complete_tag, - ["<C-_>"] = actions.which_key, -- keys from pressing <C-/> - }, - - n = { - ["<esc>"] = actions.close, - ["<CR>"] = actions.select_default, - ["<C-x>"] = actions.select_horizontal, - ["<C-v>"] = actions.select_vertical, - ["<C-t>"] = actions.select_tab, - - ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, - ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, - ["<C-q>"] = actions.send_to_qflist + actions.open_qflist, - ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - ["<Down>"] = actions.move_selection_next, - ["<Up>"] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - ["<C-u>"] = actions.preview_scrolling_up, - ["<C-d>"] = actions.preview_scrolling_down, - - ["<PageUp>"] = actions.results_scrolling_up, - ["<PageDown>"] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - }, -}) diff --git a/lua/plugins/config/treesitter.lua b/lua/plugins/config/treesitter.lua deleted file mode 100644 index 8feffc9..0000000 --- a/lua/plugins/config/treesitter.lua +++ /dev/null @@ -1,19 +0,0 @@ --- Treesitter is a tool for building syntax trees for source files. --- In the neovim context it helps with better coloring. - -local status_ok, treesitter = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -treesitter.setup({ - ensure_installed = "maintained", - sync_install = false, - ignore_install = { "" }, -- List of parsers to ignore installing - highlight = { - enable = true, -- false will disable the whole extension - disable = { "" }, -- list of language that will be disabled - additional_vim_regex_highlighting = true, - }, - indent = { enable = true, disable = { "yaml" } }, -}) |