update pluging to support formatting and spell checker
This commit is contained in:
parent
dfc05a3e9d
commit
633dd0fa7c
86
init.lua
86
init.lua
@ -83,8 +83,20 @@ I hope you enjoy your Neovim journey,
|
|||||||
|
|
||||||
P.S. You can delete this when you're done too. It's your config now! :)
|
P.S. You can delete this when you're done too. It's your config now! :)
|
||||||
--]]
|
--]]
|
||||||
|
-- Configure netrw to open on the right side
|
||||||
-- Set <space> as the leader key
|
vim.g.netrw_banner = 0 -- Hide the banner
|
||||||
|
vim.g.netrw_liststyle = 3 -- Use a tree-like view
|
||||||
|
vim.g.netrw_winsize = 20 -- Set explorer width
|
||||||
|
vim.g.netrw_altv = 1 -- Open in right vertical split
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.spell = true -- Enable spell checking
|
||||||
|
vim.opt.spelllang = 'en' -- Set spell check language to English
|
||||||
|
vim.opt.foldmethod = 'indent' -- Fold based on indentation
|
||||||
|
vim.opt.foldlevel = 99 -- Open all folds by default
|
||||||
|
vim.opt.foldenable = true -- Enable folding-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
@ -166,6 +178,11 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
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' })
|
||||||
|
|
||||||
|
-- Map <leader>p to open netrw in a vertical split
|
||||||
|
vim.keymap.set('n', '<leader>p', function()
|
||||||
|
vim.cmd 'vertical rightbelow Lexplore 25' -- Open on the right
|
||||||
|
end, { desc = 'Open file explorer [P]' })
|
||||||
|
|
||||||
-- 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
|
||||||
-- is not what someone will guess without a bit more experience.
|
-- is not what someone will guess without a bit more experience.
|
||||||
@ -594,14 +611,14 @@ require('lazy').setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Change diagnostic symbols in the sign column (gutter)
|
-- Change diagnostic symbols in the sign column (gutter)
|
||||||
-- if vim.g.have_nerd_font then
|
if vim.g.have_nerd_font then
|
||||||
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
||||||
-- local diagnostic_signs = {}
|
local diagnostic_signs = {}
|
||||||
-- for type, icon in pairs(signs) do
|
for type, icon in pairs(signs) do
|
||||||
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
|
diagnostic_signs[vim.diagnostic.severity[type]] = icon
|
||||||
-- end
|
end
|
||||||
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
|
vim.diagnostic.config { signs = { text = diagnostic_signs } }
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||||
@ -622,7 +639,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
|
||||||
--
|
--
|
||||||
@ -643,7 +660,7 @@ require('lazy').setup({
|
|||||||
callSnippet = 'Replace',
|
callSnippet = 'Replace',
|
||||||
},
|
},
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
diagnostics = { disable = { 'missing-fields' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -682,7 +699,32 @@ require('lazy').setup({
|
|||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'pmizio/typescript-tools.nvim',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
|
||||||
|
opts = {
|
||||||
|
settings = {
|
||||||
|
tsserver_plugins = {
|
||||||
|
-- Add support for styled-components, remove if not needed
|
||||||
|
'@styled/typescript-styled-plugin',
|
||||||
|
},
|
||||||
|
-- Ensures proper Next.js support
|
||||||
|
tsserver_file_preferences = {
|
||||||
|
includeInlayParameterNameHints = 'all',
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
},
|
||||||
|
tsserver_format_options = {
|
||||||
|
allowRenameOfImportPath = true,
|
||||||
|
},
|
||||||
|
complete_function_calls = true, -- Auto-complete function arguments
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('typescript-tools').setup {
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufWritePre' },
|
event = { 'BufWritePre' },
|
||||||
@ -749,7 +791,6 @@ require('lazy').setup({
|
|||||||
{
|
{
|
||||||
'rafamadriz/friendly-snippets',
|
'rafamadriz/friendly-snippets',
|
||||||
config = function()
|
config = function()
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load { paths = { vim.fn.stdpath 'config' .. '/snippets' } }
|
require('luasnip.loaders.from_vscode').lazy_load { paths = { vim.fn.stdpath 'config' .. '/snippets' } }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -794,7 +835,7 @@ require('lazy').setup({
|
|||||||
-- Accept ([y]es) the completion.
|
-- Accept ([y]es) the completion.
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
['<Enter>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
-- If you prefer more traditional completion keymaps,
|
-- If you prefer more traditional completion keymaps,
|
||||||
-- you can uncomment the following lines
|
-- you can uncomment the following lines
|
||||||
@ -907,7 +948,7 @@ require('lazy').setup({
|
|||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'javascript', 'typescript', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
@ -926,6 +967,19 @@ require('lazy').setup({
|
|||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'prichrd/netrw.nvim',
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
require('netrw').setup {
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
-- String mappings are executed as vim commands
|
||||||
|
['<Leader>p'] = ':Explore<CR>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user