Apply custom settings
This commit is contained in:
parent
3338d39206
commit
6dcec70791
126
init.lua
126
init.lua
|
|
@ -1,89 +1,3 @@
|
|||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
======== .-----. ========
|
||||
======== .----------------------. | === | ========
|
||||
======== |.-""""""""""""""""""-.| |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || KICKSTART.NVIM || |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || || |-----| ========
|
||||
======== ||:Tutor || |:::::| ========
|
||||
======== |'-..................-'| |____o| ========
|
||||
======== `"")----------------(""` ___________ ========
|
||||
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
||||
======== /:::========| |==hjkl==:::\ \ required \ ========
|
||||
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
||||
======== ========
|
||||
=====================================================================
|
||||
=====================================================================
|
||||
|
||||
What is Kickstart?
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a starting point for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, understand
|
||||
what your configuration is doing, and modify it to suit your needs.
|
||||
|
||||
Once you've done that, you can start exploring, configuring and tinkering to
|
||||
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
||||
or immediately breaking it into modular pieces. It's up to you!
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example which will only take 10-15 minutes:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
After understanding a bit more about Lua, you can use `:help lua-guide` as a
|
||||
reference for how Neovim integrates Lua.
|
||||
- :help lua-guide
|
||||
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
|
||||
|
||||
If you don't know what this means, type the following:
|
||||
- <escape key>
|
||||
- :
|
||||
- Tutor
|
||||
- <enter key>
|
||||
|
||||
(If you already know the Neovim basics, you can skip this step.)
|
||||
|
||||
Once you've completed that, you can continue working through **AND READING** the rest
|
||||
of the kickstart init.lua.
|
||||
|
||||
Next, run AND READ `:help`.
|
||||
This will open up a help window with some basic information
|
||||
about reading, navigating and searching the builtin help documentation.
|
||||
|
||||
This should be the first place you go to look when you're stuck or confused
|
||||
with something. It's one of my favorite Neovim features.
|
||||
|
||||
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||
which is very useful when you're not exactly sure of what you're looking for.
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
These are hints about where to find more information about the relevant settings,
|
||||
plugins or Neovim features used in Kickstart.
|
||||
|
||||
NOTE: Look for lines like this
|
||||
|
||||
Throughout the file. These are for you, the reader, to help you understand what is happening.
|
||||
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
||||
for when you are first encountering a few different constructs in your Neovim config.
|
||||
|
||||
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now! :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
|
|
@ -91,7 +5,7 @@ vim.g.mapleader = ' '
|
|||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
|
|
@ -102,7 +16,7 @@ vim.g.have_nerd_font = false
|
|||
vim.o.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.o.relativenumber = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.o.mouse = 'a'
|
||||
|
|
@ -681,7 +595,7 @@ require('lazy').setup({
|
|||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
ts_ls = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
|
|
@ -773,6 +687,8 @@ require('lazy').setup({
|
|||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
javascript = { { 'prettier' } },
|
||||
typescript = { { 'prettier' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -881,20 +797,20 @@ require('lazy').setup({
|
|||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
-- 'folke/tokyonight.nvim',
|
||||
'navarasu/onedark.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('tokyonight').setup {
|
||||
styles = {
|
||||
comments = { italic = false }, -- Disable italics in comments
|
||||
},
|
||||
}
|
||||
|
||||
init = function()
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||
vim.cmd.colorscheme 'onedark'
|
||||
end,
|
||||
config = function()
|
||||
require('onedark').setup {
|
||||
style = 'darker',
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
@ -944,7 +860,7 @@ require('lazy').setup({
|
|||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'typescript', 'javascript' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
@ -973,18 +889,18 @@ 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.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'kickstart.plugins.neo-tree',
|
||||
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
'ysmb-wtsg/in-and-out.nvim',
|
||||
config = function()
|
||||
vim.keymap.set('i', '<C-CR>', function()
|
||||
require('in-and-out').in_and_out()
|
||||
end)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
return {
|
||||
{
|
||||
'David-Kunz/jester',
|
||||
config = function()
|
||||
local jester = require 'jester'
|
||||
require('which-key').register({
|
||||
j = {
|
||||
name = '[J]ester',
|
||||
s = {
|
||||
function()
|
||||
jester.run()
|
||||
end,
|
||||
'[S]ingle test',
|
||||
},
|
||||
f = {
|
||||
function()
|
||||
jester.run_file()
|
||||
end,
|
||||
'[F]ile test',
|
||||
},
|
||||
-- s = {
|
||||
-- name = '[S]ingle test',
|
||||
-- r = {
|
||||
-- function()
|
||||
-- jester.run()
|
||||
-- end,
|
||||
-- '[R]un',
|
||||
-- },
|
||||
-- d = {
|
||||
-- function()
|
||||
-- jester.debug()
|
||||
-- end,
|
||||
-- '[D]ebug',
|
||||
-- },
|
||||
-- ['1'] = 'which_key_ignore',
|
||||
-- },
|
||||
-- f = {
|
||||
-- name = '[F]ile test',
|
||||
-- r = {
|
||||
-- function()
|
||||
-- jester.run_file()
|
||||
-- end,
|
||||
-- '[R]un',
|
||||
-- },
|
||||
-- d = {
|
||||
-- function()
|
||||
-- jester.debug_file()
|
||||
-- end,
|
||||
-- '[D]ebug',
|
||||
-- },
|
||||
-- ['1'] = 'which_key_ignore',
|
||||
-- },
|
||||
['1'] = 'which_key_ignore',
|
||||
},
|
||||
}, { prefix = '<leader>' })
|
||||
|
||||
jester.setup {
|
||||
cmd = "npm t -- -t '$result' $file", -- run command
|
||||
identifiers = { 'test', 'it' }, -- used to identify tests
|
||||
prepend = { 'describe' }, -- prepend describe blocks
|
||||
expressions = { 'call_expression' }, -- tree-sitter object used to scan for tests/describe blocks
|
||||
path_to_jest_run = 'jest', -- used to run tests
|
||||
path_to_jest_debug = './node_modules/.bin/jest', -- used for debugging
|
||||
terminal_cmd = ':vsplit | terminal', -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config
|
||||
dap = { -- debug adapter configuration
|
||||
type = 'node2',
|
||||
request = 'launch',
|
||||
cwd = vim.fn.getcwd(),
|
||||
runtimeArgs = { '--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file' },
|
||||
args = { '--no-cache' },
|
||||
sourceMaps = false,
|
||||
protocol = 'inspector',
|
||||
skipFiles = { '<node_internals>/**/*.js' },
|
||||
console = 'integratedTerminal',
|
||||
port = 9229,
|
||||
disableOptimisticBPs = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>js', jester.run, { desc = 'Single test Run' })
|
||||
-- vim.keymap.set('n', '<leader>jsd', jester.debug, { desc = 'Single test debug' })
|
||||
vim.keymap.set('n', '<leader>jf', jester.run, { desc = 'File test Run' })
|
||||
-- vim.keymap.set('n', '<leader>jfd', jester.debug, { desc = 'File test debug' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -23,6 +23,10 @@ return {
|
|||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
'mxsdev/nvim-dap-vscode-js',
|
||||
|
||||
-- Virtual text
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
},
|
||||
keys = {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
|
|
@ -98,6 +102,19 @@ return {
|
|||
},
|
||||
}
|
||||
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>B', function()
|
||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end, { desc = 'Debug: Set Breakpoint' })
|
||||
|
||||
-- Dap virtual text setup
|
||||
require('nvim-dap-virtual-text').setup()
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
dapui.setup {
|
||||
|
|
@ -136,13 +153,49 @@ return {
|
|||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
require('dap-vscode-js').setup {
|
||||
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
||||
debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug',
|
||||
-- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
|
||||
adapters = { 'pwa-node', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node' }, -- which adapters to register in nvim-dap
|
||||
-- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
|
||||
-- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
|
||||
-- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
|
||||
}
|
||||
|
||||
local js_based_languages = { 'typescript', 'javascript' }
|
||||
|
||||
for _, language in ipairs(js_based_languages) do
|
||||
require('dap').configurations[language] = {
|
||||
{
|
||||
type = 'pwa-node',
|
||||
request = 'launch',
|
||||
name = 'Launch file',
|
||||
program = '${file}',
|
||||
cwd = '${workspaceFolder}',
|
||||
},
|
||||
{
|
||||
type = 'pwa-node',
|
||||
request = 'attach',
|
||||
name = 'Attach',
|
||||
processId = require('dap.utils').pick_process,
|
||||
cwd = '${workspaceFolder}',
|
||||
},
|
||||
{
|
||||
type = 'pwa-node',
|
||||
request = 'launch',
|
||||
name = 'Debug Jest Tests',
|
||||
env = { NODE_OPTIONS = '--experimental-vm-modules', ENV = 'test' },
|
||||
runtimeExecutable = 'node',
|
||||
runtimeArgs = {
|
||||
'./node_modules/jest/bin/jest.js',
|
||||
},
|
||||
rootPath = '${workspaceFolder}',
|
||||
cwd = '${workspaceFolder}',
|
||||
console = 'integratedTerminal',
|
||||
internalConsoleOptions = 'neverOpen',
|
||||
},
|
||||
}
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,40 @@ return {
|
|||
{ -- Linting
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
-- init = function()
|
||||
-- require('lint').linters.eslint.args = { '--fix' }
|
||||
-- end,
|
||||
-- init = function()
|
||||
-- require('lint').linters.eslint.args = {
|
||||
-- '--fix',
|
||||
-- '--format',
|
||||
-- 'json',
|
||||
-- '--stdin',
|
||||
-- '--stdin-filename',
|
||||
-- function()
|
||||
-- return vim.api.nvim_buf_get_name(0)
|
||||
-- end,
|
||||
-- }
|
||||
-- end,
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
typescript = { 'eslint' },
|
||||
javascript = { 'eslint' },
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- lint.linters.eslint.args = {
|
||||
-- '--fix',
|
||||
-- '--format',
|
||||
-- 'json',
|
||||
-- '--stdin',
|
||||
-- '--stdin-filename',
|
||||
-- function()
|
||||
-- return vim.api.nvim_buf_get_name(0)
|
||||
-- end,
|
||||
-- }
|
||||
-- -- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
|
|
|
|||
Loading…
Reference in New Issue