add quickfixing to telescope

This commit is contained in:
Barak Michener 2022-12-07 14:02:32 -08:00
parent 06a0ac7cc4
commit 5ebe434fbf
2 changed files with 32 additions and 11 deletions

View file

@ -275,16 +275,25 @@ require('trouble').setup {
}
local trouble_telescope = require("trouble.providers.telescope")
local builtin = require 'telescope.builtin'
local sendtoqf = function(loc)
local actions = require('telescope.actions')
actions.send_to_qflist(loc)
builtin.quickfix({ initial_mode = "normal" })
end
require('telescope').setup {
defaults = {
mappings = {
n = {
["q"] = require('telescope.actions').close,
["ff"] = sendtoqf,
["<c-t>"] = trouble_telescope.open_with_trouble,
},
i = {
["<c-t>"] = trouble_telescope.open_with_trouble,
["ff"] = require('telescope.actions').send_to_qflist,
},
},
},
@ -307,10 +316,15 @@ require('telescope').setup {
height = 15,
},
},
quickfix = {
theme = "ivy",
layout_config = {
height = 15,
},
},
},
}
local builtin = require 'telescope.builtin'
local dropdown = require 'telescope.themes'.get_dropdown({
--previewer = false,
@ -376,8 +390,8 @@ require 'nvim-treesitter.configs'.setup {
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
--custom_captures = {
--["generic_type_param"] = "TSCGenericTypeParam",
--["type_identifier"] = "TSCGenericTypeParam",
--["generic_type_param"] = "TSCGenericTypeParam",
--["type_identifier"] = "TSCGenericTypeParam",
--},
},
@ -448,6 +462,12 @@ file_list = function(conf)
builtin.git_files(opt)
end
--quickfix_telescope = function(conf)
--local opt = telescope_ivy
--for k, v in pairs(conf) do opt[k] = v end
--builtin.quickfix(opt)
--end
---
--- My own "where" clause generator for Rust

17
.vimrc
View file

@ -198,7 +198,7 @@ Plug 'zchee/vim-goasm'
"\ }
"Plug 'ensime/ensime-vim', { 'do': ':UpdateRemotePlugins' }
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'romainl/vim-qf'
"Plug 'romainl/vim-qf'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/lsp_extensions.nvim'
Plug 'hrsh7th/nvim-compe'
@ -296,8 +296,8 @@ set updatetime=500
autocmd CursorHold * lua vim.diagnostic.open_float({focusable = false})
" Autoformat on save
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.go lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
autocmd BufWritePre *.go silent! lua org_imports(3000)
@ -320,12 +320,12 @@ inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
let g:qf_auto_open_quickfix = 1
let g:qf_auto_open_loclist = 0
"let g:qf_auto_open_quickfix = 1
"let g:qf_auto_open_loclist = 0
nmap <PageUp> <Plug>(qf_qf_previous)
nmap <PageDown> <Plug>(qf_qf_next)
nmap ge <Plug>(qf_qf_toggle)
"nmap <PageUp> <Plug>(qf_qf_previous)
"nmap <PageDown> <Plug>(qf_qf_next)
"nmap ge <Plug>(qf_qf_toggle)
"" Sources
"source ~/.vim/supertab.vim
@ -1015,6 +1015,7 @@ nnoremap <silent> <Leader>aa :<C-u>RgRoot!<CR>
nnoremap <silent> <C-k> <cmd>lua file_list{}<cr>
nnoremap <silent> <Leader>ag <cmd>lua live_grep_repo{ word_match = "-w", only_sort_text = true, search = ''}<cr>
nnoremap <silent> <Leader>aw <cmd>lua git_grep_word{ word_match = "-w", only_sort_text = true, initial_mode = "normal" }<cr>
nnoremap <silent> <Leader>q <cmd>lua require('telescope.builtin').quickfix{ initial_mode = "normal" }<cr>
" For C++ -- A is a great plugin which allows you to jump from the c file to the
" header and vice-versa. Mneumonic here is headerheader.