-- add extra filetypes for plenary require('plenary.filetype').add_table({ extension = { ['elv'] = [[elvish]] } }) -- file/buffer/etc picker require('telescope').setup({ defaults = { mappings = { i = { ['jj'] = 'close', }, }, layout_config = { prompt_position = 'top', }, sorting_strategy = 'ascending', -- use filename as preview window title dynamic_preview_title = true, preview = { -- don't preview files larger than 1MB filesize_limit = 1, timeout = 500, }, -- ignore things we're likely not to edit file_ignore_patterns = { "%.zip$", "%.yarn/releases/", "%.yarn/plugins/" }, }, pickers = { buffers = { sort_lastused = true, sort_mru = true, mappings = { i = { [''] = 'delete_buffer' }, }, }, find_files = { find_command = { "fd", "--type", "f", "--strip-cwd-prefix" } }, }, }) -- use native sorter for better performance require('telescope').load_extension('fzf') -- custom picker to fallback to files if no git local telescope_builtin = require('telescope.builtin') _G.project_files = function() local ok = pcall(telescope_builtin.git_files, { show_untracked = true }) if not ok then telescope_builtin.find_files({}) end end -- shows added/removed/changed lines require('gitsigns').setup() require('mini.statusline').setup({ content = { -- copy-pasted from default, we just want to remove the icon active = function() local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) local git = MiniStatusline.section_git({ trunc_width = 75, icon = '' }) local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75, icon = '' }) local filename = MiniStatusline.section_filename({ trunc_width = 140 }) local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) local location = MiniStatusline.section_location({ trunc_width = 75 }) return MiniStatusline.combine_groups({ { hl = mode_hl, strings = { mode } }, { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } }, '%<', -- Mark general truncate point { hl = 'MiniStatuslineFilename', strings = { filename } }, '%=', -- End left alignment { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, { hl = mode_hl, strings = { location } }, }) end }, }) -- delete buffer while preserving layout require('mini.bufremove').setup() -- shows a line indicating the current indentation scope require('mini.indentscope').setup() -- comment actions require('mini.comment').setup() -- surround actions require('mini.surround').setup() local spec_treesitter = require('mini.ai').gen_spec.treesitter require('mini.ai').setup({ custom_textobjects = { [','] = spec_treesitter({ a = '@parameter.outer', i = '@parameter.inner', }), }, }); -- align actions require('mini.align').setup() -- repeatable f/t require('mini.jump').setup({ mappings = { repeat_jump = '', }, delay = { highlight = 10000000, }, }) -- rest client require('rest-nvim').setup({}) -- Use Treesitter for syntax highlighting require('nvim-treesitter.configs').setup({ highlight = { enable = true, }, incremental_selection = { enable = true, keymaps = { init_selection = "]t", node_incremental = "]t", node_decremental = "[t", }, }, textobjects = { swap = { enable = true, swap_next = { ['>,'] = '@parameter.inner', }, swap_previous = { ['<,'] = '@parameter.inner', }, }, }, }) local tsj_utils = require('treesj.langs.utils') -- Treesitter-aware split/join require('treesj').setup({ use_default_keymaps = false, }) -- completion local cmp = require('cmp') local cmp_types = require('cmp.types') cmp.setup({ snippet = { expand = function(args) vim.fn['vsnip#anonymous'](args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = "nvim_lsp", entry_filter = function(entry, ctx) -- don't autocomplete keywords return cmp_types.lsp.CompletionItemKind[entry:get_kind()] ~= 'Keyword' end }, { name = "vsnip" }, }), completion = { autocomplete = false, }, matching = { -- disable non-prefix matching disallow_fuzzy_matching = true, disallow_partial_matching = true, disallow_prefix_unmatching = true, }, sorting = { comparators = { -- since we only have prefix matches, just sort the results cmp.config.compare.sort_text, }, }, }) -- typescript-vim compiler options vim.g.typescript_compiler_options = '--incremental --noEmit'