mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 05:20:38 +00:00
lazy loading telescope!
This commit is contained in:
parent
fc76cb3f52
commit
c5f5709f10
5 changed files with 90 additions and 83 deletions
3
init.lua
3
init.lua
|
@ -3,7 +3,7 @@ require "pluginList"
|
||||||
require "misc-utils"
|
require "misc-utils"
|
||||||
|
|
||||||
require "top-bufferline"
|
require "top-bufferline"
|
||||||
require "telescope-nvim"
|
require("colorizer").setup()
|
||||||
|
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
@ -19,7 +19,6 @@ local base16 = require "base16"
|
||||||
base16(base16.themes["nvchad-softgruv"], true)
|
base16(base16.themes["nvchad-softgruv"], true)
|
||||||
|
|
||||||
require "highlights"
|
require "highlights"
|
||||||
require("colorizer").setup()
|
|
||||||
require "mappings"
|
require "mappings"
|
||||||
require "file-icons"
|
require "file-icons"
|
||||||
require "statusline"
|
require "statusline"
|
||||||
|
|
|
@ -118,8 +118,8 @@ fg_bg("BufferLineIndicator", black2, black2)
|
||||||
fg_bg("BufferLineIndicatorSelected", black, black)
|
fg_bg("BufferLineIndicatorSelected", black, black)
|
||||||
|
|
||||||
-- separators
|
-- separators
|
||||||
fg_bg("BufferLineSeparator", line, black2)
|
fg_bg("BufferLineSeparator", black2, black2)
|
||||||
fg_bg("BufferLineSeparatorVisible", line, black2)
|
fg_bg("BufferLineSeparatorVisible", black2, black2)
|
||||||
fg_bg("BufferLineSeparatorSelected", black, black2)
|
fg_bg("BufferLineSeparatorSelected", black, black2)
|
||||||
|
|
||||||
-- modified buffers
|
-- modified buffers
|
||||||
|
@ -139,5 +139,5 @@ fg("DashboardCenter", grey_fg)
|
||||||
fg("DashboardShortcut", grey_fg)
|
fg("DashboardShortcut", grey_fg)
|
||||||
fg("DashboardFooter", grey_fg)
|
fg("DashboardFooter", grey_fg)
|
||||||
|
|
||||||
-- Default nvim bg
|
-- Default nvim bg (based on terminal bg)
|
||||||
-- cmd "hi Normal guibg=#1e222a"
|
-- cmd "hi Normal guibg=#1e222a"
|
||||||
|
|
|
@ -107,7 +107,17 @@ map("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
|
||||||
|
|
||||||
-- dashboard stuff
|
-- dashboard stuff
|
||||||
map("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
|
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>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
|
||||||
map("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
|
map("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
|
||||||
map("n", "<Leader>sl", [[<Cmd> SessionLoad<CR>]], opt)
|
map("n", "<Leader>sl", [[<Cmd> SessionLoad<CR>]], opt)
|
||||||
map("n", "<Leader>ss", [[<Cmd> SessionSave<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)
|
||||||
|
|
|
@ -70,6 +70,7 @@ return packer.startup(
|
||||||
}
|
}
|
||||||
|
|
||||||
use "kyazdani42/nvim-web-devicons"
|
use "kyazdani42/nvim-web-devicons"
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
|
@ -77,10 +78,16 @@ return packer.startup(
|
||||||
{"nvim-lua/plenary.nvim"},
|
{"nvim-lua/plenary.nvim"},
|
||||||
{"nvim-telescope/telescope-fzf-native.nvim", run = "make"},
|
{"nvim-telescope/telescope-fzf-native.nvim", run = "make"},
|
||||||
{"nvim-telescope/telescope-media-files.nvim"}
|
{"nvim-telescope/telescope-media-files.nvim"}
|
||||||
}
|
},
|
||||||
|
cmd = {
|
||||||
|
"Telescope"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("telescope-nvim").config()
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- misc plugins
|
-- git stuff
|
||||||
use {
|
use {
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
|
@ -89,6 +96,7 @@ return packer.startup(
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- misc plugins
|
||||||
use {
|
use {
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
|
@ -113,7 +121,7 @@ return packer.startup(
|
||||||
use {
|
use {
|
||||||
"glepnir/dashboard-nvim",
|
"glepnir/dashboard-nvim",
|
||||||
cmd = {
|
cmd = {
|
||||||
"Telescope live_grep",
|
"Dashboard",
|
||||||
"DashboardNewFile",
|
"DashboardNewFile",
|
||||||
"DashboardJumpMarks"
|
"DashboardJumpMarks"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,81 +1,71 @@
|
||||||
require("telescope").setup {
|
local M = {}
|
||||||
defaults = {
|
|
||||||
vimgrep_arguments = {
|
M.config = function()
|
||||||
"rg",
|
require("telescope").setup {
|
||||||
"--color=never",
|
defaults = {
|
||||||
"--no-heading",
|
vimgrep_arguments = {
|
||||||
"--with-filename",
|
"rg",
|
||||||
"--line-number",
|
"--color=never",
|
||||||
"--column",
|
"--no-heading",
|
||||||
"--smart-case"
|
"--with-filename",
|
||||||
},
|
"--line-number",
|
||||||
prompt_position = "top",
|
"--column",
|
||||||
prompt_prefix = " ",
|
"--smart-case"
|
||||||
selection_caret = " ",
|
|
||||||
entry_prefix = " ",
|
|
||||||
initial_mode = "insert",
|
|
||||||
selection_strategy = "reset",
|
|
||||||
sorting_strategy = "descending",
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_defaults = {
|
|
||||||
horizontal = {
|
|
||||||
mirror = false,
|
|
||||||
preview_width = 0.5
|
|
||||||
},
|
},
|
||||||
vertical = {
|
prompt_position = "top",
|
||||||
mirror = false
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
entry_prefix = " ",
|
||||||
|
initial_mode = "insert",
|
||||||
|
selection_strategy = "reset",
|
||||||
|
sorting_strategy = "descending",
|
||||||
|
layout_strategy = "horizontal",
|
||||||
|
layout_defaults = {
|
||||||
|
horizontal = {
|
||||||
|
mirror = false,
|
||||||
|
preview_width = 0.55
|
||||||
|
},
|
||||||
|
vertical = {
|
||||||
|
mirror = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
file_sorter = require "telescope.sorters".get_fuzzy_file,
|
||||||
|
file_ignore_patterns = {},
|
||||||
|
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter,
|
||||||
|
shorten_path = true,
|
||||||
|
winblend = 0,
|
||||||
|
width = 0.75,
|
||||||
|
preview_cutoff = 120,
|
||||||
|
results_height = 1,
|
||||||
|
results_width = 0.8,
|
||||||
|
border = {},
|
||||||
|
borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
||||||
|
color_devicons = true,
|
||||||
|
use_less = true,
|
||||||
|
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
|
||||||
|
file_previewer = require "telescope.previewers".vim_buffer_cat.new,
|
||||||
|
grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new,
|
||||||
|
qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new,
|
||||||
|
-- Developer configurations: Not meant for general override
|
||||||
|
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = false, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case" -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
},
|
||||||
|
media_files = {
|
||||||
|
filetypes = {"png", "webp", "jpg", "jpeg"},
|
||||||
|
find_cmd = "rg" -- find command (defaults to `fd`)
|
||||||
}
|
}
|
||||||
},
|
|
||||||
file_sorter = require "telescope.sorters".get_fuzzy_file,
|
|
||||||
file_ignore_patterns = {},
|
|
||||||
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter,
|
|
||||||
shorten_path = true,
|
|
||||||
winblend = 0,
|
|
||||||
width = 0.75,
|
|
||||||
preview_cutoff = 120,
|
|
||||||
results_height = 1,
|
|
||||||
results_width = 0.8,
|
|
||||||
border = {},
|
|
||||||
borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
|
||||||
color_devicons = true,
|
|
||||||
use_less = true,
|
|
||||||
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
|
|
||||||
file_previewer = require "telescope.previewers".vim_buffer_cat.new,
|
|
||||||
grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new,
|
|
||||||
qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new,
|
|
||||||
-- Developer configurations: Not meant for general override
|
|
||||||
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true, -- false will only do exact matching
|
|
||||||
override_generic_sorter = false, -- override the generic sorter
|
|
||||||
override_file_sorter = true, -- override the file sorter
|
|
||||||
case_mode = "smart_case" -- or "ignore_case" or "respect_case"
|
|
||||||
-- the default case_mode is "smart_case"
|
|
||||||
},
|
|
||||||
media_files = {
|
|
||||||
filetypes = {"png", "webp", "jpg", "jpeg"},
|
|
||||||
find_cmd = "rg" -- find command (defaults to `fd`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
require('telescope').load_extension('fzf')
|
require("telescope").load_extension("fzf")
|
||||||
require("telescope").load_extension("media_files")
|
require("telescope").load_extension("media_files")
|
||||||
|
end
|
||||||
|
|
||||||
local opt = {noremap = true, silent = true}
|
return M
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
Loading…
Reference in a new issue