Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ Distribution Alternatives:
> [Backup](#FAQ) your previous configuration (if any exists)

Requirements:
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
* Make sure to review the readmes of the plugins if you are experiencing errors.
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for `fzf-lua` live grep.

Neovim's configurations are located under the following paths, depending on your OS:

Expand Down Expand Up @@ -68,10 +67,9 @@ nvim --headless "+Lazy! sync" +qa

* Inside of your copy, feel free to modify any file you like! It's your copy!
* Feel free to change any of the default options in `init.lua` to better suit your needs.
* For adding plugins, there are 3 primary options:
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
* Modify `init.lua` with additional plugins.
* Include the `lua/coldboot/plugins/*` files in your configuration.
* For adding plugins, there are 2 primary options:
* Add new configuration in `lua/custom/plugins/*` files (if you enable that import)
* Edit the single plugin spec entrypoint: `lua/coldboot/plugins/init.lua`

You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration.

Expand Down Expand Up @@ -151,14 +149,5 @@ Each PR, especially those which increase the line count, should have a descripti

### Windows Installation

Installation may require installing build tools, and updating the run command for `telescope-fzf-native`

See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)

This requires:

- Install CMake, and the Microsoft C++ Build Tools on Windows

```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
```
Some plugins may require build tools (e.g. CMake) on Windows.
If you run into install/build errors, check the plugin's README and ensure you have the required toolchain installed.
17 changes: 5 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ vim.opt.rtp:prepend(lazypath)
-- You can also configure plugins after the setup call,
-- as they will be available in your neovim runtime.
require('lazy').setup({
-- NOTE: First, some plugins that don't require any configuration
-- import pure neovim plugins
{
import = 'coldboot.plugins',
cond = function()
Expand All @@ -98,13 +96,6 @@ require('lazy').setup({
return vim.g.vscode
end,
},

-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
-- up-to-date with whatever is in the coldboot repo.
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
{ import = 'custom.plugins' },
}, {})

Expand All @@ -115,6 +106,8 @@ require('lazy').setup({
-- Prepend mason bin to PATH
vim.env.PATH = vim.fn.stdpath 'data' .. '/mason/bin' .. ':' .. vim.env.PATH

-- NOTE: LSP config is in lua/coldboot/config/lsp.lua

-- Set highlight on search
vim.o.hlsearch = false

Expand Down Expand Up @@ -149,6 +142,8 @@ vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
vim.o.ttimeout = true
vim.o.ttimeoutlen = 100

-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
Expand Down Expand Up @@ -194,7 +189,7 @@ else
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })

-- LSP configuration is now handled in the plugin files
require 'coldboot.config'

-- document existing key chains
require('which-key').add {
Expand All @@ -215,8 +210,6 @@ else
{ '<leader>t', group = '[T]erminal' },
{ '<leader>t_', hidden = true },
}

-- LSP configuration is now handled in the plugin files
end
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
3 changes: 3 additions & 0 deletions lua/coldboot/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Convenience entrypoint for configuration modules.
-- Loaded from init.lua (non-vscode only).
return require 'coldboot.config.init'
87 changes: 87 additions & 0 deletions lua/coldboot/config/dap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
if vim.g.vscode then
return
end

local ok_dap, dap = pcall(require, 'dap')
if not ok_dap then
return
end

local ok_ui, dapui = pcall(require, 'dapui')
if ok_ui then
dapui.setup()

dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close()
end
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close()
end
end

pcall(function()
require('nvim-dap-virtual-text').setup()
end)

pcall(function()
require('dap-go').setup()
end)

pcall(function()
local js_debug_path = vim.fn.stdpath 'data' .. '/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js'

dap.adapters['pwa-node'] = {
type = 'server',
host = '127.0.0.1',
port = '${port}',
executable = {
command = 'node',
args = { js_debug_path, '${port}' },
},
}

dap.configurations.javascript = {
{
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}',
},
}

dap.configurations.typescript = dap.configurations.javascript
dap.configurations.javascriptreact = dap.configurations.javascript
dap.configurations.typescriptreact = dap.configurations.javascript
end)

local map = function(lhs, rhs, desc)
vim.keymap.set('n', lhs, rhs, { desc = desc })
end

map('<F5>', dap.continue, 'DAP continue')
map('<F10>', dap.step_over, 'DAP step over')
map('<F11>', dap.step_into, 'DAP step into')
map('<F12>', dap.step_out, 'DAP step out')
map('<leader>db', dap.toggle_breakpoint, 'DAP toggle breakpoint')
map('<leader>dB', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, 'DAP conditional breakpoint')
map('<leader>dr', dap.repl.open, 'DAP open REPL')
map('<leader>dl', dap.run_last, 'DAP run last')

if ok_ui then
map('<leader>du', dapui.toggle, 'DAP UI toggle')
end

map('<leader>dt', dap.terminate, 'DAP terminate')
24 changes: 24 additions & 0 deletions lua/coldboot/config/format.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local settings = require 'coldboot.settings'

if vim.g.vscode then
return
end

local ok, conform = pcall(require, 'conform')
if not ok then
return
end

conform.setup {
format_on_save = settings.format.format_on_save,
formatters_by_ft = settings.format.formatters_by_ft,
}

vim.api.nvim_create_user_command('Format', function(args)
conform.format {
async = false,
lsp_format = 'fallback',
timeout_ms = settings.format.format_on_save.timeout_ms,
range = args.count > 0 and { start = { args.line1, 0 }, ['end'] = { args.line2, 0 } } or nil,
}
end, { range = true, desc = 'Format current buffer (Conform/LSP)' })
9 changes: 9 additions & 0 deletions lua/coldboot/config/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if vim.g.vscode then
return
end

require 'coldboot.config.ui'
require 'coldboot.config.mason'
require 'coldboot.config.lsp'
require 'coldboot.config.lint'
require 'coldboot.config.format'
24 changes: 24 additions & 0 deletions lua/coldboot/config/lint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local settings = require 'coldboot.settings'

if vim.g.vscode then
return
end

local ok, lint = pcall(require, 'lint')
if not ok then
return
end

lint.linters_by_ft = settings.lint.linters_by_ft

local group = vim.api.nvim_create_augroup('ColdbootLint', { clear = true })
vim.api.nvim_create_autocmd(settings.lint.events, {
group = group,
callback = function()
lint.try_lint()
end,
})

vim.api.nvim_create_user_command('Lint', function()
lint.try_lint()
end, { desc = 'Run configured linters' })
Loading
Loading