feat: initial commit

This commit is contained in:
hmeens
2026-03-20 16:44:13 +01:00
commit 2d9f13f9ab
28 changed files with 2716 additions and 0 deletions

69
nvim/lua/mappings.lua Normal file
View File

@@ -0,0 +1,69 @@
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("<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")
require("vimtex-config")

View 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' })

View File

@@ -0,0 +1,93 @@
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'sonph/onehalf'
use 'navarasu/onedark.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.4',
-- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
require('onedark').setup {
style = 'darker'
}
require('onedark').load()
-- use({
-- 'rose-pine/neovim',
-- as = 'rose-pine',
-- config = function()
-- vim.cmd('colorscheme rose-pine')
-- end
-- })
use {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
'neovim/nvim-lspconfig'
}
use 'hrsh7th/nvim-cmp' -- Autocompletion plugin
use 'hrsh7th/cmp-nvim-lsp' -- Autocompletion with LSPs
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use {'neoclide/coc.nvim', branch = 'release'}
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
--use {
-- 'VonHeikemen/lsp-zero.nvim',
-- branch = 'v2.x',
-- requires = {
-- -- LSP Support
-- {'neovim/nvim-lspconfig'},
-- {'williamboman/mason.nvim', run = function()
-- pcall(vim.cmd, 'MasonUpdate')
-- end,},
-- {'williamboman/mason-lspconfig.nvim'}, -- Optional
-- -- Autocompletion
-- {'hrsh7th/nvim-cmp'}, -- Required
-- {'hrsh7th/cmp-nvim-lsp'}, -- Required
-- {'L3MON4D3/LuaSnip'}, -- Required
-- }
--}
-- Auto pairs
use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {} end
}
--harpoon
use("theprimeagen/harpoon")
---- neogen
--local i = require("neogen.types.template").item
--local annotation = {
-- { nil, "/**", { no_results = true, type = { "func", "file", "class" } } },
-- { nil, "** \\file", { no_results = true, type = { "file" } } },
-- { nil, "** \\brief $1", { no_results = true, type = { "func", "file", "class" } } },
-- { nil, "*/", { no_results = true, type = { "func", "file", "class" } } },
-- { nil, "", { no_results = true, type = { "file" } } },
-- { nil, "/**", { type = { "func", "class", "type" } } },
-- { i.ClassName, "** @class %s", { type = { "class" } } },
-- { i.Type, "** @typedef %s", { type = { "type" } } },
-- { nil, "** \\brief $1", { type = { "func", "class", "type" } } },
-- { nil, "**", { type = { "func", "class", "type" } } },
-- { i.Tparam, "** \\tparam %s $1" },
-- { i.Parameter, "** \\param %s $1" },
-- { i.Return, "** \\return $1" },
-- { nil, "*/", { type = { "func", "class", "type" } } },
--}
--require("neogen").setup({
-- languages = {
-- c = {
-- template = {
-- annotation_convention = "my_annotation",
-- my_annotation = annotation
-- }
-- }
-- }
--})
end)

View File

@@ -0,0 +1,6 @@
return {
{
"SmiteshP/nvim-navic",
requires = "neovim/nvim-lspconfig"
}
}

View File

@@ -0,0 +1,246 @@
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
hightlights = {
Comment = { fg = '#5c6370', bg = 'NONE', fmt = 'italic' }, -- gray foreground
["@comment"] = { fg = '#5c6370', bg = 'NONE', fmt = 'italic' }, -- gray foreground
["@comment.go"] = { fg = '#5c6370', fmt = 'italic' },
}
}
require('onedark').load()
-- Force override after theme loads
vim.schedule(function()
local comment_gray = '#5c6370'
vim.api.nvim_set_hl(0, 'Comment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment.go', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment.documentation', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, 'SpecialComment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@lsp.type.comment', { fg = comment_gray, italic = true })
end)
end,
},
-- Icons (used by telescope, mini.files, etc.)
"nvim-tree/nvim-web-devicons",
-- Vim plugins
"windwp/nvim-autopairs",
-- Git
"tpope/vim-fugitive",
"tpope/vim-rhubarb",
{
"linrongbin16/gitlinker.nvim",
cmd = "GitLink",
opts = {},
keys = {
{ "<leader>gy", "<cmd>GitLink<cr>", mode = { "n", "v" }, desc = "Yank git link" },
{ "<leader>gY", "<cmd>GitLink!<cr>", mode = { "n", "v" }, desc = "Open git link" },
},
},
-- Vim
{
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "zathura"
end
},
"tpope/vim-commentary",
"tpope/vim-surround",
-- "christoomey/vim-tmux-navigator",
"AndrewRadev/linediff.vim",
{ "echasnovski/mini.files", version = false },
-- Nvim plugins
{"nvim-treesitter/nvim-treesitter", branch = 'master', lazy = false, build = ":TSUpdate"},
{ "nvim-treesitter/nvim-treesitter-context" },
'danymat/neogen',
"lukas-reineke/indent-blankline.nvim",
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
},
config = function()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require('cmp')
local luasnip = require('luasnip')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
completion = {
autocomplete = { require('cmp.types').cmp.TriggerEvent.TextChanged },
},
mapping = cmp.mapping.preset.insert ({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<s-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<c-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select=true }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
}
})
end
},
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-path",
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim"
},
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('mason').setup()
require('mason-lspconfig').setup({
ensure_installed = { "pyright", "gopls" },
handlers = {
-- Default handler for all servers
function(server_name)
require('lspconfig')[server_name].setup({
capabilities = capabilities,
})
end,
-- gopls with Go-specific settings
["gopls"] = function()
require('lspconfig').gopls.setup({
capabilities = capabilities,
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
gofumpt = true,
},
},
})
end,
},
})
end
},
"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',
},
},
},
}

