-
-
Save cj/e3d62f432729ee7d9df4669e102d6515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local M = {} | |
local actions = require "telescope.actions" | |
M.lspinstaller = { | |
automatic_installation = { exclude = { "solargraph", "tsserver" } }, | |
} | |
local signs = { Error = "", Warn = "", Hint = "", Info = "" } | |
-- vim.o.completeopt = "menu,menuone,noselect" | |
-- local cmp = require "cmp" | |
-- | |
-- local has_words_before = function() | |
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0)) | |
-- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil | |
-- end | |
M.cmp = { | |
-- mapping = { | |
-- ["<C-p>"] = cmp.mapping.select_prev_item(), | |
-- ["<C-n>"] = cmp.mapping.select_next_item(), | |
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4), | |
-- ["<C-f>"] = cmp.mapping.scroll_docs(4), | |
-- ["<C-Space>"] = cmp.mapping.complete(), | |
-- ["<C-e>"] = cmp.mapping.close(), | |
-- ["<CR>"] = cmp.mapping.confirm { | |
-- behavior = cmp.ConfirmBehavior.Insert, | |
-- select = true, | |
-- }, | |
-- ["<Tab>"] = cmp.mapping(function(fallback) | |
-- if cmp.visible() then | |
-- cmp.select_next_item() | |
-- elseif has_words_before() then | |
-- cmp.complete() | |
-- elseif require("luasnip").expand_or_jumpable() then | |
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "") | |
-- else | |
-- fallback() | |
-- end | |
-- end, { | |
-- "i", | |
-- "s", | |
-- }), | |
-- ["<S-Tab>"] = cmp.mapping(function(fallback) | |
-- if cmp.visible() then | |
-- cmp.select_prev_item() | |
-- elseif has_words_before() then | |
-- cmp.complete() | |
-- elseif require("luasnip").jumpable(-1) then | |
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "") | |
-- else | |
-- fallback() | |
-- end | |
-- end, { | |
-- "i", | |
-- "s", | |
-- }), | |
-- }, | |
formatting = { | |
format = function(entry, vim_item) | |
local icons = require "plugins.configs.lspkind_icons" | |
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) | |
vim_item.menu = ({ | |
nvim_lsp = "[LSP]", | |
nvim_lua = "[Lua]", | |
cmp_tabnine = "[TN]", | |
copilot = "[CP]", | |
buffer = "[BUF]", | |
})[entry.source.name] | |
return vim_item | |
end, | |
}, | |
sources = { | |
{ name = "nvim_lsp" }, | |
{ name = "luasnip" }, | |
{ name = "buffer" }, | |
{ name = "nvim_lua" }, | |
{ name = "path" }, | |
{ name = "cmp_tabnine" }, | |
{ name = "copilot", priority = 99999 }, | |
}, | |
} | |
M.treesitter = { | |
ensure_installed = { | |
"vim", | |
"html", | |
"css", | |
"javascript", | |
"javascript", | |
"json", | |
"toml", | |
"markdown", | |
"c", | |
"bash", | |
"lua", | |
}, | |
highlight = { | |
enable = true, | |
use_languagetree = true, | |
}, | |
matchup = { | |
enable = true, -- mandatory, false will disable the whole extension | |
disable = { "json" }, | |
}, | |
autotag = { | |
enable = true, | |
}, | |
context_commentstring = { | |
enable = true, | |
enable_autocmd = false, | |
}, | |
} | |
M.indent = { | |
char = "│", | |
space_char_blankline = " ", | |
show_first_indent_level = true, | |
filetype_exclude = { | |
"startify", | |
"dashboard", | |
"dotooagenda", | |
"log", | |
"fugitive", | |
"gitcommit", | |
"packer", | |
"vimwiki", | |
"markdown", | |
"txt", | |
"vista", | |
"help", | |
"todoist", | |
"NvimTree", | |
"peekaboo", | |
"git", | |
"TelescopePrompt", | |
"undotree", | |
"flutterToolsOutline", | |
"", -- for all buffers without a file type | |
}, | |
buftype_exclude = { "terminal", "nofile" }, | |
show_trailing_blankline_indent = false, | |
show_current_context = true, | |
context_patterns = { | |
"class", | |
"function", | |
"method", | |
"block", | |
"list_literal", | |
"selector", | |
"^if", | |
"^table", | |
"if_statement", | |
"while", | |
"for", | |
}, | |
} | |
M.nvimtree = { | |
auto_reload_on_write = true, | |
disable_netrw = true, | |
sort_by = "name", | |
renderer = { | |
indent_markers = { | |
enable = true, | |
icons = { | |
corner = "└ ", | |
edge = "│ ", | |
none = " ", | |
}, | |
}, | |
icons = { | |
webdev_colors = true, | |
padding = " ", | |
symlink_arrow = " ➛ ", | |
show = { | |
file = true, | |
folder = true, | |
folder_arrow = true, | |
git = true, | |
}, | |
glyphs = { | |
default = "", | |
symlink = "", | |
folder = { | |
default = "", | |
empty = "", | |
empty_open = "", | |
open = "", | |
symlink = "", | |
symlink_open = "", | |
arrow_open = "", | |
arrow_closed = "", | |
}, | |
git = { | |
unstaged = "✗", | |
staged = "✓", | |
unmerged = "", | |
renamed = "➜", | |
untracked = "★", | |
deleted = "", | |
ignored = "◌", | |
}, | |
}, | |
}, | |
}, | |
hijack_netrw = true, | |
open_on_setup = false, | |
ignore_ft_on_setup = {}, | |
open_on_tab = false, | |
hijack_cursor = false, | |
update_cwd = true, | |
diagnostics = { | |
enable = false, | |
icons = { | |
hint = signs.Hint, | |
info = signs.Info, | |
warning = signs.Warning, | |
error = signs.Error, | |
}, | |
}, | |
update_focused_file = { | |
enable = true, | |
update_cwd = true, | |
ignore_list = {}, | |
}, | |
system_open = { | |
cmd = nil, | |
args = {}, | |
}, | |
filters = { | |
dotfiles = false, | |
custom = { | |
"^.git$", | |
}, | |
}, | |
git = { | |
enable = true, | |
ignore = false, | |
timeout = 500, | |
}, | |
-- trash = { | |
-- cmd = "trash", | |
-- require_confirm = true, | |
-- }, | |
actions = { | |
change_dir = { | |
global = false, | |
}, | |
open_file = { | |
quit_on_open = true, | |
}, | |
}, | |
view = { | |
width = 35, | |
height = 30, | |
hide_root_folder = true, | |
side = "left", | |
number = false, | |
relativenumber = false, | |
signcolumn = "yes", | |
mappings = { | |
list = { | |
{ key = { "<CR>", "o", "<2-LeftMouse>" }, action = "edit" }, | |
{ key = "<C-e>", action = "edit_in_place" }, | |
{ key = { "O" }, action = "edit_no_picker" }, | |
{ key = { "<2-RightMouse>", "<C-]>" }, action = "cd" }, | |
{ key = { "<C-v>", "sg" }, action = "vsplit" }, | |
{ key = { "<C-x>", "sv" }, action = "split" }, | |
{ key = "<C-t>", action = "tabnew" }, | |
{ key = "<", action = "prev_sibling" }, | |
{ key = ">", action = "next_sibling" }, | |
{ key = "P", action = "parent_node" }, | |
{ key = { "l" }, action = "open_node" }, | |
{ key = { "h", "<BS>" }, action = "close_node" }, | |
{ key = "<Tab>", action = "preview" }, | |
{ key = "K", action = "first_sibling" }, | |
{ key = "J", action = "last_sibling" }, | |
{ key = "I", action = "toggle_git_ignored" }, | |
{ key = "H", action = "toggle_dotfiles" }, | |
{ key = "R", action = "refresh" }, | |
{ key = "a", action = "create" }, | |
{ key = "d", action = "remove" }, | |
{ key = "D", action = "trash" }, | |
{ key = "r", action = "rename" }, | |
{ key = "<C-r>", action = "full_rename" }, | |
{ key = "x", action = "cut" }, | |
{ key = "c", action = "copy" }, | |
{ key = "p", action = "paste" }, | |
{ key = "y", action = "copy_name" }, | |
{ key = "Y", action = "copy_path" }, | |
{ key = "gy", action = "copy_absolute_path" }, | |
{ key = "[c", action = "prev_git_item" }, | |
{ key = "]c", action = "next_git_item" }, | |
{ key = "-", action = "dir_up" }, | |
{ key = "..", action = "system_open" }, | |
{ key = "q", action = "close" }, | |
{ key = "g?", action = "toggle_help" }, | |
{ key = "W", action = "collapse_all" }, | |
{ key = "S", action = "search_node" }, | |
{ key = "<C-k>", action = "toggle_file_info" }, | |
{ key = ".", action = "run_file_command" }, | |
}, | |
}, | |
}, | |
} | |
M.telescope = { | |
extensions = { | |
-- fd is needed | |
media_files = { | |
filetypes = { "png", "webp", "jpg", "jpeg" }, | |
find_cmd = "fdfind", | |
}, | |
}, | |
defaults = { | |
border = true, | |
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, | |
sorting_strategy = "descending", | |
layout_strategy = "vertical", | |
layout_config = { | |
vertical = { | |
prompt_position = "bottom", | |
mirror = true, | |
}, | |
preview_cutoff = 35, | |
}, | |
mappings = { | |
i = { | |
["<C-c>"] = actions.close, | |
["<C-j>"] = actions.move_selection_next, | |
["<C-k>"] = actions.move_selection_previous, | |
-- ["<c-t>"] = trouble.open_with_trouble, | |
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, | |
-- To disable a keymap, put [map] = false | |
-- So, to not map "<C-n>", just put | |
-- ["<c-x>"] = false, | |
-- ["<esc>"] = actions.close, | |
-- 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, | |
-- ["<c-t>"] = trouble.open_with_trouble, | |
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, | |
-- ["<C-i>"] = my_cool_custom_action, | |
}, | |
}, | |
}, | |
} | |
return M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment