@@ -99,10 +99,10 @@ vim.g.have_nerd_font = false
9999-- For more options, you can see `:help option-list`
100100
101101-- Make line numbers default
102- vim .opt .number = true
102+ -- vim.opt.number = true
103103-- You can also add relative line numbers, to help with jumping.
104104-- Experiment for yourself to see if you like it!
105- -- vim.opt.relativenumber = true
105+ vim .opt .relativenumber = true
106106
107107-- Enable mouse mode, can be useful for resizing splits for example!
108108vim .opt .mouse = ' a'
@@ -189,6 +189,12 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
189189vim .keymap .set (' n' , ' <C-j>' , ' <C-w><C-j>' , { desc = ' Move focus to the lower window' })
190190vim .keymap .set (' n' , ' <C-k>' , ' <C-w><C-k>' , { desc = ' Move focus to the upper window' })
191191
192+ -- Map 'jj' to <Esc> in insert mode for quick exit from insert mode
193+ vim .keymap .set (' i' , ' jj' , ' <Esc>' , { desc = ' Exit insert mode' , noremap = true })
194+
195+ vim .keymap .set (' v' , ' J' , " :m '>+1<CR>gv=gv" )
196+ vim .keymap .set (' v' , ' K' , " :m '<-2<CR>gv=gv" )
197+
192198-- [[ Basic Autocommands ]]
193199-- See `:help lua-guide-autocommands`
194200
@@ -203,6 +209,14 @@ vim.api.nvim_create_autocmd('TextYankPost', {
203209 end ,
204210})
205211
212+ -- Key mapping to open init.lua
213+ vim .api .nvim_set_keymap (
214+ ' n' , -- mode: normal
215+ ' <leader>ev' , -- key combination, e.g., \ev if your leader is \
216+ ' :e ~/.config/nvim/init.lua<CR>' , -- command to execute
217+ { noremap = true , silent = true } -- options
218+ )
219+
206220-- [[ Install `lazy.nvim` plugin manager ]]
207221-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
208222local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
@@ -230,6 +244,30 @@ require('lazy').setup({
230244 -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
231245 ' tpope/vim-sleuth' , -- Detect tabstop and shiftwidth automatically
232246
247+ ' tpope/vim-fugitive' ,
248+
249+ {
250+ ' windwp/nvim-autopairs' ,
251+ -- Optional dependency
252+ dependencies = { ' hrsh7th/nvim-cmp' },
253+ config = function ()
254+ require (' nvim-autopairs' ).setup {}
255+ -- If you want to automatically add `(` after selecting a function or method
256+ local cmp_autopairs = require ' nvim-autopairs.completion.cmp'
257+ local cmp = require ' cmp'
258+ cmp .event :on (' confirm_done' , cmp_autopairs .on_confirm_done ())
259+ end ,
260+ },
261+
262+ {
263+ ' stevearc/oil.nvim' ,
264+ opts = {},
265+ dependencies = { { ' echasnovski/mini.icons' , opts = {} } },
266+ -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
267+ -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
268+ lazy = false ,
269+ },
270+
233271 -- NOTE: Plugins can also be added by using a table,
234272 -- with the first argument being the link and the following
235273 -- keys can be used to configure plugin behavior/loading/etc.
@@ -410,6 +448,11 @@ require('lazy').setup({
410448 pcall (require (' telescope' ).load_extension , ' fzf' )
411449 pcall (require (' telescope' ).load_extension , ' ui-select' )
412450
451+ local function nextError ()
452+ vim .diagnostic .goto_next { severity = { vim .diagnostic .severity .ERROR , vim .diagnostic .severity .WARN } }
453+ end
454+ vim .keymap .set (' n' , ' ]e' , nextError , { desc = ' Next Diagnostic' })
455+
413456 -- See `:help telescope.builtin`
414457 local builtin = require ' telescope.builtin'
415458 vim .keymap .set (' n' , ' <leader>sh' , builtin .help_tags , { desc = ' [S]earch [H]elp' })
@@ -668,7 +711,8 @@ require('lazy').setup({
668711 -- https://github.com/pmizio/typescript-tools.nvim
669712 --
670713 -- But for many setups, the LSP (`ts_ls`) will work just fine
671- -- ts_ls = {},
714+ ts_ls = {},
715+ eslint = {},
672716 --
673717
674718 lua_ls = {
@@ -757,11 +801,21 @@ require('lazy').setup({
757801 end ,
758802 formatters_by_ft = {
759803 lua = { ' stylua' },
760- -- Conform can also run multiple formatters sequentially
761- -- python = { "isort", "black" },
762- --
763- -- You can use 'stop_after_first' to run the first available formatter from the list
764- -- javascript = { "prettierd", "prettier", stop_after_first = true },
804+ javascript = { ' prettierd' , ' prettier' },
805+ typescript = { ' prettierd' , ' prettier' },
806+ javascriptreact = { ' prettierd' , ' prettier' },
807+ typescriptreact = { ' prettierd' , ' prettier' },
808+ json = { ' prettierd' , ' prettier' },
809+ css = { ' prettierd' , ' prettier' },
810+ html = { ' prettierd' , ' prettier' },
811+ yaml = { ' prettierd' , ' prettier' },
812+ markdown = { ' prettierd' , ' prettier' },
813+ },
814+ formatters = {
815+ prettier = {
816+ -- makes it prefer the local project Prettier
817+ prefer_local = ' node_modules/.bin' ,
818+ },
765819 },
766820 },
767821 },
0 commit comments