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 >}} +