Skip to content

Commit c6c7e4b

Browse files
committed
Adds flutter tools, keymaps, etc
1 parent 5bce5ef commit c6c7e4b

File tree

6 files changed

+112
-24
lines changed

6 files changed

+112
-24
lines changed

init.lua

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
11
-- bootstrap lazy.nvim, LazyVim and your plugins
22
require("config.functions")
33
require("config.lazy")
4+
require("flutter-tools").setup({
5+
debugger = { -- integrate with nvim dap + install dart code debugger
6+
enabled = false,
7+
run_via_dap = false, -- use dap instead of a plenary job to run flutter apps
8+
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
9+
-- see |:help dap.set_exception_breakpoints()| for more info
10+
exception_breakpoints = {},
11+
register_configurations = function(paths)
12+
require("dap").configurations.dart = {
13+
{
14+
type = "dart",
15+
name = "Dev Mobile",
16+
request = "launch",
17+
program = "lib/main.dart",
18+
args = {
19+
"--flavor",
20+
"dev",
21+
"--dart-define=DEV_BUILD=true",
22+
},
23+
},
24+
}
25+
end,
26+
},
27+
}) -- use defaults
28+
29+
-- NVR
30+
if vim.fn.executable("nvr") == 1 then
31+
vim.env.GIT_EDITOR = "nvr --remote-tab-wait +'set bufhidden=delete'"
32+
end

lazy-lock.json

