init
This commit is contained in:
commit
41130c69bc
26
init.lua
Normal file
26
init.lua
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system {
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
'--branch=stable', -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup("plugins", {
|
||||||
|
dev = {
|
||||||
|
-- directory where you store your local plugin projects
|
||||||
|
path = "~/lua/nvim-plugins",
|
||||||
|
fallback = true, -- Fallback to git when local plugin doesn't exist
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("settings")
|
||||||
|
require("mappings")
|
||||||
|
require("setup")
|
31
lazy-lock.json
Normal file
31
lazy-lock.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
|
||||||
|
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
|
||||||
|
"linediff.vim": { "branch": "main", "commit": "ddae71ef5f94775d101c1c70032ebe8799f32745" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
|
"mini.files": { "branch": "main", "commit": "58e1acfadc93f56d4c2c2a8e8d93021f4d7ff411" },
|
||||||
|
"neogen": { "branch": "main", "commit": "e932ba918b56723436b77aa3efb844a11b2851ab" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "64cc1ef764a0b137a642d05cacdfe1126124fb35" },
|
||||||
|
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
|
||||||
|
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||||
|
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||||
|
"telescope-file-browser.nvim": { "branch": "master", "commit": "a46780830b576049c675680650f773bedfa8677a" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
"telescope-live-grep-args.nvim": { "branch": "master", "commit": "8ad632f793fd437865f99af5684f78300dac93fb" },
|
||||||
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
|
"vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
|
||||||
|
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
||||||
|
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
|
||||||
|
}
|
72
lua/mappings.lua
Normal file
72
lua/mappings.lua
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
local u = require("utils")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
vim.keymap.set("n", "<leader>h", ":noh<CR>")
|
||||||
|
|
||||||
|
--move line shortcut
|
||||||
|
vim.keymap.set("n", "<M-j>", ":m +1<CR>==", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<M-k>", ":m -2<CR>==", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("v", "<M-j>", ":m '>+1<CR>gv=gv", {noremap = true})
|
||||||
|
vim.keymap.set("v", "<M-k>", ":m '<-2<CR>gv=gv", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-d>", "<C-d>zz", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||||
|
|
||||||
|
--tab buffer
|
||||||
|
vim.keymap.set("n", "<leader>fn", ":bnext<CR>", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<leader>fp", ":bprev<CR>", {noremap = true})
|
||||||
|
|
||||||
|
-- wrap toggle
|
||||||
|
vim.keymap.set("n", "<leader>w", function() vim.o.wrap = not vim.o.wrap end, {noremap = true})
|
||||||
|
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Diff mappings put/get then move to next change
|
||||||
|
-- u.nmap("<leader>dg", "<CMD>diffget<CR>]c")
|
||||||
|
-- u.nmap("<leader>dp", "<CMD>diffput<CR>]c")
|
||||||
|
--
|
||||||
|
-- u.nmap("<leader>dp", "<CMD>diffput<CR>]c")
|
||||||
|
--
|
||||||
|
-- -- Remap movement to move by column layout
|
||||||
|
-- u.nvmap("j", "gj")
|
||||||
|
-- u.nvmap("k", "gk")
|
||||||
|
--
|
||||||
|
-- u.nvmap(";", ":")
|
||||||
|
|
||||||
|
-- Window splitting remap"
|
||||||
|
u.nmap("<C-h>", "<C-w>h")
|
||||||
|
u.nmap("<C-k>", "<C-w>k")
|
||||||
|
u.nmap("<C-l>", "<C-w>l")
|
||||||
|
u.nmap("<C-j>", "<C-w>j")
|
||||||
|
-- u.nmap("<C-w>z", ":cclose<CR>")
|
||||||
|
--
|
||||||
|
-- -- Exit terminal insert mode
|
||||||
|
-- u.tmap("<Esc>", "<C-\\><C-n>")
|
||||||
|
--
|
||||||
|
-- -- Delete buffer without closing the window
|
||||||
|
-- u.nmap("<leader>q", ":bp<bar>sp<bar>bn<bar>bd<CR>")
|
||||||
|
--
|
||||||
|
-- Fugitive
|
||||||
|
-- u.nmap("<leader>gw", ":Gwrite<CR>")
|
||||||
|
-- u.nmap("<leader>gr", ":Gread<CR>")
|
||||||
|
-- u.nmap("<leader>gc", ":Git commit -v<CR>")
|
||||||
|
-- u.nmap("<leader>gC", ":Git commit -v --amend<CR>")
|
||||||
|
-- u.nmap("<leader>gs", ":Git<CR>")
|
||||||
|
-- u.nmap("<leader>gd", ":Gdiff<CR>")
|
||||||
|
u.nmap("<leader>gb", ":Git blame<CR>")
|
||||||
|
|
||||||
|
u.nmap("<C-d>", "<C-d>zz")
|
||||||
|
u.nmap("<C-u>", "<C-u>zz")
|
||||||
|
|
||||||
|
u.nmap("<leader>ri", ":lua vim.lsp.inlay_hint(0)<CR>")
|
||||||
|
u.nmap("<leader>rl", ":RustFmt<CR>")
|
||||||
|
|
||||||
|
-- vim.keymap.set("n", "<leader>ri", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({0}), {0}) end)
|
||||||
|
u.nmap("<leader>d", ":lua vim.lsp.buf.hover()<CR>")
|
||||||
|
|
||||||
|
|
||||||
|
require("telescope-config")
|
||||||
|
require("minifiles-config")
|
52
lua/minifiles-config.lua
Normal file
52
lua/minifiles-config.lua
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
require('mini.files').setup({
|
||||||
|
-- Customization of shown content
|
||||||
|
content = {
|
||||||
|
-- Predicate for which file system entries to show
|
||||||
|
filter = nil,
|
||||||
|
-- What prefix to show to the left of file system entry
|
||||||
|
prefix = nil,
|
||||||
|
-- In which order to show file system entries
|
||||||
|
sort = nil,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Module mappings created only inside explorer.
|
||||||
|
-- Use `''` (empty string) to not create one.
|
||||||
|
mappings = {
|
||||||
|
close = 'q',
|
||||||
|
go_in = 'l',
|
||||||
|
go_in_plus = 'L',
|
||||||
|
go_out = 'h',
|
||||||
|
go_out_plus = 'H',
|
||||||
|
reset = '<BS>',
|
||||||
|
reveal_cwd = '@',
|
||||||
|
show_help = 'g?',
|
||||||
|
synchronize = '=',
|
||||||
|
trim_left = '<',
|
||||||
|
trim_right = '>',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- General options
|
||||||
|
options = {
|
||||||
|
-- Whether to delete permanently or move into module-specific trash
|
||||||
|
permanent_delete = true,
|
||||||
|
-- Whether to use for editing directories
|
||||||
|
use_as_default_explorer = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Customization of explorer windows
|
||||||
|
windows = {
|
||||||
|
-- Maximum number of windows to show side by side
|
||||||
|
max_number = math.huge,
|
||||||
|
-- Whether to show preview of file/directory under cursor
|
||||||
|
preview = false,
|
||||||
|
-- Width of focused window
|
||||||
|
width_focus = 50,
|
||||||
|
-- Width of non-focused window
|
||||||
|
width_nofocus = 15,
|
||||||
|
-- Width of preview window
|
||||||
|
width_preview = 25,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "-", '<CMD>lua MiniFiles.open(vim.api.nvim_buf_get_name(0)); MiniFiles.reveal_cwd()<CR>', { desc = 'Open MiniFiles' })
|
||||||
|
vim.keymap.set("n", "<ESC>", '<CMD>lua MiniFiles.close()<CR>', { desc = 'Close MiniFiles' })
|
112
lua/plugins/plugins.lua
Normal file
112
lua/plugins/plugins.lua
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
return {
|
||||||
|
-- Theme
|
||||||
|
{
|
||||||
|
-- Theme inspired by Atom
|
||||||
|
'navarasu/onedark.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('onedark').setup {
|
||||||
|
-- Set a style preset. 'dark' is default.
|
||||||
|
style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
|
||||||
|
}
|
||||||
|
require('onedark').load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Vim plugins
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
"tpope/vim-rhubarb",
|
||||||
|
|
||||||
|
"tpope/vim-commentary",
|
||||||
|
"tpope/vim-surround",
|
||||||
|
-- "christoomey/vim-tmux-navigator",
|
||||||
|
"AndrewRadev/linediff.vim",
|
||||||
|
{ "echasnovski/mini.files", version = false },
|
||||||
|
|
||||||
|
|
||||||
|
-- Nvim plugins
|
||||||
|
"nvim-treesitter/nvim-treesitter", -- {'do': ':TSUpdate'}
|
||||||
|
'danymat/neogen',
|
||||||
|
"p00f/nvim-ts-rainbow",
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
-- "jose-elias-alvarez/null-ls.nvim",
|
||||||
|
-- "jose-elias-alvarez/typescript.nvim",
|
||||||
|
-- "iamcco/markdown-preview.nvim", -- { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
|
||||||
|
-- { "olimorris/persisted.nvim", dev = true },
|
||||||
|
-- "folke/tokyonight.nvim", -- { 'branch': 'main' }
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
"williamboman/mason.nvim", -- { 'do': ':MasonUpdate' }
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
{
|
||||||
|
'ThePrimeagen/harpoon',
|
||||||
|
branch = 'harpoon2',
|
||||||
|
opts = {
|
||||||
|
menu = {
|
||||||
|
width = vim.api.nvim_win_get_width(0) - 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>q',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():add()
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon File',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<C-e>',
|
||||||
|
function()
|
||||||
|
local harpoon = require('harpoon')
|
||||||
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon Quick Menu',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-q>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(1)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-w>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(2)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-e>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(3)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-r>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(4)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-t>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(5)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
122
lua/plugins/rust-tools.lua
Normal file
122
lua/plugins/rust-tools.lua
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
local opts = {
|
||||||
|
tools = { -- rust-tools options
|
||||||
|
|
||||||
|
-- how to execute terminal commands
|
||||||
|
-- options right now: termopen / quickfix / toggleterm / vimux
|
||||||
|
-- executor = require("rust-tools.executors").termopen,
|
||||||
|
|
||||||
|
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||||
|
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||||
|
on_initialized = nil,
|
||||||
|
|
||||||
|
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
|
reload_workspace_from_cargo_toml = true,
|
||||||
|
|
||||||
|
-- These apply to the default RustSetInlayHints command
|
||||||
|
inlay_hints = {
|
||||||
|
-- automatically set inlay hints (type hints)
|
||||||
|
-- default: true
|
||||||
|
auto = false,
|
||||||
|
|
||||||
|
-- Only show inlay hints for the current line
|
||||||
|
only_current_line = false,
|
||||||
|
|
||||||
|
-- whether to show parameter hints with the inlay hints or not
|
||||||
|
-- default: true
|
||||||
|
show_parameter_hints = true,
|
||||||
|
|
||||||
|
-- prefix for parameter hints
|
||||||
|
-- default: "<-"
|
||||||
|
parameter_hints_prefix = "<- ",
|
||||||
|
|
||||||
|
-- prefix for all the other hints (type, chaining)
|
||||||
|
-- default: "=>"
|
||||||
|
other_hints_prefix = "=> ",
|
||||||
|
|
||||||
|
-- whether to align to the length of the longest line in the file
|
||||||
|
max_len_align = false,
|
||||||
|
|
||||||
|
-- padding from the left if max_len_align is true
|
||||||
|
max_len_align_padding = 1,
|
||||||
|
|
||||||
|
-- whether to align to the extreme right or not
|
||||||
|
right_align = false,
|
||||||
|
|
||||||
|
-- padding from the right if right_align is true
|
||||||
|
right_align_padding = 7,
|
||||||
|
|
||||||
|
-- The color of the hints
|
||||||
|
highlight = "Comment",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||||
|
hover_actions = {
|
||||||
|
|
||||||
|
-- the border that is used for the hover window
|
||||||
|
-- see vim.api.nvim_open_win()
|
||||||
|
border = {
|
||||||
|
{ "╭", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╮", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
{ "╯", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╰", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Maximal width of the hover window. Nil means no max.
|
||||||
|
max_width = nil,
|
||||||
|
|
||||||
|
-- Maximal height of the hover window. Nil means no max.
|
||||||
|
max_height = nil,
|
||||||
|
|
||||||
|
-- whether the hover action window gets automatically focused
|
||||||
|
-- default: false
|
||||||
|
auto_focus = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- all the opts to send to nvim-lspconfig
|
||||||
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
-- cargo = {
|
||||||
|
-- features = "all",
|
||||||
|
-- check = {
|
||||||
|
-- overrideCommand = {
|
||||||
|
-- "cargo check --quiet --message-format=json --all-targets",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- buildScripts = {
|
||||||
|
-- overideCommand = {
|
||||||
|
-- "cargo check --quiet --message-format=json --all-targets",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint(bufnr, true)
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<leader>ri", "<CMD>lua vim.lsp.inlay_hint(0)<CR>", { noremap = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}, -- rust-analyzer options
|
||||||
|
|
||||||
|
-- debugging stuff
|
||||||
|
-- dap = {
|
||||||
|
-- adapter = {
|
||||||
|
-- type = "executable",
|
||||||
|
-- command = "lldb-vscode",
|
||||||
|
-- name = "rt_lldb",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
{ "simrat39/rust-tools.nvim" },
|
||||||
|
}
|
34
lua/plugins/telescope.lua
Normal file
34
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
branch = "0.1.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
{
|
||||||
|
|
||||||
|
"nvim-telescope/telescope-live-grep-args.nvim" ,
|
||||||
|
-- This will not install any breaking changes.
|
||||||
|
-- For major updates, this must be adjusted manually.
|
||||||
|
version = "^1.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-file-browser.nvim",
|
||||||
|
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local telescope = require("telescope")
|
||||||
|
|
||||||
|
-- first setup telescope
|
||||||
|
telescope.setup({
|
||||||
|
-- your config
|
||||||
|
})
|
||||||
|
|
||||||
|
-- then load the extension
|
||||||
|
telescope.load_extension("live_grep_args")
|
||||||
|
end
|
||||||
|
-- "debugloop/telescope-undo.nvim",
|
||||||
|
-- "nvim-telescope/telescope-ui-select.nvim",
|
||||||
|
}
|
48
lua/settings.lua
Normal file
48
lua/settings.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
local opt = vim.o-- global options
|
||||||
|
|
||||||
|
vim.lsp.set_log_level("off")
|
||||||
|
|
||||||
|
-- Theme
|
||||||
|
-- Options
|
||||||
|
opt.relativenumber = true
|
||||||
|
opt.colorcolumn = "80"
|
||||||
|
opt.number = true
|
||||||
|
opt.tabstop = 2
|
||||||
|
opt.softtabstop = 2
|
||||||
|
opt.shiftwidth = 2
|
||||||
|
opt.expandtab = true
|
||||||
|
opt.smartindent = true
|
||||||
|
|
||||||
|
-- Make line numbers default
|
||||||
|
vim.wo.number = true
|
||||||
|
|
||||||
|
-- Enable mouse mode
|
||||||
|
opt.mouse = 'a'
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Enable break indent
|
||||||
|
opt.breakindent = true
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
opt.undofile = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
opt.updatetime = 250
|
||||||
|
opt.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Set completeopt to have a better completion experience
|
||||||
|
opt.completeopt = 'menuone,noselect'
|
||||||
|
|
||||||
|
--ignore case if pattern doesn't contain upper case
|
||||||
|
opt.ignorecase = true
|
||||||
|
opt.smartcase = true
|
||||||
|
|
||||||
|
--number of line to show around the cursor
|
||||||
|
opt.scrolloff = 8
|
||||||
|
|
||||||
|
-- vim.g.rustfmt_autosave = 1
|
430
lua/setup.lua
Normal file
430
lua/setup.lua
Normal file
@ -0,0 +1,430 @@
|
|||||||
|
-- debug lsp
|
||||||
|
vim.lsp.set_log_level("debug")
|
||||||
|
require("vim.lsp.log").set_format_func(vim.inspect)
|
||||||
|
|
||||||
|
-- nvim-autopairs
|
||||||
|
require("nvim-autopairs").setup()
|
||||||
|
|
||||||
|
-- web-devicons
|
||||||
|
-- require("nvim-web-devicons").setup()
|
||||||
|
|
||||||
|
-- gitsigns
|
||||||
|
require("gitsigns").setup()
|
||||||
|
|
||||||
|
-- -- TODO: Clean this up
|
||||||
|
-- vim.api.nvim_create_autocmd({ "InsertEnter" }, {
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.lsp.inlay_hint(0, true)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- vim.api.nvim_create_autocmd({ "InsertLeave" }, {
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.lsp.inlay_hint(0, true)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- lsp
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
require("mason-lspconfig").setup_handlers({
|
||||||
|
-- The first entry (without a key) will be the default handler
|
||||||
|
-- and will be called for each installed server that doesn't have
|
||||||
|
-- a dedicated handler.
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
require("lspconfig")[server_name].setup({})
|
||||||
|
end,
|
||||||
|
-- Next, you can provide a dedicated handler for specific servers.
|
||||||
|
-- For example, a handler override for the `rust_analyzer`:
|
||||||
|
-- ["rust_analyzer"] = function()
|
||||||
|
-- end,
|
||||||
|
-- lua_ls
|
||||||
|
-- ["lua_ls"] = function()
|
||||||
|
-- require("lspconfig").lua_ls.setup({
|
||||||
|
-- settings = {
|
||||||
|
-- Lua = {
|
||||||
|
-- runtime = {
|
||||||
|
-- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
-- version = "LuaJIT",
|
||||||
|
-- },
|
||||||
|
-- diagnostics = {
|
||||||
|
-- -- Get the language server to recognize the `vim` global
|
||||||
|
-- globals = { "vim" },
|
||||||
|
-- },
|
||||||
|
-- workspace = {
|
||||||
|
-- -- Make the server aware of Neovim runtime files
|
||||||
|
-- library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
-- checkThirdParty = false,
|
||||||
|
-- },
|
||||||
|
-- -- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
-- telemetry = {
|
||||||
|
-- enable = false,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- typescript
|
||||||
|
-- require("typescript").setup({
|
||||||
|
-- disable_commands = false, -- prevent the plugin from creating Vim commands
|
||||||
|
-- debug = false, -- enable debug logging for commands
|
||||||
|
-- go_to_source_definition = {
|
||||||
|
-- fallback = true, -- fall back to standard LSP definition on failure
|
||||||
|
-- },
|
||||||
|
-- server = {
|
||||||
|
-- -- pass options to lspconfig's setup method
|
||||||
|
-- on_attach = function(client, bufnr)
|
||||||
|
-- vim.keymap.set("n", "<space>rf", ":TypescriptRenameFile<CR>", { silent = true, buffer = bufnr })
|
||||||
|
-- vim.keymap.set("n", "<space>i", ":TypescriptAddMissingImports<CR>", { silent = true, buffer = bufnr })
|
||||||
|
-- vim.keymap.set("n", "<space>u", ":TypescriptRemoveUnused<CR>", { silent = true, buffer = bufnr })
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- eslint
|
||||||
|
-- require("lspconfig").eslint.setup({
|
||||||
|
-- on_attach = function(client, bufnr)
|
||||||
|
-- vim.keymap.set("n", "<space>t", ":EslintFixAll<CR>", { silent = true, buffer = bufnr })
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- nullls
|
||||||
|
-- local null_ls = require("null-ls")
|
||||||
|
-- local lSsources = {
|
||||||
|
-- null_ls.builtins.formatting.prettier.with({
|
||||||
|
-- filetypes = {
|
||||||
|
-- "javascript",
|
||||||
|
-- "typescript",
|
||||||
|
-- "css",
|
||||||
|
-- "scss",
|
||||||
|
-- "html",
|
||||||
|
-- "json",
|
||||||
|
-- "yaml",
|
||||||
|
-- "markdown",
|
||||||
|
-- "graphql",
|
||||||
|
-- "md",
|
||||||
|
-- "txt",
|
||||||
|
-- },
|
||||||
|
-- only_local = "node_modules/.bin",
|
||||||
|
-- }),
|
||||||
|
-- null_ls.builtins.formatting.rustfmt,
|
||||||
|
-- null_ls.builtins.formatting.stylua,
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- require("null-ls").setup({
|
||||||
|
-- sources = lSsources,
|
||||||
|
-- on_attach = function(client, bufnr)
|
||||||
|
-- local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
-- if client.supports_method("textDocument/formatting") then
|
||||||
|
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
|
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
-- group = augroup,
|
||||||
|
-- buffer = bufnr,
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.lsp.buf.format({
|
||||||
|
-- bufnr = bufnr,
|
||||||
|
-- filter = function(client)
|
||||||
|
-- return client.name == "null-ls"
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- nvim-cmp
|
||||||
|
vim.o.completeopt = "menu,menuone,noselect"
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
-- local cmp_kinds = {
|
||||||
|
-- Text = " ",
|
||||||
|
-- Method = " ",
|
||||||
|
-- Function = " ",
|
||||||
|
-- Constructor = " ",
|
||||||
|
-- Field = " ",
|
||||||
|
-- Variable = " ",
|
||||||
|
-- Class = " ",
|
||||||
|
-- Interface = " ",
|
||||||
|
-- Module = " ",
|
||||||
|
-- Property = " ",
|
||||||
|
-- Unit = " ",
|
||||||
|
-- Value = " ",
|
||||||
|
-- Enum = " ",
|
||||||
|
-- Keyword = " ",
|
||||||
|
-- Snippet = " ",
|
||||||
|
-- Color = " ",
|
||||||
|
-- File = " ",
|
||||||
|
-- Reference = " ",
|
||||||
|
-- Folder = " ",
|
||||||
|
-- EnumMember = " ",
|
||||||
|
-- Constant = " ",
|
||||||
|
-- Struct = " ",
|
||||||
|
-- Event = " ",
|
||||||
|
-- Operator = " ",
|
||||||
|
-- TypeParameter = " ",
|
||||||
|
-- }
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete({
|
||||||
|
config = {
|
||||||
|
sources = {
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
-- ["<C-e>"] = cmp.mapping.close(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "buffer", keyword_length = 3 },
|
||||||
|
}),
|
||||||
|
-- formatting = {
|
||||||
|
-- format = function(_, vim_item)
|
||||||
|
-- vim_item.kind = (cmp_kinds[vim_item.kind] or "") .. vim_item.kind
|
||||||
|
-- return vim_item
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
preselect = "none",
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert,noselect",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline("/", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Tree sitter
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "c", "cpp", "go", "lua", "markdown", "python", "rust", "tsx", "typescript", "vim" },
|
||||||
|
highlight = {
|
||||||
|
enable = true, -- false will disable the whole extension
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Indent
|
||||||
|
-- vim.opt.list = true
|
||||||
|
|
||||||
|
-- require("indent_blankline").setup({
|
||||||
|
-- show_current_context = true,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- Lualine
|
||||||
|
-- require("lualine").setup({
|
||||||
|
-- options = {
|
||||||
|
-- section_separators = { left = "", right = "" },
|
||||||
|
-- component_separators = { left = "", right = "" },
|
||||||
|
-- },
|
||||||
|
-- sections = {
|
||||||
|
-- lualine_c = {
|
||||||
|
-- {
|
||||||
|
-- "filename",
|
||||||
|
-- path = 1,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- lualine_x = {
|
||||||
|
-- {
|
||||||
|
-- "filetype",
|
||||||
|
-- icon_only = true,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- inactive_sections = {
|
||||||
|
-- lualine_c = {
|
||||||
|
-- {
|
||||||
|
-- "filename",
|
||||||
|
-- path = 1,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- extensions = { "quickfix" },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- mini
|
||||||
|
-- require('mini.sessions').setup()
|
||||||
|
-- require('mini.starter').setup()
|
||||||
|
-- require("persisted").setup({
|
||||||
|
-- save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), -- directory where session files are saved
|
||||||
|
-- silent = false, -- silent nvim message when sourcing session file
|
||||||
|
-- use_git_branch = true, -- create session files based on the branch of the git enabled repository
|
||||||
|
-- autosave = true, -- automatically save session files when exiting Neovim
|
||||||
|
-- should_autosave = nil, -- function to determine if a session should be autosaved
|
||||||
|
-- autoload = true, -- automatically load the session for the cwd on Neovim startup
|
||||||
|
-- on_autoload_no_session = nil, -- function to run when `autoload = true` but there is no session to load
|
||||||
|
-- follow_cwd = true, -- change session file name to match current working directory if it changes
|
||||||
|
-- allowed_dirs = nil, -- table of dirs that the plugin will auto-save and auto-load from
|
||||||
|
-- ignored_dirs = nil, -- table of dirs that are ignored when auto-saving and auto-loading
|
||||||
|
-- telescope = { -- options for the telescope extension
|
||||||
|
-- reset_prompt_after_deletion = true, -- whether to reset prompt after session deleted
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local previewers = require("telescope.previewers")
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = {
|
||||||
|
"rg",
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
"--smart-case",
|
||||||
|
},
|
||||||
|
-- layout_config = {
|
||||||
|
-- horizontal = {
|
||||||
|
-- mirror = false,
|
||||||
|
-- },
|
||||||
|
-- vertical = {
|
||||||
|
-- mirror = false,
|
||||||
|
-- },
|
||||||
|
-- -- prompt_position = "top",
|
||||||
|
-- },
|
||||||
|
-- file_sorter = require("telescope.sorters").get_fzy_sorter,
|
||||||
|
-- prompt_prefix = " 🔍 ",
|
||||||
|
-- color_devicons = true,
|
||||||
|
-- path_display = { "truncate" },
|
||||||
|
|
||||||
|
-- sorting_strategy = "ascending",
|
||||||
|
|
||||||
|
-- file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||||
|
-- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||||
|
-- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||||
|
|
||||||
|
-- mappings = {
|
||||||
|
-- i = {
|
||||||
|
-- ["<C-x>"] = false,
|
||||||
|
-- ["<C-j>"] = actions.move_selection_next,
|
||||||
|
-- ["<C-k>"] = actions.move_selection_previous,
|
||||||
|
-- ["<C-q>"] = actions.smart_send_to_qflist,
|
||||||
|
-- ["<C-s>"] = actions.cycle_previewers_next,
|
||||||
|
-- ["<C-a>"] = actions.cycle_previewers_prev,
|
||||||
|
-- ["<esc>"] = actions.close,
|
||||||
|
-- },
|
||||||
|
-- n = {
|
||||||
|
-- ["<C-s>"] = actions.cycle_previewers_next,
|
||||||
|
-- ["<C-a>"] = actions.cycle_previewers_prev,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- pickers = {
|
||||||
|
-- buffers = {
|
||||||
|
-- -- sort_mru = true,
|
||||||
|
-- ignore_current_buffer = true,
|
||||||
|
-- },
|
||||||
|
-- git_files = {
|
||||||
|
-- git_command = { "git", "ls-files", "--exclude-standard", "--cached", "--others", "--deduplicate" },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- extensions = {
|
||||||
|
-- fzf = {
|
||||||
|
-- override_generic_sorter = false,
|
||||||
|
-- override_file_sorter = true,
|
||||||
|
-- case_mode = "smart_case",
|
||||||
|
-- },
|
||||||
|
-- undo = {
|
||||||
|
-- side_by_side = true,
|
||||||
|
-- layout_config = {
|
||||||
|
-- preview_height = 0.8,
|
||||||
|
-- sorting_strategy = "descending",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
-- require("telescope").load_extension("ui-select")
|
||||||
|
-- require("telescope").load_extension("undo")
|
||||||
|
-- require("telescope").load_extension("file_browser")
|
||||||
|
|
||||||
|
-- Disable underline
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = true,
|
||||||
|
underline = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
require('neogen').setup {}
|
||||||
|
vim.keymap.set('n', '<leader>ne', ':lua require("neogen").generate()<CR>', { desc = '[G]enerate [D]ocumentation' })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Key bindings
|
||||||
|
|
||||||
|
-- common lsp
|
||||||
|
vim.api.nvim_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>k", "<cmd>lua vim.lsp.buf.signature_help()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>t", "<cmd>lua vim.lsp.buf.format()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<space>wl",
|
||||||
|
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
|
||||||
|
{ silent = true }
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<A-]>", "<cmd>Lspsaga peek_definition<CR>", { silent = true })
|
||||||
|
|
||||||
|
-- nvim tree
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<space>f", "<cmd>NvimTreeToggle<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<space>fF", "<CMD>Telescope file_browser<CR>", { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap(
|
||||||
|
-- "n",
|
||||||
|
-- "<space>ff",
|
||||||
|
-- "<CMD>Telescope file_browser path=%:p:h select_buffer=true<CR>",
|
||||||
|
-- { noremap = true }
|
||||||
|
-- )
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<space>fg", "<CMD>lua require'telescope-config'.project_files()<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-p>", "<CMD>Telescope find_files<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-b>", "<CMD>Telescope buffers<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-f>", "<CMD>Telescope live_grep<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-e>", "<CMD>Telescope grep_string<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-g>", "<CMD>Telescope git_bcommits<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-s>", "<CMD>Telescope lsp_references<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-Space>", "<CMD>Telescope resume<CR>", { noremap = true })
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-a>", "<CMD>lua vim.lsp.buf.code_action()<CR>", { noremap = true })
|
23
lua/telescope-config.lua
Normal file
23
lua/telescope-config.lua
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
local telescope = require('telescope')
|
||||||
|
local lga_actions = require("telescope-live-grep-args.actions")
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
local live_grep_args_shortcuts = require("telescope-live-grep-args.shortcuts")
|
||||||
|
|
||||||
|
telescope.setup {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
['<C-u>'] = false,
|
||||||
|
['<C-d>'] = false,
|
||||||
|
["<C-k>"] = lga_actions.quote_prompt(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
telescope.load_extension("live_grep_args")
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set("n", "<leader>pg", telescope.extensions.live_grep_args.live_grep_args)
|
||||||
|
vim.keymap.set('n', '<leader>lg', builtin.live_grep, {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>pw", live_grep_args_shortcuts.grep_word_under_cursor)
|
27
lua/utils.lua
Normal file
27
lua/utils.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.map = function(mode, shortcut, command)
|
||||||
|
vim.keymap.set(mode, shortcut, command, { noremap = true, silent = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
M.nmap = function(shortcut, command)
|
||||||
|
M.map("n", shortcut, command)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.imap = function(shortcut, command)
|
||||||
|
M.map("i", shortcut, command)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.vmap = function(shortcut, command)
|
||||||
|
M.vap("t", shortcut, command)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.nvmap = function(shortcut, command)
|
||||||
|
M.map({ "n", "v" }, shortcut, command)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.tmap = function(shortcut, command)
|
||||||
|
M.map("t", shortcut, command)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in New Issue
Block a user