View 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.enable(true, { bufnr = bufnr })
-- 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" },
}

View 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
nvim/lua/settings.lua Normal file
View File

@@ -0,0 +1,48 @@
local opt = vim.o-- global options
vim.lsp.log.set_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

90
nvim/lua/setup.lua Normal file
View File

@@ -0,0 +1,90 @@
-- nvim-autopairs
require("nvim-autopairs").setup()
-- gitsigns
require("gitsigns").setup()
require'treesitter-context'.setup{
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
multiwindow = false, -- Enable multiwindow support.
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to show for a single context
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
separator = nil,
zindex = 20, -- The Z-index of the context window
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
}
-- Tree sitter
require("nvim-treesitter.configs").setup({
ensure_installed = {
"c", "cpp", "go", "lua", "markdown", "python", "rust", "tsx", "typescript", "vim"
},
highlight = {
enable = true,
},
indent = {
enable = true,
},
context_commentstring = { enable = true },
playground = { enable = true },
query_linter = { enable = true },
locals = { enable = true },
})
-- 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",
},
},
})
require("telescope").load_extension("fzf")
-- 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.keymap.set("n", "gr", "<cmd>Telescope lsp_references<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 })

View File

@@ -0,0 +1,24 @@
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>gs', builtin.grep_string, {noremap = true})
vim.keymap.set("n", "<leader>pw", live_grep_args_shortcuts.grep_word_under_cursor)

27
nvim/lua/utils.lua Normal file
View 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.map("v", 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

View File

@@ -0,0 +1,46 @@
-- " This is necessary for VimTeX to load properly. The "indent" is optional.
-- " Note: Most plugin managers will do this automatically!
-- filetype plugin indent on
-- " This enables Vim's and neovim's syntax-related features. Without this, some
-- " VimTeX features will not work (see ":help vimtex-requirements" for more
-- " info).
-- " Note: Most plugin managers will do this automatically!
-- syntax enable
-- " Viewer options: One may configure the viewer either by specifying a built-in
-- " viewer method:
-- let g:vimtex_view_method = 'zathura'
-- " Or with a generic interface:
-- let g:vimtex_view_general_viewer = 'okular'
-- let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
-- " VimTeX uses latexmk as the default compiler backend. If you use it, which is
-- " strongly recommended, you probably don't need to configure anything. If you
-- " want another compiler backend, you can change it as follows. The list of
-- " supported backends and further explanation is provided in the documentation,
-- " see ":help vimtex-compiler".
-- let g:vimtex_compiler_method = 'latexrun'
-- " Most VimTeX mappings rely on localleader and this can be changed with the
-- " following line. The default is usually fine and is the symbol "\".
vim.cmd("filetype plugin indent on")
vim.cmd("syntax enable")
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_compiler_method = 'latexrun'
vim.g.vimtex_toc_config = {
name = 'TOC',
layers = { 'content', 'todo', 'include' },
resize = 1,
split_width = 50,
todo_sorted = 0,
show_help = 1,
show_numbers = 1,
mode = 2,
}
-- Key mappings
vim.api.nvim_set_keymap('n', '<leader>m', ':VimtexTocOpen<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>v', ':VimtexView<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>c', ':VimtexCompile<CR>', { noremap = true, silent = true })