big update

This commit is contained in:
2025-02-06 22:12:19 +01:00
parent 8050e0b608
commit e8378a20d4
53 changed files with 3509 additions and 407 deletions

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>18. Konfigurace plaginu v Lua souboru - 🚀 ApolloNvim</title>
<title>Configuring plagin in Lua file - 🚀 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">
@ -89,7 +89,7 @@
</li>
<li class="drac-box">
<a href="../../.."
class="
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
@ -128,6 +128,110 @@
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="./"
class=" active
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>
@ -163,6 +267,22 @@
<!-- block preview -->
<li class="nav-item">
<div class="container">
<div class="row row-preview">
<div class="col">
<a href="../17.%20Jak%20opravit%20nefunk%C4%8Dn%C3%AD%20Prettier/"
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="../20.%20N%C3%A1hledy%20markdown%20v%20nvim/"
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 -->
@ -193,22 +313,21 @@
<!-- block content -->
<section class="p-md-5 section-content">
<article>
<p><h1 id="18-konfigurace-plaginu-v-lua-souboru">18. Konfigurace plaginu v Lua souboru</h1>
<p>Některé pluginy pro svůj chod potřebují na konfigurovat. Tyto konfigurace se provádějí v jazyce <a href="https://www.lua.org/" target="_blank">Lua</a>. Většinou bývá pravidlem že konfiguraci najdete na GitHubu u jednotlivých pluginů, mi ji jen musíme zkopírovat či případně upravit dle svých preferencí a uložit do souborů kde máme Neovim.</p>
<p>Máme dvě možnosti jak takovou konfiguraci uložit. Buď do souboru <code>init.vim</code> nebo pro lepší přehlednost do souboru lua kde bude mít každý plugin svůj soubor.</p>
<h5 id="prvni-zpusob">První způsob:</h5>
<p>Toto je jednoduší způsob konfigurace jejím přidání do 'init.vim'.</p>
<p><h3 id="configuring-plagin-in-lua-file">Configuring plagin in Lua file</h3>
<p>Some plugins need to be configured to work. These configurations are done in <a href="https://www.lua.org/" target="_blank">Lua</a>. As a rule, you can find the configuration on GitHub for each plugin, we just need to copy it or modify it according to our preferences and save it in the files where we have Neovim. </p>
<p>We have two options how to save such configuration. Either in the <code>init.vim</code> file or for better clarity in a lua file where each plugin will have its own file.</p>
<h5 id="first-way">First way:</h5>
<p>This is the simpler way of configuring it by adding it to <code>init.vim</code>.</p>
<ol>
<li>V souboru 'init.vim' vytvoříme tyto dvě značky:</li>
<li>In the 'init.vim' file, create the following two tags:</li>
</ol>
<div class="codehilite"><pre><span></span><code><span class="nv">lua</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="nv">EOF</span>
<span class="nv">EOF</span>
</code></pre></div>
<ol>
<li>A mezi ně vložíme samotný config, například takto:</li>
<li>And insert the config itself between them, for example as follows:</li>
</ol>
<div class="codehilite"><pre><span></span><code><span class="nv">lua</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="nv">EOF</span>
<span class="c1">-- nvim-lightbulb setup</span>
@ -218,40 +337,40 @@
<span class="nv">EOF</span>
</code></pre></div>
<p>A dále pod sebe přidáváme jednotlivé značky 'lua &lt;&lt; EOF' 'EOF' a do nich vklkádat konfigurace.</p>
<h5 id="druhy-zpusob">Druhý způsob:</h5>
<p>Tento způsob je o trochu složitější, ale pomůže lépe organizovat konfigurační soubory a mít lepší přehled.</p>
<p>Next, we add the individual 'lua &lt;&lt; EOF' 'EOF' tags to the subwebs and inject the configurations into them.</p>
<h5 id="second-way">Second way:</h5>
<p>This way is a bit more complicated, but it will help to organize the configuration files and have a better overview.</p>
<ol>
<li>do souboru 'init.vim' přidáme tento řádek:</li>
<li>add this line to the 'init.vim' file:</li>
</ol>
<div class="codehilite"><pre><span></span><code><span class="nv">lua</span><span class="w"> </span><span class="nb">require</span><span class="p">(</span><span class="s1">&#39;kankys&#39;</span><span class="p">)</span><span class="w"> </span>
</code></pre></div>
<p>Tím jsme si naimprtovali soubor do kterého budeme importovat jednotlivé konfigurace.</p>
<p>With this, we've imprinted a file into which we will import each configuration.</p>
<ol>
<li>
<p>Ve složce Neovim kde máme soubor 'init.vim' vytvoříme složku 'lua'.</p>
<p>In the Neovim folder where we have the 'init.vim' file, we create the 'lua' folder.</p>
</li>
<li>
<p>Ve složce 'lua' vytvoříme složku s váším nickem nebo jak se vám zlíbí. V mém případě jsem zvolil 'kankys'.</p>
<p>In the 'lua' folder, create a folder with your nickname or whatever you like. In my case I chose 'kankys'.</p>
</li>
</ol>
<p>Měli by jste teď mít tutu strukturu: '~/.config/nvim/lua/kankys/'</p>
<p>You should now have this structure: '~/.config/nvim/lua/kankys/'</p>
<ol>
<li>Ve složce 'kankys' vytvoříme soubor:</li>
<li>In the 'kankys' folder, create a file:</li>
</ol>
<div class="codehilite"><pre><span></span><code><span class="n">init.lua</span>
</code></pre></div>
<p>Do něj budeme importovat jednotlivé konfigurace.</p>
<p>We will import the individual configurations into it.</p>
<ol>
<li>Vytvoříme se soubor s názvem pluginu s koncovkou lua kterého chceme konfigurovat.</li>
<li>We will create a file with the name of the plugin with the lua extension that we want to configure.</li>
</ol>
<p>Já budu chtít například konfigurovat plugin 'gitsings'.</p>
<p>For example, I will want to configure the plugin 'gitsings'.</p>
<ol>
<li>Vytvoříme ve složce 'kankys' soubor 'gitsings.lua'. Do něj vlažíme konfiguraci dle návodu z Githubu u pluginu.</li>
<li>We will create the file 'gitsings.lua' in the 'kankys' folder. Into it we put the configuration according to the Github instructions for the plugin.</li>
</ol>
<p>Soubor pak bude vypadat takto:</p>
<p>The file will then look like this:</p>
<div class="codehilite"><pre><span></span><code><span class="nb">require</span><span class="p">(</span><span class="s1">&#39;gitsigns&#39;</span><span class="p">).</span><span class="nv">setup</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">-- signs config</span>
<span class="w"> </span><span class="nv">current_line_blame</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span>
@ -261,18 +380,18 @@
<span class="p">}</span>
</code></pre></div>
<p>A uložíme ho.</p>
<p>And save it.</p>
<ol>
<li>Poslení bod na importovat konfiguraci do 'init.lua'</li>
<li>Send the point to import the configuration into 'init.lua'
We open the file 'init.lua' and paste into it:</li>
</ol>
<p>Otevřeme soubor 'init.lua' a do něj vložíme:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;kankys/gitsigns&#39;)
</code></pre></div>
<p>A soubor uložíme.</p>
<p>Takto budeme přidávat další importy do 'init.lua'.</p>
<p>And save the file.</p>
<p>This is how we will add more imports to 'init.lua'.</p>
<div style="text-align: center;">
Copyright © 2024 - 2025 ApolloNvim
Copyright © 2024 - 2025 🚀 ApolloNvim / Lukáš Kaňka
</div></p>
</article>
</section>