+23-21
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"LazyVim": { "branch": "main", "commit": "7a8ca6222a554bdb78fb8de35404672fc4042302" },
3-
"LuaSnip": { "branch": "master", "commit": "a835e3d680c5940b61780c6af07885db95382478" },
4-
"SchemaStore.nvim": { "branch": "main", "commit": "ac100fa691b10dd990ca0cdc31ebd054a5959b58" },
5-
"ai.vim": { "branch": "main", "commit": "0a68081f93574c23b9e8297f64a011aae59d8d66" },
6-
"alpha-nvim": { "branch": "main", "commit": "3847d6baf74da61e57a13e071d8ca185f104dc96" },
2+
"LazyVim": { "branch": "main", "commit": "c4572fcec877053df89e7aba3bcd52a0ca5c7df7" },
3+
"LuaSnip": { "branch": "master", "commit": "025886915e7a1442019f467e0ae2847a7cf6bf1a" },
4+
"SchemaStore.nvim": { "branch": "main", "commit": "8815ba003c04322ba1a7a1304ffaa9e4109efa32" },
5+
"ai.vim": { "branch": "main", "commit": "26de0db6970762fe3db1cf3328b64b37dce8fa1b" },
6+
"alpha-nvim": { "branch": "main", "commit": "dafa11a6218c2296df044e00f88d9187222ba6b0" },
77
"bufferline.nvim": { "branch": "main", "commit": "3677aceb9a72630b0613e56516c8f7151b86f95c" },
8-
"catppuccin": { "branch": "main", "commit": "128af65c3a23c94b324dc8d7f02a34feee8722d4" },
8+
"catppuccin": { "branch": "main", "commit": "dc216c6241fd8439fe6018cca834200aca1a04ad" },
99
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
1010
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
1111
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
@@ -15,43 +15,45 @@
1515
"copilot.lua": { "branch": "master", "commit": "db62371b6eac73954c194f3c8faee36cffee8135" },
1616
"dressing.nvim": { "branch": "master", "commit": "5f44f829481640be0f96759c965ae22a3bcaf7ce" },
1717
"flit.nvim": { "branch": "main", "commit": "4c1739137acd3e7f03e2065a7be8a4dc41c7e461" },
18+
"flutter-tools.nvim": { "branch": "main", "commit": "727df22e2ae72a0482e5eb923e3d1c861a157a94" },
1819
"friendly-snippets": { "branch": "main", "commit": "25ddcd96540a2ce41d714bd7fea2e7f75fea8ead" },
19-
"gitsigns.nvim": { "branch": "main", "commit": "b1f9cf7c5c5639c006c937fc1819e09f358210fc" },
20+
"gitsigns.nvim": { "branch": "main", "commit": "ca473e28382f1524aa3d2b6f04bcf54f2e6a64cb" },
2021
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
21-
"lazy.nvim": { "branch": "main", "commit": "887eb75591520a01548134c4623617b639289d0b" },
22+
"lazy.nvim": { "branch": "main", "commit": "be77c59bf742379b6c5ad1e70d29c5fc1ee55944" },
2223
"leap.nvim": { "branch": "main", "commit": "f74473d23ebf60957e0db3ff8172349a82e5a442" },
2324
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
2425
"mason-lspconfig.nvim": { "branch": "main", "commit": "2b811031febe5f743e07305738181ff367e1e452" },
25-
"mason.nvim": { "branch": "main", "commit": "a192887fd0c29275cf2acb4a83bcbdf63399f8df" },
26+
"mason.nvim": { "branch": "main", "commit": "9f4e06029b1d8cd3bb4438f6b3de6d5c42d2d8d1" },
2627
"mini.ai": { "branch": "main", "commit": "d5a9f6b50fc6285fb876667e67394bbee2d5c70c" },
27-
"mini.animate": { "branch": "main", "commit": "3ef586e8c6a4034e3d7e803bf29e296025ecdd38" },
28+
"mini.animate": { "branch": "main", "commit": "7c4c51a63b6915d16193d5c62eb72620f746e07b" },
2829
"mini.bufremove": { "branch": "main", "commit": "68f9111aa81545022bb5afe7d576311a0fc29969" },
2930
"mini.comment": { "branch": "main", "commit": "f045998636c6fd746297220b8c692bf1e91568cb" },
3031
"mini.indentscope": { "branch": "main", "commit": "43f6761c9a3e397b7c12b3c72f678bcf61efcfcf" },
3132
"mini.pairs": { "branch": "main", "commit": "771c08bd313614c7e9a1904d277ac76eb226f674" },
3233
"mini.surround": { "branch": "main", "commit": "b450a3aff91b4108c0e9ba9e82633d65deb5802b" },
3334
"neo-tree.nvim": { "branch": "v2.x", "commit": "20c2f2f5ba083bbb1e37b8bc3d590621434f31e9" },
34-
"neoconf.nvim": { "branch": "main", "commit": "bc531ca41ba55d87416b4b3ade606ff81236389b" },
35-
"neodev.nvim": { "branch": "main", "commit": "13376f7b2098e5665becd2861930085e26fce0a1" },
36-
"neural": { "branch": "main", "commit": "77862e54c6478c021a2addf5c2883957df44bc9c" },
37-
"noice.nvim": { "branch": "main", "commit": "92b058ad183fccd3b970f03ae49094596a6c735b" },
35+
"neoconf.nvim": { "branch": "main", "commit": "cfd9acf23adb05754c50c5f6c015f11016de92be" },
36+
"neodev.nvim": { "branch": "main", "commit": "e027abc6d2a9c1efead2f697da8df2c0ed66b8ff" },
37+
"neural": { "branch": "main", "commit": "c70837e6fcee89bf99f9ba0e5ee7bfa7e0956a07" },
38+
"noice.nvim": { "branch": "main", "commit": "f8b1a72a7bce56d9e9ed054708dc855d57dec085" },
3839
"nui.nvim": { "branch": "main", "commit": "0dc148c6ec06577fcf06cbab3b7dac96d48ba6be" },
39-
"null-ls.nvim": { "branch": "main", "commit": "13dd1fc13063681ca7e039436c88f6eca7e3e937" },
40+
"null-ls.nvim": { "branch": "main", "commit": "0180603b6f3cee40f83c6fc226b9ac5f85e691c4" },
4041
"nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" },
41-
"nvim-lspconfig": { "branch": "master", "commit": "0f94c5fded29c0024254259f3d8a0284bfb507ea" },
42-
"nvim-navic": { "branch": "master", "commit": "f1ffbc3f5736add66c31e02f4c53d238e040600b" },
43-
"nvim-notify": { "branch": "master", "commit": "02047199e2752223c77c624160f720ca227944a9" },
42+
"nvim-dap": { "branch": "master", "commit": "7e81998e31277c7a33b6c34423640900c5c2c776" },
43+
"nvim-lspconfig": { "branch": "master", "commit": "c6105c449683b944b5d2138fcf82f18c657249e9" },
44+
"nvim-navic": { "branch": "master", "commit": "ca34afcd15c7f6dd0836fc4fca2e37024bfa5019" },
45+
"nvim-notify": { "branch": "master", "commit": "50d037041ada0895aeba4c0215cde6d11b7729c4" },
4446
"nvim-spectre": { "branch": "master", "commit": "2d7d23c1122bb2589880236e932d373933b07937" },
45-
"nvim-treesitter": { "branch": "master", "commit": "8ae2c8ff495fdf0f0f07edcd7afe271f15a70562" },
47+
"nvim-treesitter": { "branch": "master", "commit": "1f087c91f5ca76a2257b855d72d371a2b5302986" },
4648
"nvim-treesitter-textobjects": { "branch": "master", "commit": "582cbb5a4cb50f6161cac8cc01f55aeaff6d836a" },
4749
"nvim-ts-context-commentstring": { "branch": "main", "commit": "729d83ecb990dc2b30272833c213cc6d49ed5214" },
4850
"nvim-web-devicons": { "branch": "master", "commit": "95b1e300699be8eb6b5be1758a9d4d69fe93cc7f" },
4951
"persistence.nvim": { "branch": "main", "commit": "c814fae5c37aa0aba9cd9da05df6e52b88d612c3" },
5052
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
5153
"significant.nvim": { "branch": "main", "commit": "5450e9d5917dc6aa9afb0fcbe32355799b8303fb" },
52-
"telescope.nvim": { "branch": "master", "commit": "a3f17d3baf70df58b9d3544ea30abe52a7a832c2" },
54+
"telescope.nvim": { "branch": "master", "commit": "942fe5faef47b21241e970551eba407bc10d9547" },
5355
"todo-comments.nvim": { "branch": "main", "commit": "14e2cd9a6e5e67483a03660f08471ca9a981c4a5" },
54-
"tokyonight.nvim": { "branch": "main", "commit": "edffa82026914be54c8220973b0385f61d3392f0" },
56+
"tokyonight.nvim": { "branch": "main", "commit": "1b0c88094548a62641ece1e668fa9a234e1c539e" },
5557
"trouble.nvim": { "branch": "main", "commit": "7915277a259fdff5d46c6f1d2e100df2ec384d3b" },
5658
"typescript.nvim": { "branch": "main", "commit": "f66d4472606cb24615dfb7dbc6557e779d177624" },
5759
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },

