From 3d8283b2413eabebea247c0f4382efcae62fb842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Thu, 27 Oct 2022 10:38:02 +0200 Subject: [PATCH] Add vim execution post --- content/post/easy_execute_in_vim.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 content/post/easy_execute_in_vim.md diff --git a/content/post/easy_execute_in_vim.md b/content/post/easy_execute_in_vim.md new file mode 100644 index 0000000..fc0a47c --- /dev/null +++ b/content/post/easy_execute_in_vim.md @@ -0,0 +1,28 @@ +--- +title: "Vim shortcuts to execute current line" +date: 2022-05-25T15:15:55+02:00 +draft: false +image: "uploads/logos/vim.png" +tags: [vim] +categories: [vim, English] +--- + +I recently had to write a lot of SQL code and thought it would be very neat to have some vim shortcuts to execute the current line or the current command. +I want to share this with everyone as the second command needed some try-and-error on my part. + +Adding the following to `~/.vimrc` + +``` +map :.w !psql +map :.,/;/w !psql +map :w !psql +``` + +will enable you to execute the current line in psql with `F2`. `F3` executes the current line and the next lines until a`;`. +`F4` executes the whole file. + + +This can easily adapted to your needs. If you have any questions or improvemnts feel free to use the chat below. + +{{< chat vim-shortcuts >}} +