lazy loading telescope!

This commit is contained in:
siduck76 2021-06-26 08:11:39 +05:30
parent fc76cb3f52
commit c5f5709f10
5 changed files with 90 additions and 83 deletions

View File

@ -3,7 +3,7 @@ require "pluginList"
require "misc-utils"
require "top-bufferline"
require "telescope-nvim"
require("colorizer").setup()
local cmd = vim.cmd
local g = vim.g
@ -19,7 +19,6 @@ local base16 = require "base16"
base16(base16.themes["nvchad-softgruv"], true)
require "highlights"
require("colorizer").setup()
require "mappings"
require "file-icons"
require "statusline"

View File

@ -118,8 +118,8 @@ fg_bg("BufferLineIndicator", black2, black2)
fg_bg("BufferLineIndicatorSelected", black, black)
-- separators
fg_bg("BufferLineSeparator", line, black2)
fg_bg("BufferLineSeparatorVisible", line, black2)
fg_bg("BufferLineSeparator", black2, black2)
fg_bg("BufferLineSeparatorVisible", black2, black2)
fg_bg("BufferLineSeparatorSelected", black, black2)
-- modified buffers
@ -139,5 +139,5 @@ fg("DashboardCenter", grey_fg)
fg("DashboardShortcut", grey_fg)
fg("DashboardFooter", grey_fg)
-- Default nvim bg
-- Default nvim bg (based on terminal bg)
-- cmd "hi Normal guibg=#1e222a"

View File

@ -107,7 +107,17 @@ map("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
-- dashboard stuff
map("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
map("n", "<Leader>db", [[<Cmd> Dashboard<CR>]], opt)
map("n", "<Leader>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
map("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
map("n", "<Leader>sl", [[<Cmd> SessionLoad<CR>]], opt)
map("n", "<Leader>ss", [[<Cmd> SessionSave<CR>]], opt)
-- Telescope
map("n", "<Leader>gt", [[<Cmd> Telescope git_status <CR>]], opt)
map("n", "<Leader>cm", [[<Cmd> Telescope git_commits <CR>]], opt)
map("n", "<Leader>ff", [[<Cmd> Telescope find_files <CR>]], opt)
map("n", "<Leader>fp", [[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]], opt)
map("n", "<Leader>fb", [[<Cmd>Telescope Buffers<CR>]], opt)
map("n", "<Leader>fh", [[<Cmd>Telescope help_tags<CR>]], opt)
map("n", "<Leader>fo", [[<Cmd>Telescope oldfiles<CR>]], opt)

View File

@ -70,6 +70,7 @@ return packer.startup(
}
use "kyazdani42/nvim-web-devicons"
use {
"nvim-telescope/telescope.nvim",
requires = {
@ -77,10 +78,16 @@ return packer.startup(
{"nvim-lua/plenary.nvim"},
{"nvim-telescope/telescope-fzf-native.nvim", run = "make"},
{"nvim-telescope/telescope-media-files.nvim"}
}
},
cmd = {
"Telescope"
},
config = function()
require("telescope-nvim").config()
end
}
-- misc plugins
-- git stuff
use {
"lewis6991/gitsigns.nvim",
event = "BufRead",
@ -89,6 +96,7 @@ return packer.startup(
end
}
-- misc plugins
use {
"windwp/nvim-autopairs",
event = "InsertEnter",
@ -113,7 +121,7 @@ return packer.startup(
use {
"glepnir/dashboard-nvim",
cmd = {
"Telescope live_grep",
"Dashboard",
"DashboardNewFile",
"DashboardJumpMarks"
},

View File

@ -1,3 +1,6 @@
local M = {}
M.config = function()
require("telescope").setup {
defaults = {
vimgrep_arguments = {
@ -20,7 +23,7 @@ require("telescope").setup {
layout_defaults = {
horizontal = {
mirror = false,
preview_width = 0.5
preview_width = 0.55
},
vertical = {
mirror = false
@ -61,21 +64,8 @@ require("telescope").setup {
}
}
require('telescope').load_extension('fzf')
require("telescope").load_extension("fzf")
require("telescope").load_extension("media_files")
end
local opt = {noremap = true, silent = true}
vim.g.mapleader = " "
-- mappings
vim.api.nvim_set_keymap("n", "<Leader>ff", [[<Cmd>lua require('telescope.builtin').find_files()<CR>]], opt)
vim.api.nvim_set_keymap(
"n",
"<Leader>fp",
[[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]],
opt
)
vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
return M