Cleanup init.lua and add move.nvim
This commit is contained in:
parent
bcb6043f93
commit
0d6ab66211
25
init.lua
25
init.lua
|
|
@ -22,10 +22,7 @@ vim.opt.termguicolors = true
|
||||||
-- Theme
|
-- Theme
|
||||||
require('onedark').load()
|
require('onedark').load()
|
||||||
|
|
||||||
-- neodev
|
-- TODO: Needs to be moved to its own file
|
||||||
require("neodev").setup({})
|
|
||||||
|
|
||||||
|
|
||||||
-- Mason
|
-- Mason
|
||||||
require('mason-config')
|
require('mason-config')
|
||||||
lspconfig = require "lspconfig"
|
lspconfig = require "lspconfig"
|
||||||
|
|
@ -41,25 +38,7 @@ lspconfig.lua_ls.setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lspconfig.rust_analyzer.setup {}
|
lspconfig.rust_analyzer.setup {}
|
||||||
lspconfig.clangd.setup {
|
lspconfig.clangd.setup {}
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
navic.attach(client, bufnr)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- conform
|
|
||||||
require("conform").setup({
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { "stylua" },
|
|
||||||
-- Conform will run multiple formatters sequentially
|
|
||||||
python = { "isort", "black" },
|
|
||||||
-- Use a sub-list to run only the first available formatter
|
|
||||||
javascript = { { "prettierd", "prettier" } },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Telescope
|
|
||||||
require("telescope").load_extension "file_browser"
|
|
||||||
|
|
||||||
-- General
|
-- General
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
|
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
|
||||||
"gx.nvim": { "branch": "main", "commit": "78070bbd8e7e15a1623cdd6832a9529d2ee63e0c" },
|
"gx.nvim": { "branch": "main", "commit": "78070bbd8e7e15a1623cdd6832a9529d2ee63e0c" },
|
||||||
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
||||||
|
"hlsearch.nvim": { "branch": "main", "commit": "fdeb60b890d15d9194e8600042e5232ef8c29b0e" },
|
||||||
"hop.nvim": { "branch": "master", "commit": "6d853addd6e11df8338b26e869a29b36f2c3e893" },
|
"hop.nvim": { "branch": "master", "commit": "6d853addd6e11df8338b26e869a29b36f2c3e893" },
|
||||||
"inc-rename.nvim": { "branch": "main", "commit": "e346532860e1896b1085815e854ed14e2f066a2c" },
|
"inc-rename.nvim": { "branch": "main", "commit": "e346532860e1896b1085815e854ed14e2f066a2c" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" },
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
||||||
"maximize.nvim": { "branch": "master", "commit": "97bfc171775c404396f8248776347ebe64474fe7" },
|
"maximize.nvim": { "branch": "master", "commit": "97bfc171775c404396f8248776347ebe64474fe7" },
|
||||||
|
"move.nvim": { "branch": "main", "commit": "cccbd4ea9049ca5f99f025ffaddb7392359c7d6a" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "029899ea32d3dc8ed8c910ceca2ee5d16e566c11" },
|
"neodev.nvim": { "branch": "main", "commit": "029899ea32d3dc8ed8c910ceca2ee5d16e566c11" },
|
||||||
"neogit": { "branch": "master", "commit": "e02121f5aad420dc16411a6cde59879230f9d5b9" },
|
"neogit": { "branch": "master", "commit": "e02121f5aad420dc16411a6cde59879230f9d5b9" },
|
||||||
|
|
@ -44,6 +46,8 @@
|
||||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" },
|
"nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" },
|
"nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" },
|
||||||
|
"nvim-spectre": { "branch": "master", "commit": "9653847cf2f225648967f6e9363643e327387579" },
|
||||||
|
"nvim-spider": { "branch": "main", "commit": "828444de406bc7df3b30c8e000ce6f54f0754499" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
|
"nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" },
|
"nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ vim.keymap.set('', 'F', function()
|
||||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
||||||
end, {remap=true})
|
end, {remap=true})
|
||||||
vim.keymap.set('', 't', function()
|
vim.keymap.set('', 't', function()
|
||||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = false, hint_offset = -1 })
|
||||||
end, {remap=true})
|
end, {remap=true})
|
||||||
vim.keymap.set('', 'T', function()
|
vim.keymap.set('', 'T', function()
|
||||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false, hint_offset = 1 })
|
||||||
end, {remap=true})
|
end, {remap=true})
|
||||||
|
|
||||||
-- Lspsaga
|
-- Lspsaga
|
||||||
|
|
@ -72,3 +72,54 @@ vim.keymap.set("n", "<leader>lr", ":Lspsaga rename<CR>", { noremap = true, silen
|
||||||
-- action-preview
|
-- action-preview
|
||||||
-- This is for code actions
|
-- This is for code actions
|
||||||
vim.keymap.set({ "v", "n" }, "<C-.>", require("actions-preview").code_actions)
|
vim.keymap.set({ "v", "n" }, "<C-.>", require("actions-preview").code_actions)
|
||||||
|
|
||||||
|
-- Spectre
|
||||||
|
vim.keymap.set('n', '<leader>S', '<cmd>lua require("spectre").toggle()<CR>', {
|
||||||
|
desc = "Toggle Spectre"
|
||||||
|
})
|
||||||
|
vim.keymap.set('n', '<leader>sw', '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
|
||||||
|
desc = "Search current word"
|
||||||
|
})
|
||||||
|
vim.keymap.set('v', '<leader>sw', '<esc><cmd>lua require("spectre").open_visual()<CR>', {
|
||||||
|
desc = "Search current word"
|
||||||
|
})
|
||||||
|
vim.keymap.set('n', '<leader>sp', '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
|
||||||
|
desc = "Search on current file"
|
||||||
|
})
|
||||||
|
|
||||||
|
-- nvim-spider
|
||||||
|
vim.keymap.set(
|
||||||
|
{ "n", "o", "x" },
|
||||||
|
"w",
|
||||||
|
"<cmd>lua require('spider').motion('w')<CR>",
|
||||||
|
{ desc = "Spider-w" }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
{ "n", "o", "x" },
|
||||||
|
"e",
|
||||||
|
"<cmd>lua require('spider').motion('e')<CR>",
|
||||||
|
{ desc = "Spider-e" }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
{ "n", "o", "x" },
|
||||||
|
"b",
|
||||||
|
"<cmd>lua require('spider').motion('b')<CR>",
|
||||||
|
{ desc = "Spider-b" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- move.nvim
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
-- Normal-mode commands
|
||||||
|
vim.keymap.set('n', '<A-j>', ':MoveLine(1)<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<A-k>', ':MoveLine(-1)<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<A-h>', ':MoveHChar(-1)<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<A-l>', ':MoveHChar(1)<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<leader>wf', ':MoveWord(1)<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<leader>wb', ':MoveWord(-1)<CR>', opts)
|
||||||
|
|
||||||
|
-- Visual-mode commands
|
||||||
|
vim.keymap.set('v', '<A-j>', ':MoveBlock(1)<CR>', opts)
|
||||||
|
vim.keymap.set('v', '<A-k>', ':MoveBlock(-1)<CR>', opts)
|
||||||
|
vim.keymap.set('v', '<A-h>', ':MoveHBlock(-1)<CR>', opts)
|
||||||
|
vim.keymap.set('v', '<A-l>', ':MoveHBlock(1)<CR>', opts)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
return {
|
return {
|
||||||
|
-- LSP
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
@ -71,22 +72,6 @@ return {
|
||||||
winbar = 1000,
|
winbar = 1000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sections = {
|
|
||||||
lualine_a = { 'mode' },
|
|
||||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = { 'encoding', 'fileformat', 'filetype', 'filename' },
|
|
||||||
lualine_y = { 'progress' },
|
|
||||||
lualine_z = { 'location' }
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = {},
|
|
||||||
lualine_x = { 'filename', 'location' },
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
tabline = {},
|
tabline = {},
|
||||||
winbar = {},
|
winbar = {},
|
||||||
inactive_winbar = {},
|
inactive_winbar = {},
|
||||||
|
|
@ -106,6 +91,44 @@ return {
|
||||||
},
|
},
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
'navarasu/onedark.nvim',
|
'navarasu/onedark.nvim',
|
||||||
|
{
|
||||||
|
-- Hides the highlight after searching and going into insert mode
|
||||||
|
'nvimdev/hlsearch.nvim',
|
||||||
|
event = { "BufRead" },
|
||||||
|
config = function()
|
||||||
|
require('hlsearch').setup()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-pack/nvim-spectre'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'chrisgrieser/nvim-spider',
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fedepujol/move.nvim',
|
||||||
|
config = function()
|
||||||
|
require('move').setup({
|
||||||
|
require('move').setup({
|
||||||
|
line = {
|
||||||
|
enable = true, -- Enables line movement
|
||||||
|
indent = true -- Toggles indentation
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
enable = true, -- Enables block movement
|
||||||
|
indent = true -- Toggles indentation
|
||||||
|
},
|
||||||
|
word = {
|
||||||
|
enable = true, -- Enables word movement
|
||||||
|
},
|
||||||
|
char = {
|
||||||
|
enable = true-- Enables char movement
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'smoka7/hop.nvim',
|
'smoka7/hop.nvim',
|
||||||
version = "*",
|
version = "*",
|
||||||
|
|
@ -157,6 +180,7 @@ return {
|
||||||
config = function()
|
config = function()
|
||||||
local tl = require('telescope')
|
local tl = require('telescope')
|
||||||
tl.load_extension('aerial')
|
tl.load_extension('aerial')
|
||||||
|
tl.load_extension("file_browser")
|
||||||
tl.setup {
|
tl.setup {
|
||||||
pickers = {
|
pickers = {
|
||||||
find_files = {
|
find_files = {
|
||||||
|
|
@ -336,7 +360,12 @@ return {
|
||||||
-- refer to the configuration section below
|
-- refer to the configuration section below
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'folke/neodev.nvim',
|
{
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
config = function()
|
||||||
|
require('neodev').setup {}
|
||||||
|
end
|
||||||
|
},
|
||||||
{ 'vladdoster/remember.nvim', config = [[ require('remember') ]] },
|
{ 'vladdoster/remember.nvim', config = [[ require('remember') ]] },
|
||||||
{
|
{
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
|
@ -390,6 +419,17 @@ return {
|
||||||
{
|
{
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
opts = {},
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
require("conform").setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
-- Conform will run multiple formatters sequentially
|
||||||
|
python = { "isort", "black" },
|
||||||
|
-- Use a sub-list to run only the first available formatter
|
||||||
|
javascript = { { "prettierd", "prettier" } },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rmagatti/auto-session',
|
'rmagatti/auto-session',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue