From 3c6eff64b5a19cf6763b9a7eff3ccf85707961db Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Tue, 19 Jul 2022 18:59:48 +0930 Subject: [PATCH] Tue 19 Jul 2022 18:59:48 ACST --- .config/nvim/lua/general/autocmd.lua | 5 ++++ .config/nvim/lua/packer-plugins.lua | 6 ++-- .config/nvim/plugin/go.lua | 1 + .config/nvim/plugin/packer_compiled.lua | 37 ++++++++++--------------- .config/nvim/plugin/treesitter.lua | 24 ++++++++++++++++ 5 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 .config/nvim/plugin/go.lua create mode 100644 .config/nvim/plugin/treesitter.lua diff --git a/.config/nvim/lua/general/autocmd.lua b/.config/nvim/lua/general/autocmd.lua index e64256e..f49f3ee 100644 --- a/.config/nvim/lua/general/autocmd.lua +++ b/.config/nvim/lua/general/autocmd.lua @@ -2,6 +2,11 @@ -- Remove any trailing whitespace from the file on write vim.api.nvim_create_autocmd({ 'BufWritePre' }, { command = [[%s/\s\+$//e]] }) +vim.api.nvim_create_autocmd({ 'BufWritePre' }, { + pattern = { '*.go' }, + callback = function () require('go.format').gofmt() end, +}) + -- Load file on last line -- TODO: change this to use lua vim.api.nvim_create_autocmd({ 'BufRead' }, { diff --git a/.config/nvim/lua/packer-plugins.lua b/.config/nvim/lua/packer-plugins.lua index a4c2099..9141520 100644 --- a/.config/nvim/lua/packer-plugins.lua +++ b/.config/nvim/lua/packer-plugins.lua @@ -18,8 +18,10 @@ return require('packer').startup(function() use 'dart-lang/dart-vim-plugin' - use { 'fatih/vim-go', cmd = 'GoUpdateBinaries' } - use { 'darrikonn/vim-gofmt', cmd = 'GoUpdateBinaries' } + use { 'nvim-treesitter/nvim-treesitter' } + + use 'ray-x/go.nvim' + use 'ray-x/guihua.lua' use 'aserowy/tmux.nvim' end) diff --git a/.config/nvim/plugin/go.lua b/.config/nvim/plugin/go.lua new file mode 100644 index 0000000..e26b510 --- /dev/null +++ b/.config/nvim/plugin/go.lua @@ -0,0 +1 @@ +require('go').setup() diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index d8d5d7c..0a85bcf 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -84,11 +84,26 @@ _G.packer_plugins = { path = "/home/tovi/.local/share/nvim/site/pack/packer/start/git-blame.nvim", url = "https://github.com/f-person/git-blame.nvim" }, + ["go.nvim"] = { + loaded = true, + path = "/home/tovi/.local/share/nvim/site/pack/packer/start/go.nvim", + url = "https://github.com/ray-x/go.nvim" + }, gruvbox = { loaded = true, path = "/home/tovi/.local/share/nvim/site/pack/packer/start/gruvbox", url = "https://github.com/gruvbox-community/gruvbox" }, + ["guihua.lua"] = { + loaded = true, + path = "/home/tovi/.local/share/nvim/site/pack/packer/start/guihua.lua", + url = "https://github.com/ray-x/guihua.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/tovi/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, ["packer.nvim"] = { loaded = true, path = "/home/tovi/.local/share/nvim/site/pack/packer/start/packer.nvim", @@ -123,32 +138,10 @@ _G.packer_plugins = { loaded = true, path = "/home/tovi/.local/share/nvim/site/pack/packer/start/tmux.nvim", url = "https://github.com/aserowy/tmux.nvim" - }, - ["vim-go"] = { - commands = { "GoUpdateBinaries" }, - loaded = false, - needs_bufread = true, - only_cond = false, - path = "/home/tovi/.local/share/nvim/site/pack/packer/opt/vim-go", - url = "https://github.com/fatih/vim-go" - }, - ["vim-gofmt"] = { - commands = { "GoUpdateBinaries" }, - loaded = false, - needs_bufread = true, - only_cond = false, - path = "/home/tovi/.local/share/nvim/site/pack/packer/opt/vim-gofmt", - url = "https://github.com/darrikonn/vim-gofmt" } } time([[Defining packer_plugins]], false) - --- Command lazy-loads -time([[Defining lazy-load commands]], true) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file GoUpdateBinaries lua require("packer.load")({'vim-go', 'vim-gofmt'}, { cmd = "GoUpdateBinaries", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -time([[Defining lazy-load commands]], false) - if should_profile then save_profiles() end end) diff --git a/.config/nvim/plugin/treesitter.lua b/.config/nvim/plugin/treesitter.lua new file mode 100644 index 0000000..1ddb230 --- /dev/null +++ b/.config/nvim/plugin/treesitter.lua @@ -0,0 +1,24 @@ +require('nvim-treesitter.configs').setup { + -- A list of parser names, or "all" + ensure_installed = { 'go', 'dart' }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + auto_install = true, + + -- List of parsers to ignore installing (for "all") + ignore_install = { "javascript" }, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +}