transltr configuration

This commit is contained in:
Juan Miguel Rua 2024-04-29 22:36:59 +02:00
parent 8df3deb6fe
commit 5e10b36bd4
1 changed files with 82 additions and 38 deletions

120
init.lua
View File

@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.opt`
@ -162,8 +162,8 @@ vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>qq', '<CMD>q!<CR>', { desc = 'Quit all without close' })
vim.keymap.set('n', '<C-s>', '<CMD>w<CR>', { desc = 'Save a file' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
@ -209,37 +209,46 @@ vim.api.nvim_create_autocmd('TextYankPost', {
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
vim.cmd 'set expandtab'
vim.cmd 'set tabstop=2'
vim.cmd 'set softtabstop=2'
vim.cmd 'set shiftwidth=2'
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
-- [[ Configure and install plugins ]]
vim.cmd 'set expandtab'
vim.cmd 'set tabstop=2'
vim.cmd 'set softtabstop=2'
vim.cmd 'set shiftwidth=2'
--
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc.
--
-- Use `opts = {}` to force a plugin to be loaded.
--
-- This is equivalent to:
-- require('Comment').setup({})
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
{
'nvimtools/none-ls.nvim',
optional = true,
dependencies = {
{
'williamboman/mason.nvim',
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { 'gomodifytags', 'impl' })
end,
},
},
opts = function(_, opts)
local nls = require 'null-ls'
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.code_actions.gomodifytags,
nls.builtins.code_actions.impl,
nls.builtins.formatting.goimports,
nls.builtins.formatting.gofumpt,
})
end,
},
-- Here is a more advanced example where we pass configuration
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
-- require('gitsigns').setup({ ... })
@ -257,7 +266,6 @@ require('lazy').setup({
},
},
},
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
-- This is often very useful to both group configuration, as well as handle
@ -566,18 +574,40 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
--
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' },
semanticTokens = true,
},
lua_ls = {
-- cmd = {...},
-- filetypes = { ...},
@ -652,6 +682,7 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
go = { 'gofmt', 'goimports', 'golines' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
@ -835,7 +866,20 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
opts = {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
ensure_installed = {
'bash',
'c',
'html',
'lua',
'luadoc',
'markdown',
'vim',
'vimdoc',
'go',
'gomod',
'gowork',
'gosum',
},
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {