From b4fb4b607639097301d71838bb20a8a611683cc9 Mon Sep 17 00:00:00 2001 From: Travis Sanon Date: Sat, 7 Sep 2024 12:41:59 -0700 Subject: [PATCH] feat: personalize config --- init.lua | 40 ++++++++++++++++++++++++------- lua/kickstart/plugins/lint.lua | 5 ++++ lua/kickstart/plugins/neotest.lua | 18 ++++++++++++++ 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 lua/kickstart/plugins/neotest.lua diff --git a/init.lua b/init.lua index 88658ef3..83730afb 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -176,10 +176,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -190,6 +190,10 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Remap and to also center cursor on page +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -630,6 +634,7 @@ require('lazy').setup({ lazy = false, keys = { { + -- Format file on command 'f', function() require('conform').format { async = true, lsp_fallback = true } @@ -657,7 +662,16 @@ require('lazy').setup({ -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. - -- javascript = { { "prettierd", "prettier" } }, + javascript = { { 'prettierd', 'prettier' } }, + typescript = { { 'prettierd', 'prettier' } }, + javascriptreact = { { 'prettierd', 'prettier' } }, + typescriptreact = { { 'prettierd', 'prettier' } }, + css = { { 'prettierd', 'prettier' } }, + html = { { 'prettierd', 'prettier' } }, + json = { { 'prettierd', 'prettier' } }, + yaml = { { 'prettierd', 'prettier' } }, + markdown = { { 'prettierd', 'prettier' } }, + python = { 'isort', 'black' }, }, }, }, @@ -864,6 +878,13 @@ require('lazy').setup({ end, }, + { + 'nvim-neorg/neorg', + lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default + version = '*', -- Pin Neorg to the latest stable release + config = true, + }, + -- The following two 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 -- place them in the correct locations. @@ -873,9 +894,10 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.neotest', -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7f0dc42f..815d1ae8 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -7,6 +7,11 @@ return { local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + javascript = { 'eslint_d' }, + typescript = { 'eslint_d' }, + javascriptreact = { 'eslint_d' }, + typescriptreact = { 'eslint_d' }, + python = { 'pylint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, diff --git a/lua/kickstart/plugins/neotest.lua b/lua/kickstart/plugins/neotest.lua new file mode 100644 index 00000000..b7b5e069 --- /dev/null +++ b/lua/kickstart/plugins/neotest.lua @@ -0,0 +1,18 @@ +return { + 'nvim-neotest/neotest', + dependencies = { 'haydenmeade/neotest-jest' }, + config = function() + require('neotest').setup { + adapters = { + require 'neotest-jest' { + jestCommand = 'npm test --', + jestConfigFile = 'custom.jest.config.ts', + env = { CI = true }, + cwd = function() + return vim.fn.getcwd() + end, + }, + }, + } + end, +}