Skip to content

Commit ac376a6

Browse files
committed
"first commit to kickstart"
1 parent 5bdde24 commit ac376a6

File tree

6 files changed

+200
-10
lines changed

6 files changed

+200
-10
lines changed

after/ftplugin/fsharp.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.opt_local.expandtab = true

ftplugin/fsharp.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.opt_local.expandtab = true

ftplugin/ft.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
vim.filetype.add {
2+
extension = {
3+
fsx = 'fsharp',
4+
fs = 'fsharp',
5+
},
6+
}

init.lua

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
102102
vim.opt.number = true
103103
-- You can also add relative line numbers, to help with jumping.
104104
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
105+
vim.opt.relativenumber = true
106106

107107
-- Enable mouse mode, can be useful for resizing splits for example!
108108
vim.opt.mouse = 'a'
@@ -175,10 +175,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
175175
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
176176

177177
-- TIP: Disable arrow keys in normal mode
178-
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
179-
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
180-
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
181-
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
178+
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
179+
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
180+
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
181+
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
182182

183183
-- Keybinds to make split navigation easier.
184184
-- Use CTRL+<hjkl> to switch between windows
@@ -229,7 +229,18 @@ vim.opt.rtp:prepend(lazypath)
229229
require('lazy').setup({
230230
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
231231
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
232-
232+
'ionide/Ionide-vim',
233+
{
234+
'DanielGavin/ols',
235+
opts = {
236+
init_options = {
237+
checker_args = '-strict-style',
238+
collections = {
239+
{ name = 'shared', path = vim.fn.expand '$HOME/odin-lib' },
240+
},
241+
},
242+
},
243+
},
233244
-- NOTE: Plugins can also be added by using a table,
234245
-- with the first argument being the link and the following
235246
-- keys can be used to configure plugin behavior/loading/etc.
@@ -435,6 +446,18 @@ require('lazy').setup({
435446
vim.keymap.set('n', '<leader>sn', function()
436447
builtin.find_files { cwd = vim.fn.stdpath 'config' }
437448
end, { desc = '[S]earch [N]eovim files' })
449+
-- Shortcut for searching your Odin source files
450+
vim.keymap.set('n', '<leader>so', function()
451+
builtin.find_files { cwd = '/home/default/.odin' }
452+
end, { desc = '[S]earch [O]din source files' })
453+
-- Shortcut for searching your Odin source files
454+
vim.keymap.set('n', '<leader>sog', function()
455+
builtin.live_grep { cwd = '/home/default/.odin' }
456+
end, { desc = '[S]earch [O]din by [G]rep' })
457+
-- Shortcut for fuzzy finding your Odin source files
458+
vim.keymap.set('n', '<leader>sof', function()
459+
builtin.grep_string { shorten_path = true, word_match = '-w', only_sort_text = true, search = '', cwd = '/home/default/.odin' }
460+
end, { desc = '[S]earch [O]din by [F]uzzy' })
438461
end,
439462
},
440463

@@ -461,7 +484,7 @@ require('lazy').setup({
461484
{ 'williamboman/mason.nvim', opts = {} },
462485
'williamboman/mason-lspconfig.nvim',
463486
'WhoIsSethDaniel/mason-tool-installer.nvim',
464-
487+
'nvim-java/nvim-java',
465488
-- Useful status updates for LSP.
466489
{ 'j-hui/fidget.nvim', opts = {} },
467490

@@ -616,6 +639,8 @@ require('lazy').setup({
616639
-- - settings (table): Override the default settings passed when initializing the server.
617640
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
618641
local servers = {
642+
fsautocomplete = {},
643+
--jdtls = {},
619644
-- clangd = {},
620645
-- gopls = {},
621646
-- pyright = {},
@@ -626,7 +651,7 @@ require('lazy').setup({
626651
-- https://github.com/pmizio/typescript-tools.nvim
627652
--
628653
-- But for many setups, the LSP (`ts_ls`) will work just fine
629-
-- ts_ls = {},
654+
--ts_ls = {},
630655
--
631656

632657
lua_ls = {
@@ -665,6 +690,8 @@ require('lazy').setup({
665690
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
666691

667692
require('mason-lspconfig').setup {
693+
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
694+
automatic_installation = false,
668695
handlers = {
669696
function(server_name)
670697
local server = servers[server_name] or {}
@@ -902,7 +929,7 @@ require('lazy').setup({
902929
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
903930
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
904931
opts = {
905-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
932+
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'java' },
906933
-- Autoinstall languages that are not installed
907934
auto_install = true,
908935
highlight = {

lua/custom/plugins/init.lua

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,97 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
return {
6+
{
7+
'mfussenegger/nvim-dap',
8+
dependencies = {
9+
'leoluz/nvim-dap-go',
10+
'rcarriga/nvim-dap-ui',
11+
'theHamsta/nvim-dap-virtual-text',
12+
'nvim-neotest/nvim-nio',
13+
'williamboman/mason.nvim',
14+
},
15+
config = function()
16+
local dap = require 'dap'
17+
local ui = require 'dapui'
18+
19+
require('dapui').setup()
20+
require('dap-go').setup()
21+
22+
require('nvim-dap-virtual-text').setup {
23+
-- This just tries to mitigate the chance that I leak tokens here. Probably won't stop it from happening...
24+
display_callback = function(variable)
25+
local name = string.lower(variable.name)
26+
local value = string.lower(variable.value)
27+
if name:match 'secret' or name:match 'api' or value:match 'secret' or value:match 'api' then
28+
return '*****'
29+
end
30+
31+
if #variable.value > 15 then
32+
return ' ' .. string.sub(variable.value, 1, 15) .. '... '
33+
end
34+
35+
return ' ' .. variable.value
36+
end,
37+
}
38+
39+
-- Handled by nvim-dap-go
40+
-- dap.adapters.go = {
41+
-- type = "server",
42+
-- port = "${port}",
43+
-- executable = {
44+
-- command = "dlv",
45+
-- args = { "dap", "-l", "127.0.0.1:${port}" },
46+
-- },
47+
-- }
48+
49+
local elixir_ls_debugger = vim.fn.exepath 'elixir-ls-debugger'
50+
if elixir_ls_debugger ~= '' then
51+
dap.adapters.mix_task = {
52+
type = 'executable',
53+
command = elixir_ls_debugger,
54+
}
55+
56+
dap.configurations.elixir = {
57+
{
58+
type = 'mix_task',
59+
name = 'phoenix server',
60+
task = 'phx.server',
61+
request = 'launch',
62+
projectDir = '${workspaceFolder}',
63+
exitAfterTaskReturns = false,
64+
debugAutoInterpretAllModules = false,
65+
},
66+
}
67+
end
68+
69+
vim.keymap.set('n', '<space>b', dap.toggle_breakpoint)
70+
vim.keymap.set('n', '<space>gb', dap.run_to_cursor)
71+
72+
-- Eval var under cursor
73+
vim.keymap.set('n', '<space>?', function()
74+
require('dapui').eval(nil, { enter = true })
75+
end)
76+
77+
vim.keymap.set('n', '<F1>', dap.continue)
78+
vim.keymap.set('n', '<F2>', dap.step_into)
79+
vim.keymap.set('n', '<F3>', dap.step_over)
80+
vim.keymap.set('n', '<F4>', dap.step_out)
81+
vim.keymap.set('n', '<F5>', dap.step_back)
82+
vim.keymap.set('n', '<F13>', dap.restart)
83+
84+
dap.listeners.before.attach.dapui_config = function()
85+
ui.open()
86+
end
87+
dap.listeners.before.launch.dapui_config = function()
88+
ui.open()
89+
end
90+
dap.listeners.before.event_terminated.dapui_config = function()
91+
ui.close()
92+
end
93+
dap.listeners.before.event_exited.dapui_config = function()
94+
ui.close()
95+
end
96+
end,
97+
},
98+
}

plugin/floaterminal.lua

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
local state = {
2+
floating = {
3+
buf = -1,
4+
win = -1,
5+
},
6+
}
7+
-- Create a floating window with a terminal
8+
function create_floating_terminal(opts)
9+
-- Get the width and height of the current screen
10+
local width = vim.o.columns
11+
local height = vim.o.lines
12+
13+
-- Define the size of the floating window (you can adjust this to your needs)
14+
local win_width = opts.width or math.floor(width * 0.6) -- 60% of screen width
15+
local win_height = opts.height or math.floor(height * 0.5) -- 50% of screen height
16+
17+
-- Center the window
18+
local row = math.floor((height - win_height) / 2)
19+
local col = math.floor((width - win_width) / 2)
20+
21+
local buf = nil
22+
if vim.api.nvim_buf_is_valid(opts.buf) then
23+
buf = opts.buf
24+
else
25+
buf = vim.api.nvim_create_buf(false, true) -- Create an empty buffer
26+
end
27+
28+
-- Define the border highlight group (adjust this to the color you prefer)
29+
local border_color = 'ColorColumn' -- Change to any highlight group of your choice
30+
31+
-- Define window options
32+
local windowOptions = {
33+
relative = 'editor',
34+
width = win_width,
35+
height = win_height,
36+
col = col,
37+
row = row,
38+
style = 'minimal', -- We don't need any status line or title
39+
border = 'rounded',
40+
}
41+
42+
-- Open the floating window with a terminal
43+
44+
local win = vim.api.nvim_open_win(buf, true, windowOptions) -- Open the floating window
45+
46+
-- Open a terminal inside the buffer
47+
return { buf = buf, win = win }
48+
end
49+
50+
local toggleTerminal = function()
51+
if not vim.api.nvim_win_is_valid(state.floating.win) then
52+
state.floating = create_floating_terminal { buf = state.floating.buf }
53+
if vim.bo[state.floating.buf].buftype ~= 'terminal' then
54+
vim.cmd.terminal()
55+
end
56+
else
57+
vim.api.nvim_win_hide(state.floating.win)
58+
end
59+
end
60+
vim.api.nvim_create_user_command('Floaterminal', toggleTerminal, {})
61+
-- Key mapping to open the floating terminal
62+
vim.keymap.set({ 'n', 't' }, '<leader>tt', toggleTerminal)

0 commit comments

Comments
 (0)