Adding a basic telescope

This commit is contained in:
Zoe Roux
2022-03-09 02:56:58 +01:00
parent d9e7709df2
commit 5b21c9e4bb
6 changed files with 103 additions and 30 deletions
+3
View File
@@ -0,0 +1,3 @@
!.env
.git
+68 -1
View File
@@ -3,6 +3,39 @@ if not cmp_status_ok then
return
end
local lsn_status_ok, luasnip = pcall(require, "luasnip")
if not lsn_status_ok then
return
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)
@@ -10,6 +43,8 @@ cmp.setup({
end,
},
mapping = {
["<Up>"] = cmp.mapping.select_prev_item(),
["<Down>"] = cmp.mapping.select_next_item(),
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
@@ -21,12 +56,44 @@ cmp.setup({
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
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" }),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
})
}),
formatting = {
fields = { "abbr", "kind" },
format = function(entry, vim_item)
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
})
cmp.setup.cmdline('/', {
-29
View File
@@ -1,29 +1,5 @@
local M = {}
M.icons = {
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "了 ",
EnumMember = "",
Field = "",
File = "",
Folder = "",
Function = "",
Interface = "ﰮ ",
Keyword = "",
Method = "ƒ ",
Module = "",
Property = "",
Snippet = "﬌ ",
Struct = "",
Text = "",
Unit = "",
Value = "",
Variable = "",
}
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = "" },
@@ -39,11 +15,6 @@ M.setup = function()
virtual_text = false,
update_in_insert = true,
})
local kinds = vim.lsp.protocol.CompletionItemKind
for i, kind in ipairs(kinds) do
kinds[i] = M.icons[kind] or kind
end
end
local function lsp_highlight_document(client)
+6
View File
@@ -49,6 +49,12 @@ return packer.startup(function(use)
use "folke/tokyonight.nvim"
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
use "folke/which-key.nvim"
use "akinsho/toggleterm.nvim"
@@ -1,3 +1,4 @@
require "windows.toggleterm"
require "windows.which-key"
require "windows.telescope"
@@ -0,0 +1,25 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
telescope.setup({
defaults = {
prompt_prefix = "",
selection_caret = "",
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
}
},
pickers = {
find_files = {
hidden = true,
},
},
})
require('telescope').load_extension('fzf')