Skip to content

Commit 633dd0f

Browse files
author
darumo
committed
update pluging to support formatting and spell checker
1 parent dfc05a3 commit 633dd0f

File tree

1 file changed

+71
-17
lines changed

1 file changed

+71
-17
lines changed

init.lua

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,20 @@ I hope you enjoy your Neovim journey,
8383
8484
P.S. You can delete this when you're done too. It's your config now! :)
8585
--]]
86-
87-
-- Set <space> as the leader key
86+
-- Configure netrw to open on the right side
87+
vim.g.netrw_banner = 0 -- Hide the banner
88+
vim.g.netrw_liststyle = 3 -- Use a tree-like view
89+
vim.g.netrw_winsize = 20 -- Set explorer width
90+
vim.g.netrw_altv = 1 -- Open in right vertical split
91+
vim.opt.tabstop = 4
92+
vim.opt.shiftwidth = 4
93+
vim.opt.expandtab = true
94+
vim.opt.softtabstop = 4
95+
vim.opt.spell = true -- Enable spell checking
96+
vim.opt.spelllang = 'en' -- Set spell check language to English
97+
vim.opt.foldmethod = 'indent' -- Fold based on indentation
98+
vim.opt.foldlevel = 99 -- Open all folds by default
99+
vim.opt.foldenable = true -- Enable folding-- Set <space> as the leader key
88100
-- See `:help mapleader`
89101
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
90102
vim.g.mapleader = ' '
@@ -166,6 +178,11 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
166178
-- Diagnostic keymaps
167179
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
168180

181+
-- Map <leader>p to open netrw in a vertical split
182+
vim.keymap.set('n', '<leader>p', function()
183+
vim.cmd 'vertical rightbelow Lexplore 25' -- Open on the right
184+
end, { desc = 'Open file explorer [P]' })
185+
169186
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
170187
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
171188
-- is not what someone will guess without a bit more experience.
@@ -594,14 +611,14 @@ require('lazy').setup({
594611
})
595612

596613
-- Change diagnostic symbols in the sign column (gutter)
597-
-- if vim.g.have_nerd_font then
598-
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
599-
-- local diagnostic_signs = {}
600-
-- for type, icon in pairs(signs) do
601-
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
602-
-- end
603-
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
604-
-- end
614+
if vim.g.have_nerd_font then
615+
local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
616+
local diagnostic_signs = {}
617+
for type, icon in pairs(signs) do
618+
diagnostic_signs[vim.diagnostic.severity[type]] = icon
619+
end
620+
vim.diagnostic.config { signs = { text = diagnostic_signs } }
621+
end
605622

606623
-- LSP servers and clients are able to communicate to each other what features they support.
607624
-- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -622,7 +639,7 @@ require('lazy').setup({
622639
local servers = {
623640
-- clangd = {},
624641
-- gopls = {},
625-
-- pyright = {},
642+
pyright = {},
626643
-- rust_analyzer = {},
627644
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
628645
--
@@ -643,7 +660,7 @@ require('lazy').setup({
643660
callSnippet = 'Replace',
644661
},
645662
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
646-
-- diagnostics = { disable = { 'missing-fields' } },
663+
diagnostics = { disable = { 'missing-fields' } },
647664
},
648665
},
649666
},
@@ -682,7 +699,32 @@ require('lazy').setup({
682699
}
683700
end,
684701
},
685-
702+
{
703+
'pmizio/typescript-tools.nvim',
704+
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
705+
opts = {
706+
settings = {
707+
tsserver_plugins = {
708+
-- Add support for styled-components, remove if not needed
709+
'@styled/typescript-styled-plugin',
710+
},
711+
-- Ensures proper Next.js support
712+
tsserver_file_preferences = {
713+
includeInlayParameterNameHints = 'all',
714+
includeInlayVariableTypeHints = true,
715+
},
716+
tsserver_format_options = {
717+
allowRenameOfImportPath = true,
718+
},
719+
complete_function_calls = true, -- Auto-complete function arguments
720+
},
721+
},
722+
config = function()
723+
require('typescript-tools').setup {
724+
capabilities = require('cmp_nvim_lsp').default_capabilities(),
725+
}
726+
end,
727+
},
686728
{ -- Autoformat
687729
'stevearc/conform.nvim',
688730
event = { 'BufWritePre' },
@@ -749,7 +791,6 @@ require('lazy').setup({
749791
{
750792
'rafamadriz/friendly-snippets',
751793
config = function()
752-
require('luasnip.loaders.from_vscode').lazy_load()
753794
require('luasnip.loaders.from_vscode').lazy_load { paths = { vim.fn.stdpath 'config' .. '/snippets' } }
754795
end,
755796
},
@@ -794,7 +835,7 @@ require('lazy').setup({
794835
-- Accept ([y]es) the completion.
795836
-- This will auto-import if your LSP supports it.
796837
-- This will expand snippets if the LSP sent a snippet.
797-
['<C-y>'] = cmp.mapping.confirm { select = true },
838+
['<Enter>'] = cmp.mapping.confirm { select = true },
798839

799840
-- If you prefer more traditional completion keymaps,
800841
-- you can uncomment the following lines
@@ -905,9 +946,9 @@ require('lazy').setup({
905946
'nvim-treesitter/nvim-treesitter',
906947
build = ':TSUpdate',
907948
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
908-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
949+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
909950
opts = {
910-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
951+
ensure_installed = { 'bash', 'c', 'diff', 'html', 'javascript', 'typescript', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
911952
-- Autoinstall languages that are not installed
912953
auto_install = true,
913954
highlight = {
@@ -926,6 +967,19 @@ require('lazy').setup({
926967
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
927968
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
928969
},
970+
{
971+
'prichrd/netrw.nvim',
972+
opts = {},
973+
config = function()
974+
require('netrw').setup {
975+
976+
mappings = {
977+
-- String mappings are executed as vim commands
978+
['<Leader>p'] = ':Explore<CR>',
979+
},
980+
}
981+
end,
982+
},
929983

930984
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
931985
-- init.lua. If you want these files, they are in the repository, so you can just download them and

0 commit comments

Comments
 (0)