Skip to content

Commit

Permalink
Update Telescope config
Browse files Browse the repository at this point in the history
  • Loading branch information
ignu committed Oct 27, 2023
1 parent 97f38e1 commit e0fcecd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
9 changes: 8 additions & 1 deletion nvim/lua/user/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ local opts = { noremap = true, silent = true }

-- Shorten function name
local keymap = vim.api.nvim_set_keymap
local horizontalLayout =
'{ layout_strategy = "vertical", layout_config = { width = 0.95, height = 0.95, preview_height = { 0.7, min = 10 } } }'

--Remap space as leader key
keymap("", "<Space>", "<Nop>", opts)
Expand Down Expand Up @@ -61,7 +63,12 @@ vim.keymap.set("n", "<c-m>", "<Plug>(YankyCycleBackward)")

-- open git files
keymap("n", "<C-p>", ":Telescope git_files<CR>", opts)
keymap("n", "<leader>ff", ':lua require("telescope").extensions.live_grep_args.live_grep_args()<CR>', opts)
keymap(
"n",
"<leader>ff",
':lua require("telescope").extensions.live_grep_args.live_grep_args(' .. horizontalLayout .. ")<CR>",
opts
)

-- ctrl-save
keymap("n", "<c-s>", ":w!<cr>", opts)
Expand Down
10 changes: 8 additions & 2 deletions nvim/lua/user/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ if not status_ok then
end

local actions = require("telescope.actions")
local horizontalLayout =
'{ layout_strategy = "vertical", layout_config = { width = 0.95, height = 0.95, preview_height = { 0.7, min = 10 } } }'

telescope.setup({
defaults = {

prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
shorten_path = true,

layout_strategy = "vertical",
layout_config = {
vertical = { width = 0.95 },
horizontal = { width = 0.95 },
preview_height = { 0.7, min = 10 },
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
Expand Down
12 changes: 9 additions & 3 deletions nvim/lua/user/whichkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ if not status_ok then
return
end

local horizontalLayout =
'{ layout_strategy = "vertical", layout_config = { width = 0.95, height = 0.95, preview_height = { 0.7, min = 10 } } }'

local setup = {
plugins = {
marks = true, -- shows a list of your marks on ' and `
Expand Down Expand Up @@ -130,9 +133,12 @@ local mappings = {
":LazyGit<cr>",
"Lazy Git",
},
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
o = {
"<cmd>Telescope git_status(" .. horizontalLayout .. ")}), <cr>",
"Open changed file",
},
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
B = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
B = { "<cmd>Telescope git_branches theme=ivy<cr>", "Checkout branch" },
d = {
"<cmd>Gitsigns diffthis HEAD<cr>",
"Diff",
Expand Down Expand Up @@ -196,12 +202,12 @@ local mappings = {
a = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Search In Buffer" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
o = { "<cmd>Telescope vim_options<cr>", "Options" },
J = { "<cmd>Telescope jumplist<cr>", "Jumplist" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
m = { "<cmd>Telescope marks<cr>", "Marks" },
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
O = { "<cmd>Telescope vim_options<cr>", "Options" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
--f = { "<cmd>Telescope live_grep<cr>", "Rg" }, mapped in keymaps now
G = { "<cmd>Telescope lazygit<cr>", "Lazygit" },
Expand Down

0 comments on commit e0fcecd

Please sign in to comment.