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.path": ["lua/?.lua", "lua/?/init.lua"],
|
||||
"diagnostics.globals": ["vim",
|
||||
"ipairs",
|
||||
"require",
|
||||
"pairs",
|
||||
"type",
|
||||
"unpack",
|
||||
"table"],
|
||||
"diagnostics.globals": [
|
||||
"vim",
|
||||
"ipairs",
|
||||
"require",
|
||||
"pairs",
|
||||
"type",
|
||||
"unpack",
|
||||
"table"
|
||||
],
|
||||
"workspace.checkThirdParty": false,
|
||||
"workspace.library": ["$VIMRUNTIME", "./lua"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,26 @@
|
|||
return {
|
||||
flavour = "mocha",
|
||||
transparent_background = true,
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = '#0E1019',
|
||||
mantle = '#0D0F17',
|
||||
crust = '#0C0D14',
|
||||
surface0 = '#1a1c2d',
|
||||
surface1 = '#343959',
|
||||
surface2 = '#41476F',
|
||||
overlay0 = '#3F4256',
|
||||
overlay1 = '#5B5F7C',
|
||||
overlay2 = '#767BA0',
|
||||
text = '#eceef4',
|
||||
}
|
||||
base = "#0E1019",
|
||||
mantle = "#0D0F17",
|
||||
crust = "#0C0D14",
|
||||
surface0 = "#1a1c2d",
|
||||
surface1 = "#343959",
|
||||
surface2 = "#41476F",
|
||||
overlay0 = "#3F4256",
|
||||
overlay1 = "#5B5F7C",
|
||||
overlay2 = "#767BA0",
|
||||
text = "#eceef4",
|
||||
},
|
||||
},
|
||||
no_italic = true,
|
||||
no_bold = true,
|
||||
highlight_overrides = {
|
||||
mocha = function(colors)
|
||||
return {
|
||||
Visual = { bg = colors.overlay1 },
|
||||
Visual = { bg = colors.overlay1 },
|
||||
|
||||
-- Floating windows
|
||||
NormalFloat = { fg = colors.text, bg = colors.mantle },
|
||||
|
|
@ -39,7 +40,7 @@ return {
|
|||
-- indent lines
|
||||
IblScope = { fg = colors.surface0 },
|
||||
|
||||
IncSearch = { bg = colors.yellow },
|
||||
IncSearch = { bg = colors.yellow },
|
||||
|
||||
-- LSP
|
||||
-- LspReferenceText = { bg = colors.surface0 },
|
||||
|
|
@ -57,13 +58,13 @@ return {
|
|||
TelescopeSelection = { fg = colors.text, bg = colors.surface0 },
|
||||
|
||||
-- Statusline
|
||||
StatusLine = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineNormal = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle },
|
||||
StatusLine = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineNormal = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle },
|
||||
StatusLineInsert = { fg = colors.base, bg = colors.blue },
|
||||
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
|
||||
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
|
||||
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
||||
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
||||
|
||||
-- Syntax
|
||||
PreProc = { link = "Include" },
|
||||
|
|
@ -101,7 +102,7 @@ return {
|
|||
["@namespace_name.php"] = { link = "@text" },
|
||||
["@namespace_alias.php"] = { link = "@text" },
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
|
|
@ -111,6 +112,6 @@ return {
|
|||
noice = true,
|
||||
telescope = {
|
||||
enabled = true,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
return {
|
||||
format_options = {
|
||||
async = true,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
bash = { "shfmt" },
|
||||
blade = { "blade-formatter" },
|
||||
lua = { "stylua" },
|
||||
["_"] = { "prettier" }
|
||||
}
|
||||
format_options = {
|
||||
async = true,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
bash = { "shfmt" },
|
||||
blade = { "blade-formatter" },
|
||||
lua = { "stylua" },
|
||||
["_"] = { "prettier" },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
local cmd = vim.cmd
|
||||
local buffers = require('utils.buffers')
|
||||
local telescope = require('utils.telescope')
|
||||
|
||||
return {
|
||||
leader = " ",
|
||||
|
|
@ -62,8 +63,7 @@ return {
|
|||
{ 'n', "<Tab>", "^=$" },
|
||||
{ 'x', "<Tab>", "=", { desc = "auto indent selection" } },
|
||||
{ "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
|
||||
-- {'n', "p", "p=$"},
|
||||
|
|
@ -95,16 +95,17 @@ return {
|
|||
},
|
||||
whichkey = {
|
||||
mode = { "n", "v", "x" },
|
||||
["<leader>r"] = { name = "+Rename" },
|
||||
["<leader>b"] = { name = "+Buffers" },
|
||||
["<leader>f"] = { name = "+Format" },
|
||||
["<leader>fc"] = { name = "+Case" },
|
||||
["<leader>r"] = { name = "+Rename" },
|
||||
["<leader>b"] = { name = "+Buffers" },
|
||||
["<leader>f"] = { name = "+Format" },
|
||||
["<leader>fc"] = { name = "+Case" },
|
||||
["<leader>fcs"] = { name = "+snake_case" },
|
||||
["<leader>fh"] = { name = "+Hex" },
|
||||
["<leader>F"] = { name = "+Files" },
|
||||
["<leader>d"] = { name = "+Diagnostics" },
|
||||
["<leader>s"] = { name = "+Search" },
|
||||
["<leader>g"] = { name = "+Git" },
|
||||
["<leader>fh"] = { name = "+Hex" },
|
||||
["<leader>F"] = { name = "+Files" },
|
||||
["<leader>d"] = { name = "+Diagnostics" },
|
||||
["<leader>s"] = { name = "+Search" },
|
||||
["<leader>c"] = { name = "+Code" },
|
||||
["<leader>g"] = { name = "+Git" },
|
||||
},
|
||||
oil = {
|
||||
{ '<leader>.', function() require('oil').open_float() end, { desc = "Open parent directory" } }
|
||||
|
|
@ -129,23 +130,22 @@ return {
|
|||
-- Keybinds for buffers with an LSP client attached
|
||||
lsp = {
|
||||
{ '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>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
||||
{ '<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>sp', '<cmd>Telescope lsp_workspace_symbols<cr>', desc = 'Search Workspace symbols' },
|
||||
{ 'go', '<cmd>Telescope lsp_type_definitions<cr>', desc = "Goto type definition" },
|
||||
{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
|
||||
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
||||
{ '<leader>ss', '<cmd>Telescope lsp_document_symbols<cr>', desc = 'Search document symbols' },
|
||||
{ '<leader>si', '<cmd>Telescope lsp_implementations<cr>', desc = 'Search Inplementations' },
|
||||
{ '<leader>sp', '<cmd>Telescope lsp_workspace_symbols<cr>', desc = 'Search Workspace symbols' },
|
||||
{ 'go', '<cmd>Telescope lsp_type_definitions<cr>', desc = "Goto type definition" },
|
||||
{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
|
||||
},
|
||||
telescope = {
|
||||
{ '<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>lua require("utils.telescope").buffers()<cr>', desc = 'Search buffers' },
|
||||
{ '<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_status<cr>', desc = 'Search Git status' },
|
||||
{ '<leader>so', '<cmd>Telescope oldfiles<cr>', desc = 'Search Old files' },
|
||||
{ '<leader>sw', '<cmd>Telescope grep_string<cr>', desc = 'Search for word under cursor' },
|
||||
{ '<leader>sd', '<cmd>Telescope diagnostics<cr>', desc = 'Search Diagnostics' },
|
||||
|
|
|
|||
|
|
@ -3,5 +3,11 @@ return function(v, opts)
|
|||
local lhs = table.remove(c, 1)
|
||||
local rhs = table.remove(c, 1)
|
||||
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
|
||||
|
|
|
|||
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