This commit is contained in:
luba 2024-04-15 07:47:47 -03:00
parent 23773900d9
commit 4108bc6c73
1 changed files with 80 additions and 6 deletions

View File

@ -100,6 +100,8 @@ vim.g.have_nerd_font = false
-- Make line numbers default -- Make line numbers default
vim.opt.number = true vim.opt.number = true
vim.opt.relativenumber = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it! -- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true -- vim.opt.relativenumber = true
@ -162,10 +164,15 @@ vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('i', '<C-c>', '<Esc>')
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) 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', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) 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' }) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
vim.keymap.set('n', '<C-u>', '<C-u>zz')
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which -- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
@ -204,6 +211,14 @@ vim.api.nvim_create_autocmd('TextYankPost', {
end, end,
}) })
vim.cmd [[
augroup pencil
autocmd!
autocmd FileType markdown,mkd call pencil#init()
autocmd FileType text call pencil#init()
augroup END
]]
-- [[ Install `lazy.nvim` plugin manager ]] -- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
@ -442,6 +457,7 @@ require('lazy').setup({
-- Neovim. This is where `mason` and related plugins come into play. -- Neovim. This is where `mason` and related plugins come into play.
-- --
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully -- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- vim.opt.relativenumber = true
-- and elegantly composed help section, `:help lsp-vs-treesitter` -- and elegantly composed help section, `:help lsp-vs-treesitter`
-- This function gets run when an LSP attaches to a particular buffer. -- This function gets run when an LSP attaches to a particular buffer.
@ -540,7 +556,7 @@ require('lazy').setup({
local servers = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
-- pyright = {}, pyright = {},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
-- --
@ -626,15 +642,52 @@ require('lazy').setup({
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" }, python = { 'isort', 'black' },
-- --
-- You can use a sub-list to tell conform to run *until* a formatter -- You can use a sub-list to tell conform to run *until* a formatter
-- is found. -- is found.
-- javascript = { { "prettierd", "prettier" } }, json = { 'prettier' },
}, },
}, },
}, },
{
'mfussenegger/nvim-lint',
event = {
'BufReadPre',
'BufNewFile',
},
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
-- python = { 'mypy' },
-- typescript = { 'eslint_d' },
-- javascriptreact = { 'eslint_d' },
-- typescriptreact = { 'eslint_d' },
-- svelte = { 'eslint_d' },
-- kotlin = { 'ktlint' },
-- terraform = { 'tflint' },
-- ruby = { 'standardrb' },
dockerfile = { 'hadolint' },
json = { 'jsonlint' },
}
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set('n', '<leader>ll', function()
lint.try_lint()
end, { desc = 'Trigger linting for current file' })
end,
},
{ -- Autocompletion { -- Autocompletion
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
event = 'InsertEnter', event = 'InsertEnter',
@ -745,13 +798,13 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is. -- change the command in the config to whatever the name of that colorscheme is.
-- --
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim', 'rebelot/kanagawa.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins. priority = 1000, -- Make sure to load this before all the other start plugins.
init = function() init = function()
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' vim.cmd.colorscheme 'kanagawa-dragon'
-- You can configure highlights by doing something like: -- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none' vim.cmd.hi 'Comment gui=none'
@ -802,7 +855,7 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate', build = ':TSUpdate',
opts = { opts = {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { highlight = {
@ -828,6 +881,27 @@ require('lazy').setup({
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
end, end,
}, },
{
'preservim/vim-markdown',
dependencies = {
'godlygeek/tabular',
},
config = function()
vim.g.vim_markdown_folding_disabled = 1
vim.g.vim_markdown_toc_autofit = 1
vim.g.vim_markdown_borderless_table = 1
end,
},
{ 'junegunn/goyo.vim' },
{
'preservim/vim-pencil',
opt = false,
config = function()
vim.g.tex_conceal = ''
vim.g['pencil#conceallevel'] = 1
vim.g['pencil#wrapModeDefault'] = 'soft'
end,
},
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and -- init.lua. If you want these files, they are in the repository, so you can just download them and