lua/config/functions.lua

+38-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ local function open_selected_or_yanked_text_in_vsplit()
3535
else
3636
-- paste the text
3737
vim.cmd("normal! p")
38-
vim.cmd("1delete")
38+
--vim.cmd("1delete")
3939
end
4040

4141
-- Now select all text in the new buffer
@@ -52,9 +52,45 @@ local function ToggleAIModel()
5252
end
5353
end
5454

55-
vim.api.nvim_create_user_command("ToggleAIModel", ToggleAIModel, { nargs = 0 })
55+
vim.api.nvim_create_user_command("AIToggleModel", ToggleAIModel, { nargs = 0 })
56+
57+
local function SetAIContext()
58+
local context = vim.fn.input("Context: ")
59+
vim.g.ai_context_before = context
60+
vim.g.ai_context_after = context
61+
vim.notify("AI context set to " .. context .. " equally", "INFO", {})
62+
end
63+
64+
vim.api.nvim_create_user_command("AISetContext", SetAIContext, { nargs = 0 })
65+
66+
local function SetAIContextI()
67+
local context_before = vim.fn.input("Context before: ")
68+
local context_after = vim.fn.input("Context after: ")
69+
vim.g.ai_context_before = context_before
70+
vim.g.ai_context_after = context_after
71+
vim.notify("AI context set to " .. context_before .. " before and " .. context_after .. " after", "INFO", {})
72+
end
73+
74+
vim.api.nvim_create_user_command("AISetContextI", SetAIContextI, { nargs = 0 })
75+
76+
-- Function that: if the current buffer has text, deletes all text in the buffer, but if the current buffer has no text, deletes the current buffer and closes the window
77+
local function delete_buffer_if_empty()
78+
local line_count = vim.fn.line("$")
79+
if line_count == 1 and vim.fn.getline(1) == "" then
80+
vim.cmd("bd!")
81+
else
82+
-- switch to normal mode
83+
vim.cmd("normal! gg")
84+
-- delete all text in the buffer (including the last line)
85+
vim.cmd("normal! dG")
86+
--vim.cmd("normal! 0ggvGVdd")
87+
end
88+
end
5689

5790
return {
5891
open_selected_text_in_vsplit = open_selected_or_yanked_text_in_vsplit,
5992
toggle_ai_model = ToggleAIModel,
93+
set_ai_context = SetAIContext,
94+
set_ai_context_i = SetAIContextI,
95+
delete_buffer_if_empty = delete_buffer_if_empty,
6096
}

lua/config/keymaps.lua

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
-- Escape from insert mode when pressing jj
66
vim.keymap.set("i", "jj", "<ESC>", { noremap = true, silent = true, desc = "Escape from insert mode" })
7+
-- Delete the entire document text when pressing <leader>dd
8+
vim.keymap.set(
9+
"n",
10+
"<leader>dd",
11+
--":%d<CR>",
12+
"<cmd>lua require('config.functions').delete_buffer_if_empty()<CR>",
13+
{ noremap = true, silent = true, desc = "Delete the entire document text" }
14+
)
15+
-- Select the entire document text when pressing <leader>vv
16+
vim.keymap.set("n", "<leader>vv", "ggVG", { noremap = true, silent = true, desc = "Select the entire document text" })
17+
-- Copy the entire document text when pressing <leader>yy
18+
vim.keymap.set("n", "<leader>yy", "ggVGy", { noremap = true, silent = true, desc = "Copy the entire document text" })
719

820
-- leader b, w saves the current buffer
921
vim.keymap.set("n", "<leader>bw", ":w<cr>", { noremap = true, silent = true, desc = "save current buffer" })

lua/config/options.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
-- Add any additional options here
44
vim.opt.winbar = "%=%m %f"
55
vim.g.ai_timeout = 30
6-
vim.g.ai_completions_model = "gpt-3.5-turbo"
6+
vim.g.ai_model = "gpt-3.5-turbo"
77
vim.g.ai_indicator_style = "virtual_text"

lua/plugins/flutter-tools.lua

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
return {
2+
"akinsho/flutter-tools.nvim",
3+
lazy = false,
4+
dependencies = {
5+
"nvim-lua/plenary.nvim",
6+
"mfussenegger/nvim-dap",
7+
-- "stevearc/dressing.nvim", -- optional for vim.ui.select
8+
},
9+
}

0 commit comments

Comments
 (0)