- VIM options updated for: autowrite, formatoptions, conceallevel,
  sidescrolloff, updatetime, wildmode
- LSP_config: options to display diagnostic icons, inlay hints
- Lint: codespell on "*" removed it wasn't working
- Formatting: ignore errors
- LuaSnip: Tab fix reversed, interfered with regular operations
- NVIM: Options for splitkeep & markdown_recommended_style
This commit is contained in:
Pratik Tripathy
2024-03-11 17:20:26 +05:30
parent b0c0dd0543
commit 12178dd96c
6 changed files with 42 additions and 19 deletions

View File

@@ -14,3 +14,6 @@ vim.opt.backupdir = vim.fn.stdpath("config") .. "/backup/"
vim.opt.wrap = true
vim.opt.cursorline = true
vim.opt.inccommand = "split" -- With :%s command, show the preview in a split instead of inline
vim.opt.splitkeep = "screen"
-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0

View File

@@ -74,16 +74,15 @@ return {
{
"L3MON4D3/LuaSnip",
keys = {
-- TODO: Verify if this fixed the tab-going-crazy-sometimes issue
-- {
-- "<tab>",
-- function()
-- return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
-- end,
-- expr = true,
-- silent = true,
-- mode = "i",
-- },
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true,
silent = true,
mode = "i",
},
{
"<tab>",
function()

View File

@@ -29,9 +29,11 @@ return {
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
timeout_ms = 3000,
quiet = false,
},
formatters = {
injected = { options = { ignore_errors = true } },
shfmt = {
prepend_args = { "-i", "4" },
},

View File

@@ -20,7 +20,6 @@ return {
typescriptreact = { "codespell" },
javascriptreact = { "codespell" },
html = { "codespell" },
["*"] = { "codespell" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

View File

@@ -36,14 +36,11 @@ return {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim", config = true },
{ "williamboman/mason-lspconfig.nvim" },
{ "folke/neodev.nvim" },
-- Useful status updates for LSP
{ "j-hui/fidget.nvim", opts = {} },
{ "folke/neodev.nvim" },
},
-- WARN: DO NOT do `config` here it would override `config` from coding-formatting.lua
-- That's why we do the LSP config inside mason-lspconfig
},
{
@@ -68,7 +65,7 @@ return {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
-- hint = { enable = true },
completion = { callSnippet = "Replace" },
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
@@ -127,10 +124,29 @@ return {
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
inlay_hints = { enabled = true },
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = {
spacing = 4,
source = "if_many",
prefix = "",
},
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = require("config.util").icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = require("config.util").icons.diagnostics.Warn,
[vim.diagnostic.severity.HINT] = require("config.util").icons.diagnostics.Hint,
[vim.diagnostic.severity.INFO] = require("config.util").icons.diagnostics.Info,
},
},
},
})
end,
})

View File

@@ -13,10 +13,12 @@ set shortmess+=I " Disable the default Vim startup message.
set shortmess+=s " Less verbose search messages
set mouse+=a " Enable mouse support
set encoding=utf-8 " Encoding
set autowrite " Enable auto write
set autoread " Auto reload file if externally changed
set nrformats-=octal " Do not let Ctrl-a + Ctrl-x work on octal format numbers
set formatoptions+=j " When joining lines with J, delete comment characters
set formatoptions=jcroqlnt " When joining lines with J, delete comment characters
set display+=truncate " @@@ is displayed in the 1st column of the last screen line
set conceallevel=2 " Hide * markup for bold and italic, but not markers with substitutions
set tabpagemax=50 " Max number of tabs
set viminfo^=!
set viewoptions-=options
@@ -24,7 +26,8 @@ set nolangremap " Do not use non-English keyboards to define keymaps
set list " Show tabs as >, trailing spaces as -, non-breakable space as +
set signcolumn=yes " Always show the signs column (before line number column)
set scrolloff=10 " Cursor always at middle of the screen
set updatetime=249 " No typing for this millisec -> write to swap file
set sidescrolloff=10
set updatetime=200 " No typing for this millisec -> write to swap file
set timeoutlen=500 " Multiple keys in keymaps must be pressed in these millisecs
set noswapfile " Turn off swapfiles
set history=10000 " Number of : commands to save
@@ -56,6 +59,7 @@ set complete-=i
set completeopt="menuone,noselect" " Better completion experience
set wildmenu " List and cycle through autocomplete on <Tab>
set wildignorecase " Case insensitive path completion
set wildmode="longest:full,full" " Command-line completion mode
" Remove trailing blank spaces on save
autocmd BufWritePre * %s/\s\+$//e