mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 03:14:55 +02:00
nvim: indent fixes and keymaps
This commit is contained in:
parent
4102585363
commit
7883d02176
6 changed files with 75 additions and 60 deletions
|
|
@ -1,13 +1,15 @@
|
||||||
{
|
{
|
||||||
"runtime.version": "LuaJIT",
|
"runtime.version": "LuaJIT",
|
||||||
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
|
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
|
||||||
"diagnostics.globals": ["vim",
|
"diagnostics.globals": [
|
||||||
"ipairs",
|
"vim",
|
||||||
"require",
|
"ipairs",
|
||||||
"pairs",
|
"require",
|
||||||
"type",
|
"pairs",
|
||||||
"unpack",
|
"type",
|
||||||
"table"],
|
"unpack",
|
||||||
|
"table"
|
||||||
|
],
|
||||||
"workspace.checkThirdParty": false,
|
"workspace.checkThirdParty": false,
|
||||||
"workspace.library": ["$VIMRUNTIME", "./lua"]
|
"workspace.library": ["$VIMRUNTIME", "./lua"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,26 @@
|
||||||
return {
|
return {
|
||||||
flavour = "mocha",
|
flavour = "mocha",
|
||||||
|
transparent_background = true,
|
||||||
color_overrides = {
|
color_overrides = {
|
||||||
mocha = {
|
mocha = {
|
||||||
base = '#0E1019',
|
base = "#0E1019",
|
||||||
mantle = '#0D0F17',
|
mantle = "#0D0F17",
|
||||||
crust = '#0C0D14',
|
crust = "#0C0D14",
|
||||||
surface0 = '#1a1c2d',
|
surface0 = "#1a1c2d",
|
||||||
surface1 = '#343959',
|
surface1 = "#343959",
|
||||||
surface2 = '#41476F',
|
surface2 = "#41476F",
|
||||||
overlay0 = '#3F4256',
|
overlay0 = "#3F4256",
|
||||||
overlay1 = '#5B5F7C',
|
overlay1 = "#5B5F7C",
|
||||||
overlay2 = '#767BA0',
|
overlay2 = "#767BA0",
|
||||||
text = '#eceef4',
|
text = "#eceef4",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
no_italic = true,
|
no_italic = true,
|
||||||
no_bold = true,
|
no_bold = true,
|
||||||
highlight_overrides = {
|
highlight_overrides = {
|
||||||
mocha = function(colors)
|
mocha = function(colors)
|
||||||
return {
|
return {
|
||||||
Visual = { bg = colors.overlay1 },
|
Visual = { bg = colors.overlay1 },
|
||||||
|
|
||||||
-- Floating windows
|
-- Floating windows
|
||||||
NormalFloat = { fg = colors.text, bg = colors.mantle },
|
NormalFloat = { fg = colors.text, bg = colors.mantle },
|
||||||
|
|
@ -39,7 +40,7 @@ return {
|
||||||
-- indent lines
|
-- indent lines
|
||||||
IblScope = { fg = colors.surface0 },
|
IblScope = { fg = colors.surface0 },
|
||||||
|
|
||||||
IncSearch = { bg = colors.yellow },
|
IncSearch = { bg = colors.yellow },
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
-- LspReferenceText = { bg = colors.surface0 },
|
-- LspReferenceText = { bg = colors.surface0 },
|
||||||
|
|
@ -57,13 +58,13 @@ return {
|
||||||
TelescopeSelection = { fg = colors.text, bg = colors.surface0 },
|
TelescopeSelection = { fg = colors.text, bg = colors.surface0 },
|
||||||
|
|
||||||
-- Statusline
|
-- Statusline
|
||||||
StatusLine = { fg = colors.text, bg = colors.mantle },
|
StatusLine = { fg = colors.text, bg = colors.mantle },
|
||||||
StatusLineNormal = { fg = colors.text, bg = colors.mantle },
|
StatusLineNormal = { fg = colors.text, bg = colors.mantle },
|
||||||
StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle },
|
StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle },
|
||||||
StatusLineInsert = { fg = colors.base, bg = colors.blue },
|
StatusLineInsert = { fg = colors.base, bg = colors.blue },
|
||||||
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
|
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
|
||||||
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
|
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
|
||||||
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
||||||
|
|
||||||
-- Syntax
|
-- Syntax
|
||||||
PreProc = { link = "Include" },
|
PreProc = { link = "Include" },
|
||||||
|
|
@ -101,7 +102,7 @@ return {
|
||||||
["@namespace_name.php"] = { link = "@text" },
|
["@namespace_name.php"] = { link = "@text" },
|
||||||
["@namespace_alias.php"] = { link = "@text" },
|
["@namespace_alias.php"] = { link = "@text" },
|
||||||
}
|
}
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
integrations = {
|
integrations = {
|
||||||
cmp = true,
|
cmp = true,
|
||||||
|
|
@ -111,6 +112,6 @@ return {
|
||||||
noice = true,
|
noice = true,
|
||||||
telescope = {
|
telescope = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
return {
|
return {
|
||||||
format_options = {
|
format_options = {
|
||||||
async = true,
|
async = true,
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
},
|
},
|
||||||
notify_on_error = true,
|
notify_on_error = true,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
bash = { "shfmt" },
|
bash = { "shfmt" },
|
||||||
blade = { "blade-formatter" },
|
blade = { "blade-formatter" },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
["_"] = { "prettier" }
|
["_"] = { "prettier" },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
local buffers = require('utils.buffers')
|
local buffers = require('utils.buffers')
|
||||||
|
local telescope = require('utils.telescope')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
leader = " ",
|
leader = " ",
|
||||||
|
|
@ -62,8 +63,7 @@ return {
|
||||||
{ 'n', "<Tab>", "^=$" },
|
{ 'n', "<Tab>", "^=$" },
|
||||||
{ 'x', "<Tab>", "=", { desc = "auto indent selection" } },
|
{ 'x', "<Tab>", "=", { desc = "auto indent selection" } },
|
||||||
{ "i", "<S-Tab>", "<C-d>", { desc = "delete indent" } },
|
{ "i", "<S-Tab>", "<C-d>", { desc = "delete indent" } },
|
||||||
|
{ 'n', "<leader>fs", [[:%s/\s\+$//g<CR>`']], { desc = "Remove trailing spaces" } },
|
||||||
{ 'n', "<leader>fs", [[:%s/\s\+$//g<CR>`']], desc = "Remove trailing spaces" },
|
|
||||||
|
|
||||||
-- fix paste
|
-- fix paste
|
||||||
-- {'n', "p", "p=$"},
|
-- {'n', "p", "p=$"},
|
||||||
|
|
@ -95,16 +95,17 @@ return {
|
||||||
},
|
},
|
||||||
whichkey = {
|
whichkey = {
|
||||||
mode = { "n", "v", "x" },
|
mode = { "n", "v", "x" },
|
||||||
["<leader>r"] = { name = "+Rename" },
|
["<leader>r"] = { name = "+Rename" },
|
||||||
["<leader>b"] = { name = "+Buffers" },
|
["<leader>b"] = { name = "+Buffers" },
|
||||||
["<leader>f"] = { name = "+Format" },
|
["<leader>f"] = { name = "+Format" },
|
||||||
["<leader>fc"] = { name = "+Case" },
|
["<leader>fc"] = { name = "+Case" },
|
||||||
["<leader>fcs"] = { name = "+snake_case" },
|
["<leader>fcs"] = { name = "+snake_case" },
|
||||||
["<leader>fh"] = { name = "+Hex" },
|
["<leader>fh"] = { name = "+Hex" },
|
||||||
["<leader>F"] = { name = "+Files" },
|
["<leader>F"] = { name = "+Files" },
|
||||||
["<leader>d"] = { name = "+Diagnostics" },
|
["<leader>d"] = { name = "+Diagnostics" },
|
||||||
["<leader>s"] = { name = "+Search" },
|
["<leader>s"] = { name = "+Search" },
|
||||||
["<leader>g"] = { name = "+Git" },
|
["<leader>c"] = { name = "+Code" },
|
||||||
|
["<leader>g"] = { name = "+Git" },
|
||||||
},
|
},
|
||||||
oil = {
|
oil = {
|
||||||
{ '<leader>.', function() require('oil').open_float() end, { desc = "Open parent directory" } }
|
{ '<leader>.', function() require('oil').open_float() end, { desc = "Open parent directory" } }
|
||||||
|
|
@ -129,23 +130,22 @@ return {
|
||||||
-- Keybinds for buffers with an LSP client attached
|
-- Keybinds for buffers with an LSP client attached
|
||||||
lsp = {
|
lsp = {
|
||||||
{ 'K', function() vim.lsp.buf.hover() end, desc = '' },
|
{ 'K', function() vim.lsp.buf.hover() end, desc = '' },
|
||||||
{ '<leader>ca', function() vim.lsp.buf.code_action() end, desc = 'Code action' },
|
{ '<leader>ca', function() vim.lsp.buf.code_action() end, mode={'n', 'x'}, desc = 'Code action' },
|
||||||
{ '<leader>rs', function() vim.lsp.buf.rename() end, desc = 'Rename symbol' },
|
{ '<leader>rs', function() vim.lsp.buf.rename() end, desc = 'Rename symbol' },
|
||||||
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
||||||
{ '<leader>ss', '<cmd>Telescope lsp_document_symbols<cr>', desc = 'Search document symbols' },
|
{ '<leader>ss', '<cmd>Telescope lsp_document_symbols<cr>', desc = 'Search document symbols' },
|
||||||
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
{ '<leader>si', '<cmd>Telescope lsp_implementations<cr>', desc = 'Search Inplementations' },
|
||||||
{ '<leader>si', '<cmd>Telescope lsp_implementations<cr>', desc = 'Search Inplementations' },
|
{ '<leader>sp', '<cmd>Telescope lsp_workspace_symbols<cr>', desc = 'Search Workspace symbols' },
|
||||||
{ '<leader>sp', '<cmd>Telescope lsp_workspace_symbols<cr>', desc = 'Search Workspace symbols' },
|
{ 'go', '<cmd>Telescope lsp_type_definitions<cr>', desc = "Goto type definition" },
|
||||||
{ 'go', '<cmd>Telescope lsp_type_definitions<cr>', desc = "Goto type definition" },
|
{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
|
||||||
{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
|
|
||||||
},
|
},
|
||||||
telescope = {
|
telescope = {
|
||||||
{ '<leader>sf', '<cmd>Telescope find_files<cr>', desc = 'Search files' },
|
{ '<leader>sf', '<cmd>Telescope find_files<cr>', desc = 'Search files' },
|
||||||
{ '<leader>sF', '<cmd>lua require("telescope.builtin").find_files({no_ignore=true})<cr>', desc = 'Search all files' },
|
{ '<leader>sF', telescope.all_files, desc = 'Search all files' },
|
||||||
{ '<leader>sb', '<cmd>Telescope buffers<cr>', desc = 'Search buffers' },
|
{ '<leader>sb', '<cmd>Telescope buffers<cr>', desc = 'Search buffers' },
|
||||||
--{ '<leader>sb', '<cmd>lua require("utils.telescope").buffers()<cr>', desc = 'Search buffers' },
|
|
||||||
{ '<leader>sa', '<cmd>Telescope live_grep<cr>', desc = 'Search in files' },
|
{ '<leader>sa', '<cmd>Telescope live_grep<cr>', desc = 'Search in files' },
|
||||||
{ '<leader>sg', '<cmd>Telescope git_files<cr>', desc = 'Search Git files' },
|
{ '<leader>sg', '<cmd>Telescope git_files<cr>', desc = 'Search Git files' },
|
||||||
|
{ '<leader>sG', '<cmd>Telescope git_status<cr>', desc = 'Search Git status' },
|
||||||
{ '<leader>so', '<cmd>Telescope oldfiles<cr>', desc = 'Search Old files' },
|
{ '<leader>so', '<cmd>Telescope oldfiles<cr>', desc = 'Search Old files' },
|
||||||
{ '<leader>sw', '<cmd>Telescope grep_string<cr>', desc = 'Search for word under cursor' },
|
{ '<leader>sw', '<cmd>Telescope grep_string<cr>', desc = 'Search for word under cursor' },
|
||||||
{ '<leader>sd', '<cmd>Telescope diagnostics<cr>', desc = 'Search Diagnostics' },
|
{ '<leader>sd', '<cmd>Telescope diagnostics<cr>', desc = 'Search Diagnostics' },
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,11 @@ return function(v, opts)
|
||||||
local lhs = table.remove(c, 1)
|
local lhs = table.remove(c, 1)
|
||||||
local rhs = table.remove(c, 1)
|
local rhs = table.remove(c, 1)
|
||||||
opts = vim.tbl_deep_extend("force", c, opts or {})
|
opts = vim.tbl_deep_extend("force", c, opts or {})
|
||||||
vim.keymap.set('n', lhs, rhs, opts)
|
|
||||||
|
local mode = 'n'
|
||||||
|
if opts.mode then
|
||||||
|
mode = opts.mode
|
||||||
|
opts.mode = nil
|
||||||
|
end
|
||||||
|
vim.keymap.set(mode, lhs, rhs, opts)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
6
nvim/lua/utils/telescope.lua
Normal file
6
nvim/lua/utils/telescope.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.all_files() require("telescope.builtin").find_files({no_ignore=true}) end
|
||||||
|
|
||||||
|
return M
|
||||||
Loading…
Add table
Add a link
Reference in a new issue