{"id":12220,"date":"2023-12-16T15:39:57","date_gmt":"2023-12-16T14:39:57","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=12220"},"modified":"2023-12-16T15:40:40","modified_gmt":"2023-12-16T14:40:40","slug":"praktische-funktionen-rund-um-den-editor-vim","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/12\/16\/praktische-funktionen-rund-um-den-editor-vim\/","title":{"rendered":"Praktische Funktionen rund um den Editor Vim"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Nach der internen Weihnachtsfeier der IT gestern, versuche ich heute meinen Kopf langsam wieder in Schwung zu bekommen &#8230; Heute einige praktische Tipps rund um den Editor <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/03\/vim-der-professionelle-editor-fuer-das-terminal-unter-linux-einfuehrung\/\" data-type=\"post\" data-id=\"535\">Vim<\/a> unter Linux.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hier erst einige oft genutzte Befehle (<em>&#8222;N&#8220; ersetzen Sie durch die Anzahl<\/em>):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Beschreibung<\/strong><\/td><td><strong>Befehl<\/strong><\/td><td><strong>Kurzer Befehl<\/strong><\/td><\/tr><tr><td>Zeilennummern anzeigen<\/td><td>:set number<\/td><td>:se nu<\/td><\/tr><tr><td>Zeilennummern nicht anzeigen<\/td><td>:set nonumber<\/td><td>:se nonu<\/td><\/tr><tr><td>Zeilenbreite in Zeichen angeben<\/td><td>:set linewidth=N<\/td><td><\/td><\/tr><tr><td>Die aktuelle Zeile markieren<\/td><td>:set cursorline<\/td><td><\/td><\/tr><tr><td>Die aktuelle Zeile nicht mehr markieren<\/td><td>:set nocursorliine<\/td><td><\/td><\/tr><tr><td>Die aktuelle Spalte markieren<\/td><td>:set cursorcolumn<\/td><td><\/td><\/tr><tr><td>Die aktuelle Spalte nicht mehr markieren<\/td><td>:set nocursorcolumn<\/td><td><\/td><\/tr><tr><td>Syntax einschalten<\/td><td>:syntax on<\/td><td>:syn on<\/td><\/tr><tr><td>Syntax auschalten<\/td><td>:syntax off<\/td><td>:syn off<\/td><\/tr><tr><td>Schriftart festlegen<\/td><td>:set guifont=schriftart<\/td><td><\/td><\/tr><tr><td>Farbschema festlegen<\/td><td>:colorscheme farbschema<\/td><td>:colors<\/td><\/tr><tr><td>Zeilennummern erh\u00f6hen<\/td><td>:set numberwidth=N<\/td><td><\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Tabelle &#8211; einige Befehle<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Mehr zu Zeilennummern<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Haben Sie die Zeilennummern aktiviert, hat dies nicht nur den Vorteil, die aktuelle Zeilennummer anzuzeigen, also zu sehen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps.jpeg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"516\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1024x516.jpeg\" alt=\"\" class=\"wp-image-12229\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1024x516.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1536x775.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2048x1033.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-150x76.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-300x151.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-768x387.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Sie k\u00f6nnen auch die Zeile angeben, in die Sie springen wollen. M\u00f6chten Sie beispielsweise in die Zeile 40 springen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:40<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Schriftarten<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Einige gerne genutzten Schriftarten unter Vim sind Hack und FiraCode &#8211; unter Debian installieren Sie diese \u00fcber die Paket-Verwaltung durch die Pakete &#8222;<strong>fonts-hack<\/strong>&#8220; und &#8222;<strong>fonts-firacode<\/strong>&#8222;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install fonts-hack fonts-firacode<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt k\u00f6nnen Sie etwa die Schriftart Hack mit folgendem Befehl ausw\u00e4hlen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:guifont=Hack<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sie k\u00f6nnen auch gleich die Schriftgr\u00f6\u00dfe angeben, etwa 18:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:guifont=Hack\\ 18<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Farbschemas<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Im Systemverzeichnis &#8222;<em>\/usr\/share\/vim\/vim90\/colors<\/em>&#8220; finden Sie bereits vorinstallierte Farbschemas:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1.jpeg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"641\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-1024x641.jpeg\" alt=\"\" class=\"wp-image-12233\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-1024x641.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-1536x961.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-2048x1282.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-1-768x481.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier finden Sie beispielsweise das Farbschema &#8222;<strong>pablo<\/strong>&#8222;, um dieses auszuw\u00e4hlen nutzen Sie den Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:colorscheme pablo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:colorscheme<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Und der Tastenkombination <kbd>Strg+d<\/kbd> k\u00f6nnen Sie sich die installierten Farbschemas direkt in Vim anzeigen lassen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2.jpeg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-1024x547.jpeg\" alt=\"\" class=\"wp-image-12236\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-1024x547.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-1536x820.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-2048x1094.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-150x80.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-300x160.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-2-768x410.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt k\u00f6nnen Sie das gew\u00fcnschte Farbschema direkt eingeben und mit <kbd>Eingabe<\/kbd> aktivieren, mit <kbd>Esc<\/kbd>, <kbd>Esc<\/kbd> brechen Sie ab. Unter <a href=\"https:\/\/vimcolorschemes.com\/\">Vim Colorschemes<\/a> finden Sie \u00fcbrigens zahlreiche weitere Farbschemas zum Ansehen und den Link zur Anleitung f\u00fcr die Installation unter GitHub.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntastic &#8211; Code auf Korrektheit pr\u00fcfen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Syntastic ist ein Plugin, das Code auf seine Korrektheit pr\u00fcft &#8211; die Installation gelingt \u00fcber Ihre &#8222;<strong>.vimrc<\/strong>&#8222;, indem Sie folgenden Code einf\u00fcgen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>call plug#begin()\nPlug 'vim-syntastic\/syntastic'\n100 call plug#end()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sie speichern die Datei, starten Vim und f\u00fchren folgenden Befehl aus:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:PlugInstall\n:q\n:q<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Das Plugin kennt aktuell folgende Sprachen: ACPI Quellsprache, ActionScript, Ada, Ansible-Konfigurationen, API Blueprint, AppleScript, AsciiDoc, Assemblersprachen, BEMHTML, Bro, Bourne Shell, C, C++, C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo-Metadaten, GLSL, Go, Haml, Haskell, Haxe, Lenker, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM-Zwischensprache, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Raku, OS X- und iOS-Eigenschaftslisten, Pug (ehemals Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM-Spezifikation, Ruby, SASS\/SCSS, Scala, Slim, SML, Solidity, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Verilog, VHDL, Vim Hilfe, VimL, \u200b\u200bVue.js, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG-Datenmodelle, YARA-Regeln, z80, Zope-Seitenvorlagen und Zsh.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Eine weitere Beschreibung finden Sie unter <a href=\"https:\/\/vimawesome.com\/plugin\/syntastic-care-of-itself\">Vim Awesome<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vim Tutor &#8211; lernen, mit Vim zu arbeiten<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vim Tutor ist in Vim automatisch mit eingebaut und hilft dabei, mit Vim zu arbeiten, die Software besser kennenzulernen. Sie starten diese Hilfe direkt aus Vim heraus mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:help vimtutor<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1.jpeg\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-1024x547.jpeg\" alt=\"\" class=\"wp-image-12243\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-1024x547.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-1536x820.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-2048x1094.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-150x80.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-300x160.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-3-1-768x410.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Vim Adventures &#8211; die Tasten lernen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/vim-adventures.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Vim Adventures<\/a> ist ein Browserspiel, in dem Sie lernen, mit welchen Tasten Sie sich schnell im Code innerhalb von Vim bewegen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-scaled.jpeg\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"514\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-1024x514.jpeg\" alt=\"\" class=\"wp-image-12244\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-1024x514.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-1536x771.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-2048x1028.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-150x75.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-300x151.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/vim-tipps-4-768x386.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"12220\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">3    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"12220\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Nach der internen Weihnachtsfeier der IT gestern, versuche ich heute meinen Kopf langsam wieder in Schwung zu bekommen &#8230; Heute einige praktische Tipps rund um den Editor Vim unter Linux. Hier erst einige oft genutzte Befehle (&#8222;N&#8220; ersetzen Sie durch die Anzahl): Beschreibung Befehl Kurzer Befehl Zeilennummern anzeigen :set number :se nu Zeilennummern nicht anzeigen [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12244,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,740],"tags":[12,7,6,680],"class_list":["post-12220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-terminal","category-vim","tag-kommandozeile","tag-shell","tag-terminal","tag-vim"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/12220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=12220"}],"version-history":[{"count":2,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/12220\/revisions"}],"predecessor-version":[{"id":12246,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/12220\/revisions\/12246"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/12244"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=12220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=12220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=12220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}