From 7f217ecbd7760db0bf350fbbdd4d04e306458318 Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 21 Nov 2024 13:33:55 +0300 Subject: [PATCH] nvim fix go indention --- home/user/.config/nvim/after/ftplugin/go.lua | 5 ++++ .../.config/nvim/after/ftplugin/python.lua | 25 +------------------ home/user/.editorconfig | 5 +++- 3 files changed, 10 insertions(+), 25 deletions(-) create mode 100644 home/user/.config/nvim/after/ftplugin/go.lua diff --git a/home/user/.config/nvim/after/ftplugin/go.lua b/home/user/.config/nvim/after/ftplugin/go.lua new file mode 100644 index 0000000..ee0dfe8 --- /dev/null +++ b/home/user/.config/nvim/after/ftplugin/go.lua @@ -0,0 +1,5 @@ +local opt = vim.opt_local + +opt.expandtab = false +opt.tabstop = 4 +opt.shiftwidth = 4 \ No newline at end of file diff --git a/home/user/.config/nvim/after/ftplugin/python.lua b/home/user/.config/nvim/after/ftplugin/python.lua index fb9cfc8..c64f1ac 100644 --- a/home/user/.config/nvim/after/ftplugin/python.lua +++ b/home/user/.config/nvim/after/ftplugin/python.lua @@ -4,27 +4,4 @@ vim.g.python_indent = { continue = 'shiftwidth()', closed_paren_align_last_line = false, searchpair_timeout = 150, -} - - -vim.api.nvim_create_autocmd("InsertCharPre", { - pattern = { "*.py" }, - group = vim.api.nvim_create_augroup("py-fstring", { clear = true }), - ---@param params NvimAutocmdCallbackParams - callback = function(params) - if vim.v.char ~= "{" then return end - - local node = vim.treesitter.get_node({}) - - if not node then return end - - if node:type() ~= "string" then node = node:parent() end - - if not node or node:type() ~= "string" then return end - local row, col, _, _ = vim.treesitter.get_node_range(node) - local first_char = vim.api.nvim_buf_get_text(params.buf, row, col, row, col + 1, {})[1] - if first_char == "f" then return end - - vim.api.nvim_input("m'" .. row + 1 .. "gg" .. col + 1 .. "|if`'la") - end, -}) \ No newline at end of file +} \ No newline at end of file diff --git a/home/user/.editorconfig b/home/user/.editorconfig index 413eb56..3f06b49 100644 --- a/home/user/.editorconfig +++ b/home/user/.editorconfig @@ -22,4 +22,7 @@ indent_size = tab tab_width = 4 [*.json] -insert_final_newline = true \ No newline at end of file +insert_final_newline = true + +[*.go] +indent_style = tab \ No newline at end of file