@@ -176,10 +176,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
176176vim .keymap .set (' t' , ' <Esc><Esc>' , ' <C-\\ ><C-n>' , { desc = ' Exit terminal mode' })
177177
178178-- TIP: Disable arrow keys in normal mode
179- -- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
180- -- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
181- -- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
182- -- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
179+ vim .keymap .set (' n' , ' <left>' , ' <cmd>echo "Use h to move!!"<CR>' )
180+ vim .keymap .set (' n' , ' <right>' , ' <cmd>echo "Use l to move!!"<CR>' )
181+ vim .keymap .set (' n' , ' <up>' , ' <cmd>echo "Use k to move!!"<CR>' )
182+ vim .keymap .set (' n' , ' <down>' , ' <cmd>echo "Use j to move!!"<CR>' )
183183
184184-- Keybinds to make split navigation easier.
185185-- Use CTRL+<hjkl> to switch between windows
@@ -207,7 +207,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
207207-- [[ Install `lazy.nvim` plugin manager ]]
208208-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
209209local lazypath = vim .fn .stdpath ' data' .. ' /lazy/lazy.nvim'
210- if not vim .uv .fs_stat (lazypath ) then
210+ if not ( vim .uv or vim . loop ) .fs_stat (lazypath ) then
211211 local lazyrepo = ' https://github.com/folke/lazy.nvim.git'
212212 local out = vim .fn .system { ' git' , ' clone' , ' --filter=blob:none' , ' --branch=stable' , lazyrepo , lazypath }
213213 if vim .v .shell_error ~= 0 then
@@ -274,20 +274,55 @@ require('lazy').setup({
274274 { -- Useful plugin to show you pending keybinds.
275275 ' folke/which-key.nvim' ,
276276 event = ' VimEnter' , -- Sets the loading event to 'VimEnter'
277- config = function () -- This is the function that runs, AFTER loading
278- require (' which-key' ).setup ()
277+ opts = {
278+ icons = {
279+ -- set icon mappings to true if you have a Nerd Font
280+ mappings = vim .g .have_nerd_font ,
281+ -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
282+ -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
283+ keys = vim .g .have_nerd_font and {} or {
284+ Up = ' <Up> ' ,
285+ Down = ' <Down> ' ,
286+ Left = ' <Left> ' ,
287+ Right = ' <Right> ' ,
288+ C = ' <C-…> ' ,
289+ M = ' <M-…> ' ,
290+ D = ' <D-…> ' ,
291+ S = ' <S-…> ' ,
292+ CR = ' <CR> ' ,
293+ Esc = ' <Esc> ' ,
294+ ScrollWheelDown = ' <ScrollWheelDown> ' ,
295+ ScrollWheelUp = ' <ScrollWheelUp> ' ,
296+ NL = ' <NL> ' ,
297+ BS = ' <BS> ' ,
298+ Space = ' <Space> ' ,
299+ Tab = ' <Tab> ' ,
300+ F1 = ' <F1>' ,
301+ F2 = ' <F2>' ,
302+ F3 = ' <F3>' ,
303+ F4 = ' <F4>' ,
304+ F5 = ' <F5>' ,
305+ F6 = ' <F6>' ,
306+ F7 = ' <F7>' ,
307+ F8 = ' <F8>' ,
308+ F9 = ' <F9>' ,
309+ F10 = ' <F10>' ,
310+ F11 = ' <F11>' ,
311+ F12 = ' <F12>' ,
312+ },
313+ },
279314
280315 -- Document existing key chains
281- require ( ' which-key ' ). add {
282- { ' <leader>c' , group = ' [C]ode' },
316+ spec = {
317+ { ' <leader>c' , group = ' [C]ode' , mode = { ' n ' , ' x ' } },
283318 { ' <leader>d' , group = ' [D]ocument' },
284319 { ' <leader>r' , group = ' [R]ename' },
285320 { ' <leader>s' , group = ' [S]earch' },
286321 { ' <leader>w' , group = ' [W]orkspace' },
287322 { ' <leader>t' , group = ' [T]oggle' },
288323 { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
289- }
290- end ,
324+ },
325+ } ,
291326 },
292327
293328 -- NOTE: Plugins can specify dependencies.
@@ -470,8 +505,9 @@ require('lazy').setup({
470505 --
471506 -- In this case, we create a function that lets us more easily define mappings specific
472507 -- for LSP related items. It sets the mode, buffer and description for us each time.
473- local map = function (keys , func , desc )
474- vim .keymap .set (' n' , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
508+ local map = function (keys , func , desc , mode )
509+ mode = mode or ' n'
510+ vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
475511 end
476512
477513 -- Jump to the definition of the word under your cursor.
@@ -505,7 +541,7 @@ require('lazy').setup({
505541
506542 -- Execute a code action, usually your cursor needs to be on top of an error
507543 -- or a suggestion from your LSP for this to activate.
508- map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' )
544+ map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' , { ' n ' , ' x ' } )
509545
510546 -- WARN: This is not Goto Definition, this is Goto Declaration.
511547 -- For example, in C this would take you to the header.
@@ -578,8 +614,8 @@ require('lazy').setup({
578614 -- Some languages (like typescript) have entire language plugins that can be useful:
579615 -- https://github.com/pmizio/typescript-tools.nvim
580616 --
581- -- But for many setups, the LSP (`tsserver `) will work just fine
582- -- tsserver = {},
617+ -- But for many setups, the LSP (`ts_ls `) will work just fine
618+ -- ts_ls = {},
583619 --
584620
585621 lua_ls = {
@@ -620,7 +656,7 @@ require('lazy').setup({
620656 local server = servers [server_name ] or {}
621657 -- This handles overriding only values explicitly passed
622658 -- by the server configuration above. Useful when disabling
623- -- certain features of an LSP (for example, turning off formatting for tsserver )
659+ -- certain features of an LSP (for example, turning off formatting for ts_ls )
624660 server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
625661 require (' lspconfig' )[server_name ].setup (server )
626662 end ,
@@ -637,7 +673,7 @@ require('lazy').setup({
637673 {
638674 ' <leader>f' ,
639675 function ()
640- require (' conform' ).format { async = true , lsp_fallback = true }
676+ require (' conform' ).format { async = true , lsp_format = ' fallback ' }
641677 end ,
642678 mode = ' ' ,
643679 desc = ' [F]ormat buffer' ,
@@ -650,9 +686,15 @@ require('lazy').setup({
650686 -- have a well standardized coding style. You can add additional
651687 -- languages here or re-enable it for the disabled ones.
652688 local disable_filetypes = { c = true , cpp = true }
689+ local lsp_format_opt
690+ if disable_filetypes [vim .bo [bufnr ].filetype ] then
691+ lsp_format_opt = ' never'
692+ else
693+ lsp_format_opt = ' fallback'
694+ end
653695 return {
654696 timeout_ms = 500 ,
655- lsp_fallback = not disable_filetypes [ vim . bo [ bufnr ]. filetype ] ,
697+ lsp_format = lsp_format_opt ,
656698 }
657699 end ,
658700 formatters_by_ft = {
@@ -788,13 +830,13 @@ require('lazy').setup({
788830 -- change the command in the config to whatever the name of that colorscheme is.
789831 --
790832 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
791- ' folke/tokyonight. nvim' ,
833+ ' catppuccin/ nvim' ,
792834 priority = 1000 , -- Make sure to load this before all the other start plugins.
793835 init = function ()
794836 -- Load the colorscheme here.
795837 -- Like many other themes, this one has different styles, and you could load
796838 -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
797- vim .cmd .colorscheme ' tokyonight-night '
839+ vim .cmd .colorscheme ' catppuccin-mocha '
798840
799841 -- You can configure highlights by doing something like:
800842 vim .cmd .hi ' Comment gui=none'
@@ -844,6 +886,8 @@ require('lazy').setup({
844886 { -- Highlight, edit, and navigate code
845887 ' nvim-treesitter/nvim-treesitter' ,
846888 build = ' :TSUpdate' ,
889+ main = ' nvim-treesitter.configs' , -- Sets main module to use for opts
890+ -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
847891 opts = {
848892 ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' },
849893 -- Autoinstall languages that are not installed
@@ -857,19 +901,12 @@ require('lazy').setup({
857901 },
858902 indent = { enable = true , disable = { ' ruby' } },
859903 },
860- config = function (_ , opts )
861- -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
862-
863- --- @diagnostic disable-next-line : missing-fields
864- require (' nvim-treesitter.configs' ).setup (opts )
865-
866- -- There are additional nvim-treesitter modules that you can use to interact
867- -- with nvim-treesitter. You should go explore a few and see what interests you:
868- --
869- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
870- -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
871- -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
872- end ,
904+ -- There are additional nvim-treesitter modules that you can use to interact
905+ -- with nvim-treesitter. You should go explore a few and see what interests you:
906+ --
907+ -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
908+ -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
909+ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
873910 },
874911
875912 -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
@@ -886,7 +923,7 @@ require('lazy').setup({
886923 require ' kickstart.plugins.lint' ,
887924 require ' kickstart.plugins.autopairs' ,
888925 -- require 'kickstart.plugins.neo-tree',
889- -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
926+ require ' kickstart.plugins.gitsigns' , -- adds gitsigns recommend keymaps
890927
891928 -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
892929 -- This is the easiest way to modularize your config.
0 commit comments