remove telescope
This commit is contained in:
		
							parent
							
								
									17decf271f
								
							
						
					
					
						commit
						bb7246769c
					
				@ -1,9 +1,6 @@
 | 
				
			|||||||
local M = {
 | 
					local M = {
 | 
				
			||||||
	'williamboman/mason.nvim',
 | 
						'williamboman/mason.nvim',
 | 
				
			||||||
	cmd = 'Mason',
 | 
						cmd = 'Mason',
 | 
				
			||||||
	dependencies = {
 | 
					 | 
				
			||||||
		'nvim-telescope/telescope.nvim',
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- M.tools = {
 | 
					-- M.tools = {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,101 +0,0 @@
 | 
				
			|||||||
-- local function project_files()
 | 
					 | 
				
			||||||
-- 	local opts = {}
 | 
					 | 
				
			||||||
-- 	if vim.loop.fs_stat '.git' then
 | 
					 | 
				
			||||||
-- 		opts.show_untracked = true
 | 
					 | 
				
			||||||
-- 		require('telescope.builtin').git_files(opts)
 | 
					 | 
				
			||||||
-- 	else
 | 
					 | 
				
			||||||
-- 		local client = vim.lsp.get_active_clients()[1]
 | 
					 | 
				
			||||||
-- 		if client then
 | 
					 | 
				
			||||||
-- 			opts.cwd = client.config.root_dir
 | 
					 | 
				
			||||||
-- 		end
 | 
					 | 
				
			||||||
-- 		require('telescope.builtin').find_files(opts)
 | 
					 | 
				
			||||||
-- 	end
 | 
					 | 
				
			||||||
-- end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local M = {
 | 
					 | 
				
			||||||
	'nvim-telescope/telescope.nvim',
 | 
					 | 
				
			||||||
	cmd = { 'Telescope' },
 | 
					 | 
				
			||||||
	dependencies = {
 | 
					 | 
				
			||||||
		'nvim-telescope/telescope-ui-select.nvim',
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function M.config()
 | 
					 | 
				
			||||||
	local telescope = require 'telescope'
 | 
					 | 
				
			||||||
	local actions = require 'telescope.actions'
 | 
					 | 
				
			||||||
	local previewers = require 'telescope.previewers'
 | 
					 | 
				
			||||||
	local Job = require 'plenary.job'
 | 
					 | 
				
			||||||
	local new_maker = function(filepath, bufnr, opts)
 | 
					 | 
				
			||||||
		filepath = vim.fn.expand(filepath)
 | 
					 | 
				
			||||||
		Job:new({
 | 
					 | 
				
			||||||
			command = 'file',
 | 
					 | 
				
			||||||
			args = { '--mime-type', '-b', filepath },
 | 
					 | 
				
			||||||
			on_exit = function(j)
 | 
					 | 
				
			||||||
				local mime_type = vim.split(j:result()[1], '/')[1]
 | 
					 | 
				
			||||||
				if mime_type == 'text' then
 | 
					 | 
				
			||||||
					previewers.buffer_previewer_maker(filepath, bufnr, opts)
 | 
					 | 
				
			||||||
				else
 | 
					 | 
				
			||||||
					-- maybe we want to write something to the buffer here
 | 
					 | 
				
			||||||
					vim.schedule(function()
 | 
					 | 
				
			||||||
						vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
 | 
					 | 
				
			||||||
					end)
 | 
					 | 
				
			||||||
				end
 | 
					 | 
				
			||||||
			end,
 | 
					 | 
				
			||||||
		}):sync()
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- local fb_actions = require "telescope".extensions.file_browser.actions
 | 
					 | 
				
			||||||
	telescope.setup {
 | 
					 | 
				
			||||||
		extensions = {
 | 
					 | 
				
			||||||
			['ui-select'] = {
 | 
					 | 
				
			||||||
				require('telescope.themes').get_dropdown {},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		pickers = {
 | 
					 | 
				
			||||||
			find_files = {
 | 
					 | 
				
			||||||
				find_command = { 'fd', '--type', 'f', '--strip-cwd-prefix' },
 | 
					 | 
				
			||||||
				theme = 'dropdown',
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			live_grep = {
 | 
					 | 
				
			||||||
				theme = 'dropdown',
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			buffers = {
 | 
					 | 
				
			||||||
				theme = 'dropdown',
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		defaults = {
 | 
					 | 
				
			||||||
			layout_config = {
 | 
					 | 
				
			||||||
				vertical = { width = 0.5 },
 | 
					 | 
				
			||||||
				-- other layout configuration here
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			buffer_previewer_maker = new_maker,
 | 
					 | 
				
			||||||
			prompt_prefix = ' ',
 | 
					 | 
				
			||||||
			selection_caret = ' ',
 | 
					 | 
				
			||||||
			path_display = { 'smart' },
 | 
					 | 
				
			||||||
			file_ignore_patterns = { '.git/', 'node_modules' },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			mappings = {
 | 
					 | 
				
			||||||
				i = {
 | 
					 | 
				
			||||||
					['<Down>'] = actions.move_selection_next,
 | 
					 | 
				
			||||||
					['<Up>'] = actions.move_selection_previous,
 | 
					 | 
				
			||||||
					['<C-n>'] = actions.cycle_history_next,
 | 
					 | 
				
			||||||
					['<C-e>'] = actions.cycle_history_prev,
 | 
					 | 
				
			||||||
					['<esc>'] = actions.close,
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			vimgrep_arguments = {
 | 
					 | 
				
			||||||
				'rg',
 | 
					 | 
				
			||||||
				'--color=never',
 | 
					 | 
				
			||||||
				'--no-heading',
 | 
					 | 
				
			||||||
				'--with-filename',
 | 
					 | 
				
			||||||
				'--line-number',
 | 
					 | 
				
			||||||
				'--column',
 | 
					 | 
				
			||||||
				'--smart-case',
 | 
					 | 
				
			||||||
				'--trim', -- add this value
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	require('telescope').load_extension 'ui-select'
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
return M
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user