mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2026-02-04 06:42:05 +00:00
Added LaTeX templates and more
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- Use 'q' to quit from common plugins
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir", "git" },
|
||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir", "git", "dap-float" },
|
||||
callback = function()
|
||||
vim.cmd([[ nnoremap <silent> <buffer> q :close<cr>
|
||||
set nobuflisted
|
||||
@@ -8,17 +8,6 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set wrap and spell in markdown and gitcommit
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "gitcommit", "markdown", "vimwiki" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
-- vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd("autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif")
|
||||
|
||||
-- Fixes Autocomment
|
||||
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||
callback = function()
|
||||
@@ -36,7 +25,11 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
-- Format File on Save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format({ async = true })
|
||||
else
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -47,24 +40,6 @@ vim.api.nvim_create_autocmd({ "InsertEnter" }, {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable `expandtab` (don't replace tab with spaces)
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "lua" },
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set tab size for the following file types to 2
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "vimwiki", "sql" },
|
||||
callback = function()
|
||||
vim.opt_local.ts = 2
|
||||
vim.opt_local.sw = 2
|
||||
vim.opt_local.sts = 2
|
||||
end,
|
||||
})
|
||||
|
||||
-- Autocommand that reloads waybar whenever you save the ~/.config/waybar/config file
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("AutoReloadWaybar", { clear = true }),
|
||||
@@ -93,7 +68,7 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- Run lazy on file save
|
||||
-- Run `Lazy` on file save
|
||||
-- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
-- group = vim.api.nvim_create_augroup("AutoPackerSync", { clear = true }),
|
||||
-- pattern = { "**/lua/plugins/*" },
|
||||
@@ -102,10 +77,10 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- Set vertical column for all files
|
||||
-- Set vertical column for specific files
|
||||
-- vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
-- group = vim.api.nvim_create_augroup("SetColorColumn", { clear = true }),
|
||||
-- pattern = { "" },
|
||||
-- pattern = { "lua" },
|
||||
-- callback = function()
|
||||
-- vim.cmd.setlocal("colorcolumn=120")
|
||||
-- end,
|
||||
43
lua/config/autosave.lua
Normal file
43
lua/config/autosave.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
local attach_on_buffer = function(output_bufnr, pattern, command)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
group = vim.api.nvim_create_augroup("autosave", { clear = true }),
|
||||
pattern = pattern,
|
||||
callback = function()
|
||||
local append_data = function(_, data)
|
||||
if data then
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, -1, -1, false, data)
|
||||
end
|
||||
end
|
||||
|
||||
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, 0, -1, false, { file_path })
|
||||
vim.fn.jobstart(command, {
|
||||
stdout_buffered = true,
|
||||
on_stdout = append_data,
|
||||
on_stderr = append_data,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- vim.api.nvim_create_user_command("AutoRun", function()
|
||||
-- print("AutoRun starts now...")
|
||||
-- local bufnr = vim.api.nvim_get_current_buf()
|
||||
-- local command = vim.fn.input("Command: ")
|
||||
-- local pattern = vim.split(vim.fn.input("Pattern: "), " ")
|
||||
-- attach_on_buffer(tonumber(bufnr), pattern, command)
|
||||
-- end, {})
|
||||
--
|
||||
-- vim.api.nvim_create_user_command("AutoStop", function()
|
||||
-- vim.api.nvim_create_augroup("autosave", { clear = true })
|
||||
-- end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("AutoRun", function()
|
||||
local bufnr = vim.api.nvim_create_buf(true, true)
|
||||
vim.api.nvim_buf_set_name(bufnr, "Test")
|
||||
vim.cmd.vsplit(bufnr)
|
||||
vim.api.nvim_win_set_width(0, 50)
|
||||
-- local command = vim.fn.input("Command: ")
|
||||
-- local pattern = vim.split(vim.fn.input("Pattern: "), " ")
|
||||
-- attach_on_buffer(tonumber(bufnr), pattern, command)
|
||||
end, {})
|
||||
7
lua/config/init.lua
Normal file
7
lua/config/init.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
require("config.options")
|
||||
-- require("config.mappings")
|
||||
require("config.keymaps")
|
||||
require("config.vimwiki")
|
||||
require("config.lazy")
|
||||
require("config.autocmds")
|
||||
require("config.autosave")
|
||||
49
lua/config/keymaps.lua
Normal file
49
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
local nmap = require("config.mappings").nmap
|
||||
local xmap = require("config.mappings").xmap
|
||||
local tmap = require("config.mappings").tmap
|
||||
local vmap = require("config.mappings").vmap
|
||||
|
||||
vim.keymap.set("", "<space>", "<nop>")
|
||||
nmap("Q", "<nop>")
|
||||
nmap("q", "<nop>")
|
||||
nmap("<C-space>", "<nop>")
|
||||
|
||||
nmap("J", "mzJ`z")
|
||||
nmap("<C-d>", "<C-d>zz")
|
||||
nmap("<C-u>", "<C-u>zz")
|
||||
nmap("n", "nzzzv")
|
||||
nmap("N", "Nzzzv")
|
||||
|
||||
nmap("<C-h>", vim.cmd.TmuxNavigateLeft, "Focus window left")
|
||||
nmap("<C-j>", vim.cmd.TmuxNavigateDown, "Focus window down")
|
||||
nmap("<C-k>", vim.cmd.TmuxNavigateUp, "Focus window up")
|
||||
nmap("<C-l>", vim.cmd.TmuxNavigateRight, "Focus window right")
|
||||
|
||||
nmap("<C-Up>", "<cmd>resize -2<cr>", "Resize window up")
|
||||
nmap("<C-Down>", "<cmd>resize +2<cr>", "Resize window down")
|
||||
nmap("<C-Left>", "<cmd>vertical resize -2<cr>", "Resize window left")
|
||||
nmap("<C-Right>", "<cmd>vertical resize +2<cr>", "Resize window right")
|
||||
|
||||
nmap("<C-f>", "<cmd>!tmux neww tmux-sessionizer<cr>", "Open tmux sessionizer")
|
||||
|
||||
nmap("<A-k>", "<cmd>m .-2<cr>==", "Move line up")
|
||||
nmap("<A-j>", "<cmd>m .+1<cr>==", "Move line down")
|
||||
|
||||
nmap("<A-s>", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>", "Substitute word")
|
||||
-- nmap("<C-b>", "<cmd>w!<cr><cmd>!compiler '%:p'<cr>")
|
||||
-- nmap("<C-o>", "<cmd>w!<cr><cmd>!opout '%:p'<cr>")
|
||||
|
||||
xmap("p", '"_dP')
|
||||
|
||||
vim.keymap.set("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true })
|
||||
vim.keymap.set("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true })
|
||||
|
||||
vmap(">", ">gv", "Right Indent")
|
||||
vmap("<", "<gv", "Left Indent")
|
||||
vmap("<A-k>", ":m '<-2<cr>gv=gv", "Move lines up")
|
||||
vmap("<A-j>", ":m '>+1<cr>gv=gv", "Move lines down")
|
||||
|
||||
-- tmap("<C-h>", "<C-\\><C-N><C-w>h")
|
||||
-- tmap("<C-j>", "<C-\\><C-N><C-w>j")
|
||||
-- tmap("<C-k>", "<C-\\><C-N><C-w>k")
|
||||
-- tmap("<C-l>", "<C-\\><C-N><C-w>l")
|
||||
14
lua/config/lazy.lua
Normal file
14
lua/config/lazy.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
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")
|
||||
35
lua/config/mappings.lua
Normal file
35
lua/config/mappings.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local M = {}
|
||||
|
||||
-- Modes
|
||||
-- normal_mode = "n",
|
||||
-- insert_mode = "i",
|
||||
-- visual_mode = "v",
|
||||
-- visual_block_mode = "x",
|
||||
-- term_mode = "t",
|
||||
-- command_mode = "c",
|
||||
--
|
||||
|
||||
M.nmap = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { desc = desc })
|
||||
end
|
||||
|
||||
M.imap = function(keys, func, desc)
|
||||
vim.keymap.set("i", keys, func, { desc = desc })
|
||||
end
|
||||
|
||||
M.vmap = function(keys, func, desc)
|
||||
vim.keymap.set("v", keys, func, { desc = desc })
|
||||
end
|
||||
|
||||
M.xmap = function(keys, func, desc)
|
||||
vim.keymap.set("x", keys, func, { desc = desc })
|
||||
end
|
||||
|
||||
M.tmap = function(keys, func, desc)
|
||||
vim.keymap.set("t", keys, func, { desc = desc })
|
||||
end
|
||||
|
||||
M.cmap = function(keys, func, desc)
|
||||
vim.keymap.set("c", keys, func, { desc = desc })
|
||||
end
|
||||
return M
|
||||
63
lua/config/options.lua
Normal file
63
lua/config/options.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
vim.opt.backup = false -- creates a backup file
|
||||
vim.opt.breakindent = true -- Enable break indent
|
||||
vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
|
||||
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
|
||||
vim.opt.colorcolumn = "120"
|
||||
vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp
|
||||
vim.opt.conceallevel = 0 -- so that `` is visible in markdown files
|
||||
vim.opt.cursorcolumn = true -- highlight the current column
|
||||
vim.opt.cursorline = true -- highlight the current line
|
||||
vim.opt.expandtab = true -- convert tabs to spaces
|
||||
vim.opt.fileencoding = "utf-8" -- the encoding written to a file
|
||||
vim.opt.fillchars.eob = " "
|
||||
vim.opt.foldmethod = "manual"
|
||||
vim.opt.guifont = "JetBrainsMono NF:h11" -- the font used in graphical neovim applications
|
||||
vim.opt.hlsearch = false -- highlight all matches on previous search pattern
|
||||
vim.opt.ignorecase = true -- ignore case in search patterns
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.isfname:append("@-@")
|
||||
vim.opt.iskeyword:append("-")
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.mouse = "a" -- allow the mouse to be used in neovim
|
||||
vim.opt.number = true -- set numbered lines
|
||||
vim.opt.numberwidth = 4 -- set number column width to 4 {default 4}
|
||||
vim.opt.pumheight = 10 -- pop up menu height
|
||||
vim.opt.relativenumber = true -- set relative numbered lines
|
||||
vim.opt.ruler = false
|
||||
vim.opt.scrolloff = 8 -- is one of my fav
|
||||
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.opt.showcmd = false
|
||||
vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
|
||||
vim.opt.showtabline = 0 -- disable tabs
|
||||
vim.opt.sidescrolloff = 8
|
||||
vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
|
||||
vim.opt.smartcase = true -- smart case
|
||||
vim.opt.smartindent = true -- make indenting smarter again
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.spell = false
|
||||
vim.opt.spelloptions:append("camel")
|
||||
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
|
||||
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
|
||||
vim.opt.swapfile = false -- creates a swapfile
|
||||
vim.opt.tabstop = 4 -- insert 4 spaces for a tab
|
||||
vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
|
||||
vim.opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
vim.opt.undodir = vim.fn.stdpath("data") .. "/nvim/undodir"
|
||||
vim.opt.undofile = true -- enable persistent undo
|
||||
vim.opt.updatetime = 50 -- faster completion (4000ms default)
|
||||
vim.opt.whichwrap:append("<,>,[,],h,l")
|
||||
vim.opt.wrap = false -- display lines as one long line
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edit
|
||||
|
||||
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
|
||||
vim.opt_local.suffixesadd:prepend(".lua")
|
||||
vim.opt_local.suffixesadd:prepend("init.lua")
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_keepdir = 0
|
||||
vim.g.netrw_localcopydircmd = "cp -r"
|
||||
vim.g.netrw_winsize = 30
|
||||
@@ -1,17 +1,4 @@
|
||||
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({
|
||||
return {
|
||||
-- core
|
||||
{ "folke/lazy.nvim" },
|
||||
{ "nvim-lua/plenary.nvim" }, -- Useful lua functions used by lots of plugins
|
||||
@@ -32,7 +19,8 @@ require("lazy").setup({
|
||||
end,
|
||||
},
|
||||
{ "laytan/cloak.nvim" },
|
||||
"numToStr/Comment.nvim",
|
||||
{ "numToStr/Comment.nvim" },
|
||||
{ "folke/which-key.nvim", lazy = true },
|
||||
|
||||
-- lsp
|
||||
{
|
||||
@@ -41,8 +29,21 @@ require("lazy").setup({
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
border = "single",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
},
|
||||
},
|
||||
|
||||
-- Autocompletion
|
||||
{
|
||||
@@ -66,9 +67,18 @@ require("lazy").setup({
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
opts = {
|
||||
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||
},
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
},
|
||||
{ "nanotee/sqls.nvim", lazy = true },
|
||||
{ "p00f/clangd_extensions.nvim", ft = { "cpp", "c" } },
|
||||
{ "Civitasv/cmake-tools.nvim", ft = { "cpp", "c" }, dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
{ "Civitasv/cmake-tools.nvim", ft = { "cpp", "c", "cmake" }, dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
dependencies = {
|
||||
@@ -77,7 +87,6 @@ require("lazy").setup({
|
||||
ft = "rust",
|
||||
},
|
||||
{
|
||||
|
||||
"Saecki/crates.nvim",
|
||||
ft = { "rust", "toml" },
|
||||
dependencies = {
|
||||
@@ -109,22 +118,31 @@ require("lazy").setup({
|
||||
-- debuggers
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = { "jayp0521/mason-nvim-dap.nvim" },
|
||||
},
|
||||
{
|
||||
"jayp0521/mason-nvim-dap.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
},
|
||||
},
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
},
|
||||
{ "ravenxrz/DAPInstall.nvim", lazy = true },
|
||||
{ "theHamsta/nvim-dap-virtual-text" },
|
||||
{
|
||||
"jayp0521/mason-nvim-dap.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"debugpy",
|
||||
"codelldb",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
ft = "python",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
},
|
||||
|
||||
-- treesitter
|
||||
{
|
||||
@@ -150,6 +168,9 @@ require("lazy").setup({
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{ "nat-418/telescope-color-names.nvim" },
|
||||
{ "nvim-telescope/telescope-dap.nvim", dependencies = {
|
||||
"nvim-dap",
|
||||
} },
|
||||
},
|
||||
},
|
||||
|
||||
@@ -190,6 +211,7 @@ require("lazy").setup({
|
||||
{ "tpope/vim-fugitive" },
|
||||
{ "lewis6991/gitsigns.nvim" },
|
||||
{ "ThePrimeagen/git-worktree.nvim" },
|
||||
{ "sindrets/diffview.nvim" },
|
||||
|
||||
-- text
|
||||
{ "vimwiki/vimwiki" },
|
||||
@@ -201,9 +223,18 @@ require("lazy").setup({
|
||||
"BufReadPre " .. vim.fn.expand("~") .. "/obsidian/**/*.md",
|
||||
},
|
||||
},
|
||||
{ "lervag/vimtex" },
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
ft = { "markdown", "vimwiki" },
|
||||
build = "cd app && yarn install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown", "vimwiki" }
|
||||
end,
|
||||
},
|
||||
|
||||
-- fun
|
||||
{ "andweeb/presence.nvim" },
|
||||
{ "ThePrimeagen/vim-be-good", lazy = true },
|
||||
{ "eandrju/cellular-automaton.nvim" },
|
||||
})
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
local attach_on_buffer = function(output_bufnr, pattern, command)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
group = vim.api.nvim_create_augroup("autosave", { clear = true }),
|
||||
pattern = pattern,
|
||||
callback = function()
|
||||
local append_data = function(_, data)
|
||||
if data then
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, -1, -1, false, data)
|
||||
end
|
||||
end
|
||||
|
||||
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, 0, -1, false, { file_path })
|
||||
vim.fn.jobstart(command, {
|
||||
stdout_buffered = true,
|
||||
on_stdout = append_data,
|
||||
on_stderr = append_data,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("AutoRun", function()
|
||||
print("AutoRun starts now...")
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local command = vim.fn.input("Command: ")
|
||||
local pattern = vim.split(vim.fn.input("Pattern: "), " ")
|
||||
attach_on_buffer(tonumber(bufnr), pattern, command)
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("AutoStop", function()
|
||||
vim.api.nvim_create_augroup("autosave", { clear = true })
|
||||
end, {})
|
||||
@@ -1,6 +0,0 @@
|
||||
require("solo.options")
|
||||
require("solo.keymaps")
|
||||
require("solo.vimwiki")
|
||||
require("solo.plugins")
|
||||
require("solo.autocommands")
|
||||
require("solo.autosave")
|
||||
@@ -1,71 +0,0 @@
|
||||
--Remap space as leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("", "<Space>", "<nop>")
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "q", "<nop>")
|
||||
|
||||
-- Modes
|
||||
-- normal_mode = "n",
|
||||
-- insert_mode = "i",
|
||||
-- visual_mode = "v",
|
||||
-- visual_block_mode = "x",
|
||||
-- term_mode = "t",
|
||||
-- command_mode = "c",
|
||||
|
||||
vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("v", "<A-j>", ":m '>+1<cr>gv=gv")
|
||||
vim.keymap.set("v", "<A-k>", ":m '<-2<cr>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vim.keymap.set("n", "<C-h>", "<cmd>TmuxNavigateLeft<cr>")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>TmuxNavigateDown<cr>")
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>TmuxNavigateUp<cr>")
|
||||
vim.keymap.set("n", "<C-l>", "<cmd>TmuxNavigateRight<cr>")
|
||||
|
||||
vim.keymap.set("n", "<C-Up>", "<cmd>resize -2<cr>")
|
||||
vim.keymap.set("n", "<C-Down>", "<cmd>resize +2<cr>")
|
||||
vim.keymap.set("n", "<C-Left>", "<cmd>vertical resize -2<cr>")
|
||||
vim.keymap.set("n", "<C-Right>", "<cmd>vertical resize +2<cr>")
|
||||
|
||||
vim.keymap.set("x", "<leader>p", '"_dP')
|
||||
|
||||
vim.keymap.set("n", "<C-f>", "<cmd>!tmux neww tmux-sessionizer<cr>")
|
||||
|
||||
vim.keymap.set("n", "<A-j>", "<cmd>m .+1<cr>==")
|
||||
vim.keymap.set("n", "<A-k>", "<cmd>m .-2<cr>==")
|
||||
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lua vim.diagnostic.goto_next()<cr>zz")
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lua vim.diagnostic.goto_prev()<cr>zz")
|
||||
vim.keymap.set("n", "<leader>r", function()
|
||||
vim.lsp.buf.rename()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<cr>", { silent = true })
|
||||
|
||||
vim.keymap.set("i", "<A-Up>", "<C-\\><C-N><C-w>k")
|
||||
vim.keymap.set("i", "<A-Down>", "<C-\\><C-N><C-w>j")
|
||||
vim.keymap.set("i", "<A-Left>", "<C-\\><C-N><C-w>h")
|
||||
vim.keymap.set("i", "<A-Right>", "<C-\\><C-N><C-w>l")
|
||||
|
||||
vim.keymap.set("v", ">", ">gv")
|
||||
vim.keymap.set("v", "<", "<gv")
|
||||
|
||||
vim.keymap.set("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true })
|
||||
vim.keymap.set("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true })
|
||||
|
||||
vim.keymap.set("t", "<C-h>", "<C-\\><C-N><C-w>h")
|
||||
vim.keymap.set("t", "<C-j>", "<C-\\><C-N><C-w>j")
|
||||
vim.keymap.set("t", "<C-k>", "<C-\\><C-N><C-w>k")
|
||||
vim.keymap.set("t", "<C-l>", "<C-\\><C-N><C-w>l")
|
||||
|
||||
vim.keymap.set("n", "<C-b>", "<cmd>w!<cr><cmd>!compiler '%:p'<cr>")
|
||||
vim.keymap.set("n", "<C-o>", "<cmd>w!<cr><cmd>!opout '%:p'<cr>")
|
||||
|
||||
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<cr>")
|
||||
@@ -1,66 +0,0 @@
|
||||
local options = {
|
||||
backup = false, -- creates a backup file
|
||||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
||||
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
fileencoding = "utf-8", -- the encoding written to a file
|
||||
hlsearch = false, -- highlight all matches on previous search pattern
|
||||
incsearch = true,
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
pumheight = 10, -- pop up menu height,
|
||||
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||
showtabline = 0, -- disable tabs
|
||||
smartcase = true, -- smart case
|
||||
smartindent = true, -- make indenting smarter again
|
||||
splitbelow = true, -- force all horizontal splits to go below current window
|
||||
splitright = true, -- force all vertical splits to go to the right of current window
|
||||
swapfile = false, -- creates a swapfile
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
timeoutlen = 250, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
undofile = true, -- enable persistent undo
|
||||
undodir = vim.fn.stdpath("data") .. "/nvim/undodir",
|
||||
updatetime = 50, -- faster completion (4000ms default)
|
||||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
expandtab = true, -- convert tabs to spaces
|
||||
shiftwidth = 4, -- the number of spaces inserted for each indentation
|
||||
tabstop = 4, -- insert 4 spaces for a tab
|
||||
cursorcolumn = true, -- highlight the current column
|
||||
cursorline = true, -- highlight the current line
|
||||
number = true, -- set numbered lines
|
||||
relativenumber = true, -- set relative numbered lines
|
||||
laststatus = 3,
|
||||
showcmd = false,
|
||||
ruler = false,
|
||||
numberwidth = 4, -- set number column width to 4 {default 4}
|
||||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||
wrap = false, -- display lines as one long line
|
||||
scrolloff = 10, -- is one of my fav
|
||||
sidescrolloff = 10,
|
||||
guifont = "JetBrainsMono NF:h11", -- the font used in graphical neovim applications
|
||||
spell = false,
|
||||
foldmethod = "manual",
|
||||
breakindent = true, -- Enable break indent
|
||||
}
|
||||
|
||||
vim.opt.fillchars.eob = " "
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.opt.whichwrap:append("<,>,[,],h,l")
|
||||
vim.opt.iskeyword:append("-")
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
vim.opt.spelloptions:append("camel")
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_winsize = 25
|
||||
|
||||
vim.opt_local.suffixesadd:prepend(".lua")
|
||||
vim.opt_local.suffixesadd:prepend("init.lua")
|
||||
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
|
||||
Reference in New Issue
Block a user