aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/nvim/after/ftplugin/php.lua
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2022-04-11 16:02:13 +0900
committernsfisis <nsfisis@gmail.com>2022-04-11 16:02:13 +0900
commit95a7855e3977fbe4d5b4d599581f6ff7594e625a (patch)
treea9eee3f2ccf4bcc1c79429dc12b4d999ffc1f61b /.config/nvim/after/ftplugin/php.lua
parent9ed158fbfab84153882a33a51f58c02419fc3b63 (diff)
downloaddotfiles-95a7855e3977fbe4d5b4d599581f6ff7594e625a.tar.gz
dotfiles-95a7855e3977fbe4d5b4d599581f6ff7594e625a.tar.zst
dotfiles-95a7855e3977fbe4d5b4d599581f6ff7594e625a.zip
neovim:php: insert `declare(strict_types=1)` into an empty buffer
Diffstat (limited to '.config/nvim/after/ftplugin/php.lua')
-rw-r--r--.config/nvim/after/ftplugin/php.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/.config/nvim/after/ftplugin/php.lua b/.config/nvim/after/ftplugin/php.lua
index 9e4b15b..f6433f5 100644
--- a/.config/nvim/after/ftplugin/php.lua
+++ b/.config/nvim/after/ftplugin/php.lua
@@ -1,13 +1,15 @@
vimrc.after_ftplugin('php', function(conf)
- -- If a buffer is empty, insert `<?php` tag and 2 blank lines, and position the
- -- cursor at the end of the buffer (line 3, column 0).
+ -- If a buffer is empty, insert a template and position the
+ -- cursor at the end of the buffer.
--
-- Example:
-- <?php
--
+ -- declare(strict_types=1);
+ --
-- [cursor]
if vim.fn.line('$') == 1 and vim.fn.getline(1) == '' then
- vim.fn.setline(1, { '<?php', '', '' })
- vim.fn.cursor(3, 0)
+ vim.fn.setline(1, { '<?php', '', 'declare(strict_types=1);', '', '' })
+ vim.fn.cursor(6, 0)
end
end)