489 lines
21 KiB
HTML
489 lines
21 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<title>Telescope - 🚀 ApolloNvim</title>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
<link rel="stylesheet" href="../../../assets/css/darcula-highlight.min.css">
|
|
|
|
<link rel="stylesheet" href="../../../assets/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="../../../assets/css/dracula-ui.min.css">
|
|
<link rel="stylesheet" href="../../../assets/css/mkdocs.min.css">
|
|
<link href="../../../style/style.css" rel="stylesheet">
|
|
|
|
|
|
<link rel="icon" type="image/x-icon" href="../../../assets/img/favicon.ico">
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
|
|
</head>
|
|
|
|
<body class="drac-bg-black-secondary drac-text-grey-ternary drac-text drac-scrollbar-purple">
|
|
|
|
<main class="d-flex">
|
|
|
|
<!-- block sidebar -->
|
|
<nav id="sidebar" class="sidebar drac-bg-black">
|
|
<div class="custom-menu">
|
|
<button type="button" id="sidebarCollapse" class="btn btn-primary">
|
|
<i class="fa fa-bars"></i>
|
|
<span class="sr-only">Menu</span>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="p-4">
|
|
|
|
|
|
<div class="drac-text-center">
|
|
|
|
<span class="drac-text drac-line-height drac-text-white">🚀 ApolloNvim</span>
|
|
|
|
</div>
|
|
|
|
<div class="drac-box flex-column">
|
|
<ul class="dot-ul">
|
|
<li><div class="dot-li drac-bg-cyan"></div></li>
|
|
<li><div class="dot-li drac-bg-green"></div></li>
|
|
<li><div class="dot-li drac-bg-orange"></div></li>
|
|
<li><div class="dot-li drac-bg-pink"></div></li>
|
|
<li><div class="dot-li drac-bg-purple"></div></li>
|
|
<li><div class="dot-li drac-bg-red"></div></li>
|
|
<li><div class="dot-li drac-bg-yellow"></div></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<hr class="drac-divider" />
|
|
|
|
<!-- block menu -->
|
|
<ul class="mb-5 drac-list drac-list-none">
|
|
|
|
<li class="drac-box">
|
|
<a href="../../.."
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
🏘 Home
|
|
</a>
|
|
</li>
|
|
<li class="drac-box">
|
|
<a href="../../installation/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
🛠 Installation
|
|
</a>
|
|
</li>
|
|
<li class="drac-box">
|
|
<a href="../../plugins/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
🗄 Plugins
|
|
</a>
|
|
</li>
|
|
<li class="drac-box">
|
|
<a href="../../.."
|
|
class=" active
|
|
drac-anchor btn-toggle d-inline-flex align-items-center border-0 drac-text-purple--hover collapsed"
|
|
data-bs-toggle="collapse" data-bs-target="#📑-tutorials-collapse" aria-expanded="false">
|
|
📑 Tutorials
|
|
</a>
|
|
<div class="collapse" id="📑-tutorials-collapse">
|
|
<ul class="mb-5 drac-list drac-list-none">
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../01.%20vimplug/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
How to install vim.plug into Neovim
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../02.%20keyshortcuts/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Default keyboard shortcuts
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../03.%20Jak%20nainstalovat%20Codeium%20do%20Neovim/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
How to install Codeium on Neovim
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="./"
|
|
class=" active
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Telescope
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../05.%20Barevn%C3%A9%20sch%C3%A9ma/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Color scheme
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../06.%20Autosave/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Automatic saving
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../07.%20Kop%C3%ADrov%C3%A1n%C3%AD%20a%20Vkl%C3%A1d%C3%A1n%C3%AD%20do%20a%20z%20Neovim%20z%20extern%C3%ADch%20zdroj%C5%AF/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Copying and Pasting to and from Neovim from external sources
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../08.%20Markdown_syntax/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Markdown_syntax
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../09.%20init.vim%20z%C3%A1kladn%C3%AD%20nastaven%C3%AD/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
init.vim basic settings
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../10.%20vim-fugitive%20ovl%C3%A1dni%20Git%20v%20Neovim/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
vim-fugitive
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../11.%20Gitsigns%20drobn%C3%A9%20vylep%C5%A1en%C3%AD%20git%20v%20Neovim/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Gitsigns minor improvements to git in Neovim
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../12.%20Je%C5%A1t%C4%9B%20lep%C5%A1%C3%AD%20Neovim%20s%20Zellij%20termin%C3%A1lov%C3%BDm%20multiplexorem/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Even better Neovim with Zellij terminal multiplexer
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../13.%20Pou%C5%BE%C3%ADv%C3%A1n%C3%AD%20relativn%C3%ADch%20%C4%8D%C3%ADsel%20%C5%99%C3%A1dk%C5%AF/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Using relative line numbers
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../15.%20Jak%20na%20kop%C3%ADrov%C3%A1n%C3%AD%20a%20vkl%C3%A1d%C3%A1n%C3%AD/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
How to copy and paste
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../17.%20Jak%20opravit%20nefunk%C4%8Dn%C3%AD%20Prettier/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
How to fix a broken Prettier
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../18.%20Konfigurace%20Lua/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
Configuring plagin in Lua file
|
|
</a>
|
|
</li>
|
|
|
|
<li class="drac-box-ternary">
|
|
<a href="../20.%20N%C3%A1hledy%20markdown%20v%20nvim/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
How to show markdown preview in browser using coc-webview
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
<li class="drac-box">
|
|
<a href="../../../contact/"
|
|
class="
|
|
drac-anchor d-inline-flex align-items-center border-0 drac-text-purple--hover">
|
|
📪 Contact
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<!-- endblock -->
|
|
</div>
|
|
</nav>
|
|
<!-- endblock -->
|
|
|
|
<nav class="divider drac-bg-purple-cyan"></nav>
|
|
|
|
<div class="content">
|
|
<!-- block header -->
|
|
<header>
|
|
<nav class="navbar navbar-expand-xl drac-bg-purple">
|
|
<div class="container-fluid">
|
|
|
|
<button class="navbar-toggler w-100 text-center" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsMenu"
|
|
aria-controls="navbarsMenu" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse flex-column ml-auto" id="navbarsMenu">
|
|
<ul class="navbar-nav text-md-center">
|
|
|
|
<!-- block preview -->
|
|
<li class="nav-item">
|
|
|
|
<div class="container">
|
|
<div class="row row-preview">
|
|
<div class="col">
|
|
<a href="../03.%20Jak%20nainstalovat%20Codeium%20do%20Neovim/"
|
|
class="btn-preview drac-btn drac-btn-outline drac-text-white drac-text-cyan-green--hover">
|
|
<i class="fa fa-arrow-left"></i> Previous
|
|
</a>
|
|
</div>
|
|
<div class="col">
|
|
<a href="../05.%20Barevn%C3%A9%20sch%C3%A9ma/"
|
|
class="btn-preview drac-btn drac-btn-outline drac-text-white drac-text-cyan-green--hover" style="padding-left: 3%;">
|
|
Next <i class="fa fa-arrow-right"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<!-- endblock -->
|
|
|
|
<!-- block search -->
|
|
<li class="nav-item"><div role="search" class="search-box">
|
|
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
|
<input type="text" name="q" class="drac-input drac-input-search drac-input-white drac-text-white drac-bg-black-secondary"
|
|
placeholder="Search docs" title="Type search term here" />
|
|
</form>
|
|
</div>
|
|
</li>
|
|
<!-- endblock -->
|
|
|
|
<!-- block source -->
|
|
<li class="nav-item">
|
|
|
|
</li>
|
|
<!-- endblock -->
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<!-- endblock -->
|
|
|
|
<!-- block content -->
|
|
<section class="p-md-5 section-content">
|
|
<article>
|
|
<p><h1 id="04-telescope">04. Telescope</h1>
|
|
<ul>
|
|
<li>
|
|
<p>Telescope is, created by one of the main members of the Neovim team - TJ Devries .</p>
|
|
</li>
|
|
<li>
|
|
<p>Side note, TJ posts a lot of Neovim related content on his YouTube channel and on his Twitch streams. In particular, his channel <a href="https://www.youtube.com/c/TJDeVries" target="_blank">YouTube</a> has been a great resource. Check it out!</p>
|
|
</li>
|
|
<li>
|
|
<p>Telescope is an essential plugin in my opinion. It's a fuzzy search engine built into Lua that can be configured in all sorts of ways. It adds a lot of functionality to your Neovim setup. I haven't realized its true potential yet, but it's awesome for file search and text search.</p>
|
|
</li>
|
|
</ul>
|
|
<p>I <em>have</em> tested this on both Linux and macOS, but it should work on Windows as well.</p>
|
|
<ul>
|
|
<li>Let's install it (we'll put all the commands in your terminal):</li>
|
|
<li>Paste this code into your <code>init</code> file.</li>
|
|
</ul>
|
|
<div class="codehilite"><pre><span></span><code><span class="k">call</span><span class="w"> </span><span class="nl">plug</span>#<span class="nv">begin</span><span class="ss">(</span><span class="nv">has</span><span class="ss">(</span><span class="s1">'nvim'</span><span class="ss">)</span><span class="w"> </span>?<span class="w"> </span><span class="nv">stdpath</span><span class="ss">(</span><span class="s1">'data'</span><span class="ss">)</span><span class="w"> </span>.<span class="w"> </span><span class="s1">'/plugged'</span><span class="w"> </span>:<span class="w"> </span><span class="s1">'~/.vim/plugged'</span><span class="ss">))</span>
|
|
|
|
<span class="err">" Telescope install Neovim</span>
|
|
<span class="s2">" Planery"</span>
|
|
<span class="nv">Plug</span><span class="w"> </span><span class="s1">'nvim-lua/plenary.nvim'</span>
|
|
<span class="err">" Telescope plugin</span>
|
|
<span class="err">Plug 'nvim-telescope/telescope.nvim'</span>
|
|
<span class="err">" Fuzzy Telescope fzf</span>
|
|
<span class="err">Plugin 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }</span>
|
|
|
|
<span class="err">call plug#end()</span>
|
|
</code></pre></div>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>Note that we are installing more than one plugin here. Telescope requires another plugin called <a href="https://github.com/nvim-lua/plenary.nvim" target="_blank">Planery</a>. And another plugin is <a href="https://github.com/nvim-telescope/telescope.nvim#sorters" target="_blank">Telescope Sorter</a>, which supports fzf and <a href="https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies" target="_blank">Telescope</a> syntax.</p>
|
|
</li>
|
|
<li>
|
|
<p><strong>To complete the installation, be sure to follow these three steps:</strong></p>
|
|
</li>
|
|
<li>Save init.vim <code>:w</code></li>
|
|
<li>Restore the source of init.vims <code>:so %</code> or restart <code>Neovim</code></li>
|
|
<li>
|
|
<p>Install the plugin using <code>:PlugInstall</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Next we need to configure Telescope. This is a common practice among Vim plugins. Telescope is a Lua based plugin.</p>
|
|
</li>
|
|
<li>
|
|
<p>First we need to create a new lua folder in the directory: <code>nvim ~/.config/nvim/lua</code>.</p>
|
|
</li>
|
|
</ul>
|
|
<div class="codehilite"><pre><span></span><code>cd ~/.config/nvim
|
|
mkdir lua
|
|
</code></pre></div>
|
|
|
|
<ul>
|
|
<li>Inside the lua directory, we will create a subdirectory for the namespace of our plugin configurations. To understand why this is necessary, we need to explain how Vim handles file lookups. In short, creating a namespace subdirectory inside the lua directory prevents unwanted file collisions .</li>
|
|
</ul>
|
|
<p>I decided to use my GitHub nick as the name of my subdirectory:</p>
|
|
<div class="codehilite"><pre><span></span><code>cd ~/.config/nvim/lua
|
|
mkdir kankys
|
|
</code></pre></div>
|
|
|
|
<ul>
|
|
<li>It doesn't matter what you name the directory. Once you create it, you'll want to move to it using cd:</li>
|
|
</ul>
|
|
<p><code>cd ~/.config/nvim/lua/your-directory-name</code></p>
|
|
<ul>
|
|
<li>
|
|
<p>Note: your-directory-name is used as a placeholder. Replace it with the name of your directory you want.</p>
|
|
</li>
|
|
<li>
|
|
<p>In the namespace directory, create a plugin-name.lua file for each plugin you want/need to configure. You create Telescope like this (we are persistent in <code>cd ~/.config/nvim/lua/your-directory-name</code>
|
|
):</p>
|
|
</li>
|
|
</ul>
|
|
<p><code>nvim telescope.lua</code></p>
|
|
<ul>
|
|
<li>
|
|
<p>A useful Vim tip is that you can open files before they exist. If you close a file without saving it, it won't be created! In the example above, we open telescope.luav in Neovim. If we save the file, it will be created.</p>
|
|
</li>
|
|
<li>
|
|
<p>Our configuration for Telescope will be:</p>
|
|
</li>
|
|
</ul>
|
|
<div class="codehilite"><pre><span></span><code><span class="n">local</span><span class="w"> </span><span class="n">telescope</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">require</span><span class="p">(</span><span class="s1">'telescope'</span><span class="p">)</span>
|
|
<span class="n">telescope</span><span class="o">.</span><span class="n">setup</span><span class="w"> </span><span class="p">{}</span>
|
|
<span class="n">telescope</span><span class="o">.</span><span class="n">load_extension</span><span class="p">(</span><span class="s1">'fzf'</span><span class="p">)</span>
|
|
</code></pre></div>
|
|
|
|
<ul>
|
|
<li>Paste this code into telescope.lua and save. Everything we need is in the telescope.lua file.</li>
|
|
<li>The above example gives us a first taste of Lua. I've found that a lot of plugins need at least this setup in lua:</li>
|
|
</ul>
|
|
<p><code>require('PLUGIN_NAME').setup {}</code></p>
|
|
<p>I won't dive deep into the Telescope configuration in this post. If you want to see some of the available setup options and additional customization, check out the <a href="https://github.com/nvim-telescope/telescope.nvim#customization" target="_blank">documentation</a>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>Don't forget to save telescope.lua and exit Neovim with <code>:wq</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Next, we need to tell our init.vim that a lua file exists somewhere:</p>
|
|
</li>
|
|
</ul>
|
|
<p>In my case, I would state:</p>
|
|
<p><code>lua require('kankys')</code> by pasting it into <code>~/.config/nvim/init.vim</code></p>
|
|
<p>A couple of notes:
|
|
* <strong>Paste this command under the vim-plug function ( `` call plug#end() )!</strong></p>
|
|
<ul>
|
|
<li>What does it do? At first it looks a bit magical and understanding it requires knowledge of Vim search, but basically this command will search for a lua file in your Vim runtime.</li>
|
|
<li>in our case it is:</li>
|
|
</ul>
|
|
<p><code>~/.config/nvim/lua/your-directory-name/telescope.lua</code></p>
|
|
<ul>
|
|
<li>Instead of requiring every configuration file in our init.vim, we can just require the namespace directory. For this to work, we'll need to add a new file to our namespace directory called init.lua:</li>
|
|
</ul>
|
|
<div class="codehilite"><pre><span></span><code><span class="n">cd ~/.config/nvim/lua/your-directory-name</span>
|
|
<span class="n">touch init.lua</span>
|
|
</code></pre></div>
|
|
|
|
<p>The * init.lua file can be thought of as an index file. Inside init.lua we can load all our configuration files.</p>
|
|
<ul>
|
|
<li>In <code>init-lua</code> let's put the following code:</li>
|
|
</ul>
|
|
<p><code>require('your-directory-name/telescope')</code></p>
|
|
<ul>
|
|
<li>
|
|
<p><strong>You can easily understand everything I've said above if you look at the nvim configuration files here on <a href="https://codeberg.org/ApolloNvim/ApolloNvim2025" target="_blank">Git</a>.</strong> </p>
|
|
</li>
|
|
<li>
|
|
<p>From now on, all new lua configuration files will be in <code>lua/your-directory-name</code>. </p>
|
|
</li>
|
|
</ul>
|
|
<h2 id="telescope">Telescope</h2>
|
|
<ul>
|
|
<li>
|
|
<p>Telescope has a number of <a href="https://github.com/nvim-telescope/telescope.nvim#vim-commands" target="_blank">commands</a> that can be used, <code>:Telescope</code> in NORMAL mode in Neovim. A quick way to see all the available commands is to type <code>:Telescope</code> followed by a space and then click <code><Tab></code>. The tab button opens a list of autocomplete, available commands in Telescope. You can navigate the list using <code><Tab></code> and <code><Shift-Tab></code> in the opposite direction.</p>
|
|
</li>
|
|
<li>
|
|
<p>The Telescope command is shown below, for demonstration purposes:
|
|
<code>:Telescope find_files</code></p>
|
|
</li>
|
|
</ul>
|
|
<p>You can view the Telescope documentation in Neovim by:</p>
|
|
<p><code>:h telescope</code></p>
|
|
<div style="text-align: center;">
|
|
Copyright © 2024 - 2025 🚀 ApolloNvim / Lukáš Kaňka
|
|
</div></p>
|
|
</article>
|
|
</section>
|
|
<!-- endblock -->
|
|
|
|
<!-- block footer -->
|
|
<footer>
|
|
<div class="d-flex flex-sm-row justify-content-between py-2 border-top drac-text-black drac-bg-cyan-green">
|
|
<a href="https://github.com/dracula/mkdocs" target="_blank" style="padding-left: 1%;"
|
|
class="footer-text drac-anchor drac-text-black drac-text-purple--hover">
|
|
Made with Dracula Theme for MkDocs
|
|
</a>
|
|
</div>
|
|
</footer>
|
|
<!-- endblock -->
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<script>var base_url = '../../..';</script>
|
|
<script src="../../../assets/js/jquery-3.3.1.slim.min.js"></script>
|
|
<script src="../../../assets/js/bootstrap.bundle.min.js"></script>
|
|
<script src="../../../assets/js/mkdocs.js"></script>
|
|
<script src="../../../javascripts/extra.js" defer></script>
|
|
<script src="../../../search/main.js" defer></script>
|
|
|
|
</body>
|
|
|
|
</html> |