aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/nvim/after/ftplugin/php.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/after/ftplugin/php.lua')
-rw-r--r--.config/nvim/after/ftplugin/php.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/php.lua b/.config/nvim/after/ftplugin/php.lua
new file mode 100644
index 0000000..8c03f57
--- /dev/null
+++ b/.config/nvim/after/ftplugin/php.lua
@@ -0,0 +1,15 @@
+vimrc.after_ftplugin('php', function(conf)
+ conf.indent(conf.SPACE, 2)
+
+ -- 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).
+ --
+ -- Example:
+ -- <?php
+ --
+ -- [cursor]
+ if vim.fn.line('$') == 1 and vim.fn.getline(1) == '' then
+ vim.fn.setline(1, { '<?php', '', '' })
+ vim.fn.cursor(3, 0)
+ end
+end)