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>11. Gitsigns drobné vylepšení git v Neovim - 🚀 ApolloNvim</title>
<title>Gitsigns minor improvements to git in Neovim - 🚀 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="./"
class=" active
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>
@ -163,6 +267,22 @@
<!-- block preview -->
<li class="nav-item">
<div class="container">
<div class="row row-preview">
<div class="col">
<a href="../10.%20vim-fugitive%20ovl%C3%A1dni%20Git%20v%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="../12.%20Je%C5%A1t%C4%9B%20lep%C5%A1%C3%AD%20Neovim%20s%20Zellij%20termin%C3%A1lov%C3%BDm%20multiplexorem/"
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,10 +313,10 @@
<!-- block content -->
<section class="p-md-5 section-content">
<article>
<p><h1 id="11-gitsigns-drobne-vylepseni-git-v-neovim">11. Gitsigns drobné vylepšení git v Neovim</h1>
<p>Skvělá věc při kódování je vidět smazané či upravené řádky v reálném čase.</p>
<p>Neovim toto standardně nepodporuje, takže použijeme gitsigns:</p>
<p>V našem init.vim přidáme:</p>
<p><h1 id="11-gitsigns-minor-improvements-to-git-in-neovim">11. Gitsigns minor improvements to git in Neovim</h1>
<p>The great thing about coding is seeing deleted or modified lines in real time.</p>
<p>Neovim doesn't support this by default, so we use gitsigns:</p>
<p>in our init.vim we add:</p>
<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="s1">&#39;~/.config/nvim/plugged&#39;</span><span class="ss">)</span>
<span class="err">&quot; gitsigns</span>
@ -205,49 +325,49 @@
<span class="err">call plug#end()</span>
</code></pre></div>
<p>Poznámka: gitsigns vyžaduje <code>nvim-lua/plenary.nvim</code>. Protože jsme ho nainstalovali pomocí <code>telescope</code>(<a href="https://apollonvim.codeberg.page/cz/apollonvim/tutorials/04.%20Jak%20nainstalovat%20Telescope%20do%20editoru%20Neovim/" target="_blank">04. Jak nainstalovat Telescope do editoru Neovim</a>, jsme pokryti.</p>
<p>Už víte, co máte dělat Uložit, zdroj a <code>:PlugInstall</code>.</p>
<p>Gitsigns vyžaduje volání a setup ve vaší konfiguraci, aby to fungovalo. Vytvořme <code>gitsigns.lua</code> soubor v našem jmenném adresáři:</p>
<p><code>nvim ~/.config/nvim/lua/tvůj-adresář/gitsigns.lua</code></p>
<p>A uvnitř tohoto souboru začneme:</p>
<p>Note: gitsigns requires <code>nvim-lua/plenary.nvim</code>. Since we installed it using <code>telescope</code> <a href="https://github.com/LukasKanka/ApolloNvim/blob/main/readme/04.%20Jak%20nainstalovat%20Telescope%20do%20editoru%20Neovim.md" target="_blank">04. How to install Telescope in the Neovim editor</a>, we are covered.</p>
<p>You already know what to do - Save, source and <code>:PlugInstall</code>.</p>
<p>Gitsigns requires a call and setup in your configuration to make it work. Let's create a <code>gitsigns.lua</code> file in our name directory:</p>
<p><code>nvim ~/.config/nvim/lua/your-directory/gitsigns.lua</code></p>
<p>And inside this file we start:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;gitsigns&#39;).setup {}
</code></pre></div>
<p>Pokud nezadáte žádné možnosti, plugin se spustí s výchozím nastavením.</p>
<p>Nyní přidáme gitsigns.luado našeho adresáře jmenného prostoru init.lua soubor:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;tvůj-adresář/telescope&#39;)
require(&#39;tvůj-adresář/lightline&#39;)
require(&#39;tvůj-adresář/gitsigns&#39;)
<p>If you don't specify any options, the plugin will start with the default settings.</p>
<p>Now we'll add gitsigns.luado our namespace directory init.lua file:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;your-directory/telescope&#39;)
require(&#39;your-directory/lightline&#39;)
require(&#39;your-directory/gitsigns&#39;)
</code></pre></div>
<p>Můj vypadá takto:</p>
<p>Mine looks like this:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;kankys/telescope&#39;)
require(&#39;kankys/lightline&#39;)
require(&#39;kankys/gitsigns&#39;)
require(&#39;kankys/lightline&#39;) require
(&#39;kankys/gitsigns&#39;)
</code></pre></div>
<p>Obnovíme zdroj tohoto souboru pomocí příkazu :source. Gitsigns můžete vidět v akci, když přejdete na projekt na vašem počítači, který je řízen pomocí git. Jakýkoli sledovaný soubor, který byl upraven, zobrazí tuto modifikaci .</p>
<p>Ačkoli to je technicky to, co chceme, umístění nápisu je trochu mimo. Je to proto, že musíme říct Vimovi, aby zobrazoval diagnostické znaky ve sloupci s číslem, nikoli nalevo od čísla. Otevřete svůj init.vim soubor a přidejte nový nastavení:</p>
<p>Restore the source of this file using the :source command. You can see Gitsigns in action when you navigate to a project on your machine that is managed by git. Any watched file that has been modified will show this modification .</p>
<p>While this is technically what we want, the placement of the sign is a bit off. This is because we need to tell Vim to display the diagnostic characters in the number column, not to the left of the number. Open your init.vim file and add a new setting:</p>
<div class="codehilite"><pre><span></span><code>&quot; ... general settings
set signcolumn=number
</code></pre></div>
<p>Ulož a obnov zdrouj <code>:source</code> init.vim souboru. Nyní by se vaše znaky měly zobrazovat ve sloupci čísel, nikoli vlevo. Chcete-li se dozvědět více o signcolumn spusťte v Neovimu následující příkaz:</p>
<p>Save and restore the <code>:source</code> init.vim file. Now your characters should appear in the number column, not on the left. To learn more about signcolumn run the following command in Neovim:</p>
<p><code>:h signcolumn</code></p>
<p>V VSCode je funkce, kterou v Neovim zoufale postrádám. Když jste v projektu, který používá Git, ponecháte kurzor na řádku po určitou dobu způsobí, že se nějaký virtuální text zobrazí v matné barvě. Text bude číst jméno vývojáře, který naposledy upravil řádek, datum modifikace a zprávu odevzdání.</p>
<p>Tuto funkci miluji. <code>vim-fugitive</code> má příkaz <code>:Git blame</code> příkaz, který řeší stejný případ použití, ale preferuji virtuální text. Chcete-li to povolit, jednoduše přidejte do konfigurace značek Git následující:</p>
<p>There is a feature in VSCode that is sorely missed in Neovim. When you are in a project that uses Git, leaving the cursor on a line for a certain amount of time will cause some virtual text to appear in a dull color. The text will read the name of the developer who last modified the line, the modification date, and the commit message.</p>
<p>I love this feature. The <code>vim-fugitive</code> has a <code>:Git blame</code> command that handles the same use case, but I prefer the virtual text. To enable this, simply add the following to your Git signage configuration:</p>
<div class="codehilite"><pre><span></span><code>require(&#39;gitsigns&#39;).setup {
-- signs config
current_line_blame = true,
current_line_blame_opts = {
virt_text_pos = &#39;right_align&#39;
}
}
-- signs config
current_line_blame = true,
current_line_blame_opts = {
virt_text_pos = &#39;right_align
&#39; }
}
</code></pre></div>
<p>A to je vše!</p>
<p>And that's it!</p>
<div style="text-align: center;">
Copyright © 2024 - 2025 ApolloNvim
Copyright © 2024 - 2025 🚀 ApolloNvim / Lukáš Kaňka
</div></p>
</article>
</section>