@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
9191vim .g .maplocalleader = ' '
9292
9393-- Set to true if you have a Nerd Font installed and selected in the terminal
94- vim .g .have_nerd_font = false
94+ vim .g .have_nerd_font = true
9595
9696-- [[ Setting options ]]
9797-- See `:help vim.opt`
@@ -162,8 +162,8 @@ vim.opt.hlsearch = true
162162vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
163163
164164-- Diagnostic keymaps
165- vim .keymap .set (' n' , ' [d ' , vim . diagnostic . goto_prev , { desc = ' Go to previous [D]iagnostic message ' })
166- vim .keymap .set (' n' , ' ]d ' , vim . diagnostic . goto_next , { desc = ' Go to next [D]iagnostic message ' })
165+ vim .keymap .set (' n' , ' <leader>qq ' , ' <CMD>q!<CR> ' , { desc = ' Quit all without close ' })
166+ vim .keymap .set (' n' , ' <C-s> ' , ' <CMD>w<CR> ' , { desc = ' Save a file ' })
167167vim .keymap .set (' n' , ' <leader>e' , vim .diagnostic .open_float , { desc = ' Show diagnostic [E]rror messages' })
168168vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
169169
@@ -209,37 +209,46 @@ vim.api.nvim_create_autocmd('TextYankPost', {
209209local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
210210if not vim .loop .fs_stat (lazypath ) then
211211 local lazyrepo = ' https://github.com/folke/lazy.nvim.git'
212+ vim .cmd ' set expandtab'
213+ vim .cmd ' set tabstop=2'
214+ vim .cmd ' set softtabstop=2'
215+ vim .cmd ' set shiftwidth=2'
212216 vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
213217end --- @diagnostic disable-next-line : undefined-field
214218vim .opt .rtp :prepend (lazypath )
215219
216- -- [[ Configure and install plugins ]]
220+ vim .cmd ' set expandtab'
221+ vim .cmd ' set tabstop=2'
222+ vim .cmd ' set softtabstop=2'
223+ vim .cmd ' set shiftwidth=2'
217224--
218- -- To check the current status of your plugins, run
219- -- :Lazy
220- --
221- -- You can press `?` in this menu for help. Use `:q` to close the window
222- --
223- -- To update plugins you can run
224- -- :Lazy update
225- --
226- -- NOTE: Here is where you install your plugins.
227225require (' lazy' ).setup ({
228226 -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
229227 ' tpope/vim-sleuth' , -- Detect tabstop and shiftwidth automatically
230-
231- -- NOTE: Plugins can also be added by using a table,
232- -- with the first argument being the link and the following
233- -- keys can be used to configure plugin behavior/loading/etc.
234- --
235- -- Use `opts = {}` to force a plugin to be loaded.
236- --
237- -- This is equivalent to:
238- -- require('Comment').setup({})
239-
240228 -- "gc" to comment visual regions/lines
241229 { ' numToStr/Comment.nvim' , opts = {} },
242-
230+ {
231+ ' nvimtools/none-ls.nvim' ,
232+ optional = true ,
233+ dependencies = {
234+ {
235+ ' williamboman/mason.nvim' ,
236+ opts = function (_ , opts )
237+ opts .ensure_installed = opts .ensure_installed or {}
238+ vim .list_extend (opts .ensure_installed , { ' gomodifytags' , ' impl' })
239+ end ,
240+ },
241+ },
242+ opts = function (_ , opts )
243+ local nls = require ' null-ls'
244+ opts .sources = vim .list_extend (opts .sources or {}, {
245+ nls .builtins .code_actions .gomodifytags ,
246+ nls .builtins .code_actions .impl ,
247+ nls .builtins .formatting .goimports ,
248+ nls .builtins .formatting .gofumpt ,
249+ })
250+ end ,
251+ },
243252 -- Here is a more advanced example where we pass configuration
244253 -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
245254 -- require('gitsigns').setup({ ... })
@@ -257,7 +266,6 @@ require('lazy').setup({
257266 },
258267 },
259268 },
260-
261269 -- NOTE: Plugins can also be configured to run Lua code when they are loaded.
262270 --
263271 -- This is often very useful to both group configuration, as well as handle
@@ -566,18 +574,40 @@ require('lazy').setup({
566574 -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
567575 local servers = {
568576 -- clangd = {},
569- -- gopls = {},
570- -- pyright = {},
571- -- rust_analyzer = {},
572- -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
573- --
574- -- Some languages (like typescript) have entire language plugins that can be useful:
575- -- https://github.com/pmizio/typescript-tools.nvim
576- --
577- -- But for many setups, the LSP (`tsserver`) will work just fine
578- -- tsserver = {},
579- --
580-
577+ gopls = {
578+ gofumpt = true ,
579+ codelenses = {
580+ gc_details = false ,
581+ generate = true ,
582+ regenerate_cgo = true ,
583+ run_govulncheck = true ,
584+ test = true ,
585+ tidy = true ,
586+ upgrade_dependency = true ,
587+ vendor = true ,
588+ },
589+ hints = {
590+ assignVariableTypes = true ,
591+ compositeLiteralFields = true ,
592+ compositeLiteralTypes = true ,
593+ constantValues = true ,
594+ functionTypeParameters = true ,
595+ parameterNames = true ,
596+ rangeVariableTypes = true ,
597+ },
598+ analyses = {
599+ fieldalignment = true ,
600+ nilness = true ,
601+ unusedparams = true ,
602+ unusedwrite = true ,
603+ useany = true ,
604+ },
605+ usePlaceholders = true ,
606+ completeUnimported = true ,
607+ staticcheck = true ,
608+ directoryFilters = { ' -.git' , ' -.vscode' , ' -.idea' , ' -.vscode-test' , ' -node_modules' },
609+ semanticTokens = true ,
610+ },
581611 lua_ls = {
582612 -- cmd = {...},
583613 -- filetypes = { ...},
@@ -652,6 +682,7 @@ require('lazy').setup({
652682 end ,
653683 formatters_by_ft = {
654684 lua = { ' stylua' },
685+ go = { ' gofmt' , ' goimports' , ' golines' },
655686 -- Conform can also run multiple formatters sequentially
656687 -- python = { "isort", "black" },
657688 --
@@ -835,7 +866,20 @@ require('lazy').setup({
835866 ' nvim-treesitter/nvim-treesitter' ,
836867 build = ' :TSUpdate' ,
837868 opts = {
838- ensure_installed = { ' bash' , ' c' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' vim' , ' vimdoc' },
869+ ensure_installed = {
870+ ' bash' ,
871+ ' c' ,
872+ ' html' ,
873+ ' lua' ,
874+ ' luadoc' ,
875+ ' markdown' ,
876+ ' vim' ,
877+ ' vimdoc' ,
878+ ' go' ,
879+ ' gomod' ,
880+ ' gowork' ,
881+ ' gosum' ,
882+ },
839883 -- Autoinstall languages that are not installed
840884 auto_install = true ,
841885 highlight = {
0 commit comments