telescope git files with fallback to local files
parent
cdbfe35a6f
commit
0eb58f5f40
@ -1,15 +1,17 @@
|
||||
print("Setting up colors")
|
||||
|
||||
rose_pine = packer_plugins["rose-pine"]
|
||||
if rose_pine then
|
||||
print("Rose Pine is known")
|
||||
if rose_pine.loaded then
|
||||
print("Using Rose Pine colorscheme")
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
-- vim.cmd("colorscheme rose-pine")
|
||||
else
|
||||
print("Rose Pine is not loaded")
|
||||
end
|
||||
else
|
||||
print("Rose Pine is not known")
|
||||
end
|
||||
vim.cmd.colorscheme("jellybeans")
|
||||
|
||||
-- rose_pine = packer_plugins["rose-pine"]
|
||||
-- if rose_pine then
|
||||
-- print("Rose Pine is known")
|
||||
-- if rose_pine.loaded then
|
||||
-- print("Using Rose Pine colorscheme")
|
||||
-- vim.cmd.colorscheme("rose-pine")
|
||||
-- -- vim.cmd("colorscheme rose-pine")
|
||||
-- else
|
||||
-- print("Rose Pine is not loaded")
|
||||
-- end
|
||||
-- else
|
||||
-- print("Rose Pine is not known")
|
||||
-- end
|
||||
|
@ -1,2 +1,19 @@
|
||||
print("After Telescope")
|
||||
|
||||
local telescope = require('telescope')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
"__pycache__",
|
||||
},
|
||||
preview = {
|
||||
treesitter = {
|
||||
enable = {
|
||||
'python',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -0,0 +1,29 @@
|
||||
print("Loading up etc definitions")
|
||||
local M = {}
|
||||
|
||||
local telescope = require("telescope.builtin")
|
||||
|
||||
-- cache directory checks for great speed
|
||||
local is_inside_work_tree = {}
|
||||
|
||||
|
||||
M.project_files = function()
|
||||
local opts = {}
|
||||
|
||||
local cwd = vim.fn.getcwd()
|
||||
|
||||
if is_inside_work_tree[cwd] == nil then
|
||||
-- The directory has not been checked
|
||||
vim.fn.system("git rev-parse --is-inside-work-tree")
|
||||
-- Add the result to our cache
|
||||
is_inside_work_tree[cwd] = vim.v.shell_error == 0
|
||||
end
|
||||
|
||||
if is_inside_work_tree[cwd] then
|
||||
telescope.git_files(opts)
|
||||
else
|
||||
telescope.find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
Loading…
Reference in New Issue