"first commit to kickstart"
This commit is contained in:
parent
5bdde24dfb
commit
ac376a6588
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.expandtab = true
|
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.expandtab = true
|
|
@ -0,0 +1,6 @@
|
||||||
|
vim.filetype.add {
|
||||||
|
extension = {
|
||||||
|
fsx = 'fsharp',
|
||||||
|
fs = 'fsharp',
|
||||||
|
},
|
||||||
|
}
|
43
init.lua
43
init.lua
|
@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
-- Experiment for yourself to see if you like it!
|
-- 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!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.opt.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
|
@ -175,10 +175,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
|
||||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||||
|
|
||||||
-- TIP: Disable arrow keys in normal mode
|
-- TIP: Disable arrow keys in normal mode
|
||||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
-- Keybinds to make split navigation easier.
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
|
@ -229,7 +229,18 @@ vim.opt.rtp:prepend(lazypath)
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||||
|
'ionide/Ionide-vim',
|
||||||
|
{
|
||||||
|
'DanielGavin/ols',
|
||||||
|
opts = {
|
||||||
|
init_options = {
|
||||||
|
checker_args = '-strict-style',
|
||||||
|
collections = {
|
||||||
|
{ name = 'shared', path = vim.fn.expand '$HOME/odin-lib' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
-- NOTE: Plugins can also be added by using a table,
|
-- NOTE: Plugins can also be added by using a table,
|
||||||
-- with the first argument being the link and the following
|
-- with the first argument being the link and the following
|
||||||
-- keys can be used to configure plugin behavior/loading/etc.
|
-- keys can be used to configure plugin behavior/loading/etc.
|
||||||
|
@ -435,6 +446,18 @@ require('lazy').setup({
|
||||||
vim.keymap.set('n', '<leader>sn', function()
|
vim.keymap.set('n', '<leader>sn', function()
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
end, { desc = '[S]earch [N]eovim files' })
|
end, { desc = '[S]earch [N]eovim files' })
|
||||||
|
-- Shortcut for searching your Odin source files
|
||||||
|
vim.keymap.set('n', '<leader>so', function()
|
||||||
|
builtin.find_files { cwd = '/home/default/.odin' }
|
||||||
|
end, { desc = '[S]earch [O]din source files' })
|
||||||
|
-- Shortcut for searching your Odin source files
|
||||||
|
vim.keymap.set('n', '<leader>sog', function()
|
||||||
|
builtin.live_grep { cwd = '/home/default/.odin' }
|
||||||
|
end, { desc = '[S]earch [O]din by [G]rep' })
|
||||||
|
-- Shortcut for fuzzy finding your Odin source files
|
||||||
|
vim.keymap.set('n', '<leader>sof', function()
|
||||||
|
builtin.grep_string { shorten_path = true, word_match = '-w', only_sort_text = true, search = '', cwd = '/home/default/.odin' }
|
||||||
|
end, { desc = '[S]earch [O]din by [F]uzzy' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -461,7 +484,7 @@ require('lazy').setup({
|
||||||
{ 'williamboman/mason.nvim', opts = {} },
|
{ 'williamboman/mason.nvim', opts = {} },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
'nvim-java/nvim-java',
|
||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
@ -616,6 +639,8 @@ require('lazy').setup({
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
-- - settings (table): Override the default settings passed when initializing the server.
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
|
fsautocomplete = {},
|
||||||
|
--jdtls = {},
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
|
@ -665,6 +690,8 @@ require('lazy').setup({
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
|
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||||
|
automatic_installation = false,
|
||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
|
@ -902,7 +929,7 @@ require('lazy').setup({
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
opts = {
|
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', 'java' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
|
|
|
@ -2,4 +2,97 @@
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
return {}
|
return {
|
||||||
|
{
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
dependencies = {
|
||||||
|
'leoluz/nvim-dap-go',
|
||||||
|
'rcarriga/nvim-dap-ui',
|
||||||
|
'theHamsta/nvim-dap-virtual-text',
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dap = require 'dap'
|
||||||
|
local ui = require 'dapui'
|
||||||
|
|
||||||
|
require('dapui').setup()
|
||||||
|
require('dap-go').setup()
|
||||||
|
|
||||||
|
require('nvim-dap-virtual-text').setup {
|
||||||
|
-- This just tries to mitigate the chance that I leak tokens here. Probably won't stop it from happening...
|
||||||
|
display_callback = function(variable)
|
||||||
|
local name = string.lower(variable.name)
|
||||||
|
local value = string.lower(variable.value)
|
||||||
|
if name:match 'secret' or name:match 'api' or value:match 'secret' or value:match 'api' then
|
||||||
|
return '*****'
|
||||||
|
end
|
||||||
|
|
||||||
|
if #variable.value > 15 then
|
||||||
|
return ' ' .. string.sub(variable.value, 1, 15) .. '... '
|
||||||
|
end
|
||||||
|
|
||||||
|
return ' ' .. variable.value
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Handled by nvim-dap-go
|
||||||
|
-- dap.adapters.go = {
|
||||||
|
-- type = "server",
|
||||||
|
-- port = "${port}",
|
||||||
|
-- executable = {
|
||||||
|
-- command = "dlv",
|
||||||
|
-- args = { "dap", "-l", "127.0.0.1:${port}" },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
local elixir_ls_debugger = vim.fn.exepath 'elixir-ls-debugger'
|
||||||
|
if elixir_ls_debugger ~= '' then
|
||||||
|
dap.adapters.mix_task = {
|
||||||
|
type = 'executable',
|
||||||
|
command = elixir_ls_debugger,
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.elixir = {
|
||||||
|
{
|
||||||
|
type = 'mix_task',
|
||||||
|
name = 'phoenix server',
|
||||||
|
task = 'phx.server',
|
||||||
|
request = 'launch',
|
||||||
|
projectDir = '${workspaceFolder}',
|
||||||
|
exitAfterTaskReturns = false,
|
||||||
|
debugAutoInterpretAllModules = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<space>b', dap.toggle_breakpoint)
|
||||||
|
vim.keymap.set('n', '<space>gb', dap.run_to_cursor)
|
||||||
|
|
||||||
|
-- Eval var under cursor
|
||||||
|
vim.keymap.set('n', '<space>?', function()
|
||||||
|
require('dapui').eval(nil, { enter = true })
|
||||||
|
end)
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<F1>', dap.continue)
|
||||||
|
vim.keymap.set('n', '<F2>', dap.step_into)
|
||||||
|
vim.keymap.set('n', '<F3>', dap.step_over)
|
||||||
|
vim.keymap.set('n', '<F4>', dap.step_out)
|
||||||
|
vim.keymap.set('n', '<F5>', dap.step_back)
|
||||||
|
vim.keymap.set('n', '<F13>', dap.restart)
|
||||||
|
|
||||||
|
dap.listeners.before.attach.dapui_config = function()
|
||||||
|
ui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.launch.dapui_config = function()
|
||||||
|
ui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated.dapui_config = function()
|
||||||
|
ui.close()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited.dapui_config = function()
|
||||||
|
ui.close()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
local state = {
|
||||||
|
floating = {
|
||||||
|
buf = -1,
|
||||||
|
win = -1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
-- Create a floating window with a terminal
|
||||||
|
function create_floating_terminal(opts)
|
||||||
|
-- Get the width and height of the current screen
|
||||||
|
local width = vim.o.columns
|
||||||
|
local height = vim.o.lines
|
||||||
|
|
||||||
|
-- Define the size of the floating window (you can adjust this to your needs)
|
||||||
|
local win_width = opts.width or math.floor(width * 0.6) -- 60% of screen width
|
||||||
|
local win_height = opts.height or math.floor(height * 0.5) -- 50% of screen height
|
||||||
|
|
||||||
|
-- Center the window
|
||||||
|
local row = math.floor((height - win_height) / 2)
|
||||||
|
local col = math.floor((width - win_width) / 2)
|
||||||
|
|
||||||
|
local buf = nil
|
||||||
|
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||||
|
buf = opts.buf
|
||||||
|
else
|
||||||
|
buf = vim.api.nvim_create_buf(false, true) -- Create an empty buffer
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Define the border highlight group (adjust this to the color you prefer)
|
||||||
|
local border_color = 'ColorColumn' -- Change to any highlight group of your choice
|
||||||
|
|
||||||
|
-- Define window options
|
||||||
|
local windowOptions = {
|
||||||
|
relative = 'editor',
|
||||||
|
width = win_width,
|
||||||
|
height = win_height,
|
||||||
|
col = col,
|
||||||
|
row = row,
|
||||||
|
style = 'minimal', -- We don't need any status line or title
|
||||||
|
border = 'rounded',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Open the floating window with a terminal
|
||||||
|
|
||||||
|
local win = vim.api.nvim_open_win(buf, true, windowOptions) -- Open the floating window
|
||||||
|
|
||||||
|
-- Open a terminal inside the buffer
|
||||||
|
return { buf = buf, win = win }
|
||||||
|
end
|
||||||
|
|
||||||
|
local toggleTerminal = function()
|
||||||
|
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||||
|
state.floating = create_floating_terminal { buf = state.floating.buf }
|
||||||
|
if vim.bo[state.floating.buf].buftype ~= 'terminal' then
|
||||||
|
vim.cmd.terminal()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.api.nvim_win_hide(state.floating.win)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.api.nvim_create_user_command('Floaterminal', toggleTerminal, {})
|
||||||
|
-- Key mapping to open the floating terminal
|
||||||
|
vim.keymap.set({ 'n', 't' }, '<leader>tt', toggleTerminal)
|
Loading…
Reference in New Issue