Add vim execution post
This commit is contained in:
parent
5afbfe6499
commit
3d8283b241
28
content/post/easy_execute_in_vim.md
Normal file
28
content/post/easy_execute_in_vim.md
Normal file
@ -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 <F2> :.w !psql<CR>
|
||||||
|
map <F3> :.,/;/w !psql<CR>
|
||||||
|
map <F4> :w !psql<CR>
|
||||||
|
```
|
||||||
|
|
||||||
|
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 >}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user