Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Rust changes #5

Merged
merged 11 commits into from
Mar 17, 2024
Merged
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -4,4 +4,6 @@ test
tags
tags.lock
tags.temp
lazy-lock.jsonlazy-lock.json
lazy-lock.json
rust/Cargo.lock
rust/lua/*
153 changes: 79 additions & 74 deletions README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
[ ] Convert what i can to rust and make it main branch
[ ] Fix refactoring.nvim
[ ] Fix debugging https://github.com/mfussenegger/nvim-dap

Future plugins ? ⚡
- https://github.com/polirritmico/telescope-lazy-plugins.nvim
- https://github.com/s1n7ax/nvim-search-and-replace
- https://github.com/nvim-pack/nvim-spectre
- https://github.com/AckslD/muren.nvim/
- https://github.com/SirVer/ultisnips?tab=readme-ov-file
- https://github.com/Bekaboo/dropbar.nvim | https://github.com/utilyre/barbecue.nvim
- https://github.com/willothy/veil.nvim


2 changes: 2 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -5,3 +5,5 @@ Prequire("config")
Prequire("plugins")

Prequire("etc")

require("rust")
18 changes: 9 additions & 9 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" },
"SchemaStore.nvim": { "branch": "main", "commit": "6316dc88db89d97d190f24547adddd13569fb746" },
"bufferline.nvim": { "branch": "main", "commit": "9e8d2f695dd50ab6821a6a53a840c32d2067a78a" },
"SchemaStore.nvim": { "branch": "main", "commit": "9f74c6a52f4f6adaf3b3d64b15d2363219afefae" },
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
"cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" },
"clangd_extensions.nvim": { "branch": "main", "commit": "34c8eaa12be192e83cd4865ce2375e9f53e728f2" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-tags": { "branch": "main", "commit": "30bdc2eec86eb66730af541bb06d24d4a67e3eeb" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" },
"dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" },
"dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" },
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
"fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" },
"flutter-tools.nvim": { "branch": "main", "commit": "7350750d46fbeb4d2bb4878157b658d435935299" },
"go.nvim": { "branch": "master", "commit": "da48e6155d69a5602ae3b494ecbda9cda438c0a9" },
"guihua.lua": { "branch": "master", "commit": "cd68996069abedffcd677ca7eee3a660b79e5b32" },
"flutter-tools.nvim": { "branch": "main", "commit": "01d72d9c1bdf2d454a60c5ba450f83e5ea783f6a" },
"go.nvim": { "branch": "master", "commit": "9ac3e6faa32d01479973f4ca368d00b7ae328646" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" },
"indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
17 changes: 0 additions & 17 deletions lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
-- assumes set ignorecase smartcase;
vim.api.nvim_create_autocmd("CmdLineEnter", {
pattern = { ":" },
group = vim.api.nvim_create_augroup("dynamic_smartcase", {}),
callback = function()
vim.o.smartcase = false
end,
})

vim.api.nvim_create_autocmd("CmdLineLeave", {
pattern = { ":" },
group = vim.api.nvim_create_augroup("dynamic_smartcase", {}),
callback = function()
vim.o.smartcase = true
end,
})

vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = "*",
callback = function()
130 changes: 25 additions & 105 deletions lua/config/bindings.lua
Original file line number Diff line number Diff line change
@@ -1,115 +1,35 @@
vim.g.mapleader = " "

-- stylua: ignore start
local keymaps = {
{ Keys.N, "<LEADER>sf", vim.cmd.write },

{ Keys.V, "<LEADER>so", ":sort<cr>" },
{ Keys.N, "<LEADER>qa", ":noautocmd qall!<cr>" },

{ Keys.N, "<LEADER>me", vim.cmd.messages },
{ Keys.N, "<LEADER>fe", vim.cmd.edit },

{ Keys.N, "<LEADER>x+", function()
local filename = vim.fn.expand("%")
vim.fn.jobstart({ "chmod", "+x", filename })
require("notify")("Given execution rights to '" .. filename .. "'", "info", { title = IDE.name })
end },

{ Keys.N, "<LEADER>x-", function()
local filename = vim.fn.expand("%")
vim.fn.jobstart({ "chmod", "-x", filename })
require("notify")("Taken away execution rights from '" .. filename .. "'", "info", { title = IDE.name })
end },
-- Buffer
{ Keys.N, "<LEADER>bp", vim.cmd.bp },
{ Keys.N, "<LEADER>bn", vim.cmd.bn },
{ Keys.N, "<LEADER>bd", vim.cmd.bd },
{ Keys.N, "<A-d>", vim.cmd.bd, Keys.Noremap },
{ Keys.N, "<LEADER>nw", "<CMD>%s/\\s*$//<CR>" },
{ Keys.N, "<LEADER>`", "<CMD>edit #<CR>" },
{ Keys.N, "<LEADER>p", "\"_dP" },
{ Keys.N, "<LEADER>gf", ":e <cfile><cr>" },
{ Keys.N, "<LEADER><F2>", "*:%s//" },
{ Keys.A, "<A-a>", "<c-a>", Keys.Noremap }, -- increament
{ Keys.A, "<A-x>", "<c-x>", Keys.Noremap }, -- decreament

{ Keys.N, "L", "$" },
{ Keys.N, "H", "^" },
{ Keys.N, "Q", "" }, -- Disable visual mode

{ Keys.N, "<Home>", "(col('.') == matchend(getline('.'), '^\\s*')+1 ? '0' : '^')", Keys.NoremapExpr },
{ Keys.N, "<End>", "(col('.') == match(getline('.'), '\\s*$') ? '$' : 'g_')", Keys.NoremapExpr },
{ Keys.V, "<End>", "(col('.') == match(getline('.'), '\\s*$') ? '$h' : 'g_')", Keys.NoremapExpr },
{ Keys.I, "<Home>", "<C-o><Home>" },
{ Keys.I, "<End> ", "<C-o><End>" },
{ Keys.N, "gg", "gg0", Keys.Noremap },
{ Keys.A, "G", "G<End>", Keys.Noremap },
{ Keys.A, "Y", "y$", Keys.Noremap },
{ Keys.N, "<LEADER>w", "<c-w>", Keys.Noremap },
{ Keys.N, "<LEADER>w|", "<CMD>vsplit<CR>", Keys.Noremap },
{ Keys.N, "<LEADER>w_", "<CMD>split<CR>", Keys.Noremap },

-- system clipboard
{ Keys.N, "<c-c>", "\"+y\"", Keys.Noremap },
{ Keys.V, "<c-c>", "\"+y\"", Keys.Noremap },
{ Keys.N, "<c-v>", "\"+p\"", Keys.Noremap },
{ Keys.I, "<c-v>", "<c-r>+", Keys.Noremap },
{ Keys.C, "<c-v>", "<c-r>+", Keys.Noremap },
{ Keys.N, "<c-x>", "<c-c>d" },
{ Keys.I, "<c-x>", "<c-c>d" },
{ Keys.C, "<c-x>", "<c-c>d" },

-- use <c-r> to insert original character without triggering things like auto-pairs
{ Keys.I, "<c-r>", "<c-v>", Keys.Noremap },
{ Keys.N, "<LEADER>fs", ":w<CR>", Keys.Noremap },
{ Keys.N, "<F1>", "<esc>", Keys.Noremap },
{ Keys.I, "<F1>", "<esc>", Keys.Noremap },
{ Keys.N, Keys.N, "nzzzv", Keys.Noremap },
{ Keys.N, "N", "Nzzzv", Keys.Noremap },
{ Keys.N, "J", "mzJ`z", Keys.Noremap },
{ Keys.I, ",", ",<c-g>u", Keys.Noremap },
{ Keys.I, ".", ".<c-g>u", Keys.Noremap },
{ Keys.I, "!", "!<c-g>u", Keys.Noremap },
{ Keys.I, "?", "?<c-g>u", Keys.Noremap },
{ Keys.I, "[", "[<c-g>u", Keys.Noremap },
{ Keys.I, "]", "]<c-g>u", Keys.Noremap },
{ Keys.I, "(", "(<c-g>u", Keys.Noremap },
{ Keys.I, ")", ")<c-g>u", Keys.Noremap },
{ Keys.I, "{", "{<c-g>u", Keys.Noremap },
{ Keys.I, "}", "}<c-g>u", Keys.Noremap },
{ Keys.I, "\"", "\"<c-g>u", Keys.Noremap },
{ Keys.N, "k", "(v:count > 5 ? \"m'\" . v:count : \"\") . 'k'", Keys.NoremapExpr },
{ Keys.N, "j", "(v:count > 5 ? \"m'\" . v:count : \"\") . 'j'", Keys.NoremapExpr },
{ Keys.V, "<c-j>", ":m '>+1<CR>gv=gv", Keys.Noremap },
{ Keys.V, "<c-k>", ":m '<-2<CR>gv=gv", Keys.Noremap },
{ Keys.N, "<c-j>", ":m .+1<CR>==", Keys.Noremap },
{ Keys.I, "<c-k>", "<esc>:m .-2<CR>==i", Keys.Noremap },
{ Keys.N, "<c-k>", ":m .-1<CR>==", Keys.Noremap },
{ Keys.I, "<c-j>", "<esc>:m .+1<CR>==i", Keys.Noremap },

-- Add space bellow or above without leaving normal mode
{ Keys.N, "[<LEADER>", ":<c-u>put!=repeat([''],v:count)<bar>']+1<cr>", Keys.NoremapSilent },
{ Keys.N, "]<LEADER>", ":<c-u>put =repeat([''],v:count)<bar>'[-1<cr>", Keys.NoremapSilent },

-- Use simple ; instead of shift + :
-- {Keys.N, ";", ":", Keys.Noremap},
-- {Keys.V, ";", ":", Keys.Noremap},

-- Better tabbing
{ Keys.N, "<", "v<gv<esc>", Keys.Noremap },
{ Keys.N, ">", "v>gv<esc>", Keys.Noremap },
{ Keys.V, "<", "<gv", Keys.Noremap },
{ Keys.V, ">", ">gv", Keys.Noremap },
{ Keys.V, "`", "<esc>`>a`<esc>`<i`<esc>", Keys.Noremap },
{ Keys.V, "(", "<esc>`>a)<esc>`<i(<esc>", Keys.Noremap },
{ Keys.V, "'", "<esc>`>a'<esc>`<i'<esc>", Keys.Noremap },
{ Keys.V, "<c-{>", "<esc>`>a}<esc>`<i{<esc>", Keys.Noremap },
{ Keys.V, ")", "<esc>`>a)<esc>`<i(<esc>", Keys.Noremap },
{ Keys.V, "]", "<esc>`>a]<esc>`<i[<esc>", Keys.Noremap },
{ Keys.V, "<c-}>", "<esc>`>a}<esc>`<i{<esc>", Keys.Noremap },
{ Keys.N, "<LEADER>ne", ":set noexpandtab!<cr>", Keys.Noremap },
{ Keys.N, "<LEADER>et", ":set expandtab!<cr>", Keys.Noremap },

{ Keys.N, "<LEADER>bp", vim.cmd.bp },
{ Keys.N, "<LEADER>bn", vim.cmd.bn },
{ Keys.N, "<LEADER>bd", vim.cmd.bd },
{ Keys.N, "<A-d>", vim.cmd.bd, Keys.Noremap },

{
Keys.N,
"<LEADER>x+",
function()
local filename = vim.fn.expand("%")
vim.fn.jobstart({ "chmod", "+x", filename })
require("notify")("Given execution rights to '" .. filename .. "'", "info", { title = IDE.name })
end,
},

{
Keys.N,
"<LEADER>x-",
function()
local filename = vim.fn.expand("%")
vim.fn.jobstart({ "chmod", "-x", filename })
require("notify")("Taken away execution rights from '" .. filename .. "'", "info", { title = IDE.name })
end,
},
}

for _, value in pairs(keymaps) do
9 changes: 8 additions & 1 deletion lua/config/init.lua
Original file line number Diff line number Diff line change
@@ -2,4 +2,11 @@ Prequire("config.autocmds")
Prequire("config.bindings")
Prequire("config.commands")
Prequire("config.options")
Prequire("config.neovide")

if vim.g.neovide then
Prequire("config.neovide")
end

if vim.g.vscode then
Prequire("config.vscode")
end
34 changes: 16 additions & 18 deletions lua/config/neovide.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
if vim.g.neovide ~= nil then
vim.cmd("hi Normal guibg=NONE")
vim.cmd("hi Normal guibg=NONE")

local cursor_vfx = { "railgun", "torpedo", "pixiedust", "sonicboom", "ripple", "wireframe" }
local cursor_vfx = { "railgun", "torpedo", "pixiedust", "sonicboom", "ripple", "wireframe" }

vim.g.neovide_scale_factor = 0.78 -- 1
vim.g.neovide_scale_factor = 0.78 -- 1

vim.g.neovide_floating_blur_amount_x = 10.0 -- 2.0
vim.g.neovide_floating_blur_amount_y = 10.0 -- 2.0
vim.g.neovide_floating_blur_amount_x = 10.0 -- 2.0
vim.g.neovide_floating_blur_amount_y = 10.0 -- 2.0

vim.g.neovide_transparency = 0.9 -- 0
vim.g.neovide_transparency = 0.9 -- 0

-- vim.g.neovide_scroll_animation_length = -- 0.3
-- vim.g.neovide_scroll_animation_length = -- 0.3

vim.g.neovide_hide_mouse_when_typing = true -- false
vim.g.neovide_hide_mouse_when_typing = true -- false

vim.g.neovide_refresh_rate = 24
vim.g.neovide_refresh_rate_idle = 1
vim.g.neovide_no_idle = false
vim.g.neovide_refresh_rate = 24
vim.g.neovide_refresh_rate_idle = 1
vim.g.neovide_no_idle = false

vim.g.neovide_confirm_quit = false -- true
vim.g.neovide_confirm_quit = false -- true

-- vim.g.neovide_remember_window_size = -- true
-- vim.g.neovide_remember_window_size = -- true

-- vim.g.neovide_profiler = true -- false
-- vim.g.neovide_profiler = true -- false

-- let g:neovide_input_use_logo = v:false " v:true on macOS
-- let g:neovide_input_use_logo = v:false " v:true on macOS

vim.g.neovide_cursor_vfx_mode = RandFrom(cursor_vfx)
end
vim.g.neovide_cursor_vfx_mode = RandFrom(cursor_vfx)
3 changes: 3 additions & 0 deletions lua/config/options.lua
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ vim.g.python_recommended_style = 0
vim.g.python_host_skip_check = 1
vim.g.loaded_python3_provider = 1

vim.o.conceallevel = 1

-- vim.o.t_Co = 256
-- vim.o.t_ut = true
-- vim.o.shortmess = (vim.o.shortmess .. "c")
@@ -70,3 +72,4 @@ vim.o.wildignore = "*.pyc"
.. ",**/.git/*"

vim.cmd("source $HOME/.config/nvim/vimscript/options.vim")
vim.cmd("source $HOME/.config/nvim/vimscript/autosave.vim")
11 changes: 11 additions & 0 deletions lua/config/vscode.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-neovim#api
local vscode = require("vscode-neovim")

local function f_vs_call(cmd)
return function()
vscode.call(cmd)
end
end

vim.keymap.set(Keys.N, "<LEADER>nf", f_vs_call("editor.action.formartDocument.none"), Keys.None)
vim.keymap.set(Keys.V, "<LEADER>nf", f_vs_call("editor.action.formatSelection"), Keys.None)
Loading