save
This commit is contained in:
@@ -1,87 +1,31 @@
|
|||||||
-- Colorscheme & Theme
|
|
||||||
vim.cmd.colorscheme("vim")
|
vim.cmd.colorscheme("vim")
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
local opt = vim.opt
|
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||||
|
vim.keymap.set("n", "<C-h>", "<C-w><C-h>")
|
||||||
|
vim.keymap.set("n", "<C-j>", "<C-w><C-j>")
|
||||||
|
vim.keymap.set("n", "<C-k>", "<C-w><C-k>")
|
||||||
|
vim.keymap.set("n", "<C-l>", "<C-w><C-l>")
|
||||||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||||
|
vim.keymap.set("n", "<Esc>", ":nohlsearch<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||||
|
vim.keymap.set("n", "<leader>pv", ":Ex<CR>")
|
||||||
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
|
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>d', '"+d<CR>')
|
||||||
|
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>y', '"+y<CR>')
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.tabstop = 2
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.scrolloff = 8
|
||||||
|
vim.o.wrap = false
|
||||||
|
vim.o.winborder = "rounded"
|
||||||
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
vim.o.swapfile = false
|
||||||
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
|
||||||
local options = { noremap = true, silent = true }
|
|
||||||
if opts then
|
|
||||||
options = vim.tbl_extend("force", options, opts)
|
|
||||||
end
|
|
||||||
vim.keymap.set(mode, lhs, rhs, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
map("n", "<leader>en", ":e ~/dotfiles/nvim/.config/nvim/init.lua<CR>") -- Edit NeoVim config file ( this file )
|
|
||||||
|
|
||||||
map("n", "<Esc>", ":nohlsearch<CR>") -- Clear search highlight
|
|
||||||
map("v", "J", ":m '>+1<CR>gv=gv") -- Move the current line down
|
|
||||||
map("v", "K", ":m '<-2<CR>gv=gv") -- Move the current line up
|
|
||||||
map("n", "<C-d>", "<C-d>zz") -- Scroll down and move cursor to center
|
|
||||||
map("n", "<C-u>", "<C-u>zz") -- Scroll up and move cursor to center
|
|
||||||
map("n", "<leader>pv", ":Ex<CR>") -- Open up netrw on <leader>pv
|
|
||||||
map("n", "<C-h>", "<C-w><C-h>") -- Focus right
|
|
||||||
map("n", "<C-l>", "<C-w><C-l>") -- Focus left
|
|
||||||
map("n", "<C-j>", "<C-w><C-j>") -- Focus down
|
|
||||||
map("n", "<C-k>", "<C-w><C-k>") -- Focus up
|
|
||||||
vim.keymap.set("n", "<leader>e", function() -- Populate then toggle the quick-fix list
|
|
||||||
vim.diagnostic.setqflist({ open = false })
|
|
||||||
local is_open = false
|
|
||||||
for _, win in ipairs(vim.fn.getwininfo()) do
|
|
||||||
if win.quickfix == 1 then
|
|
||||||
is_open = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
if is_open then
|
|
||||||
vim.cmd("cclose")
|
|
||||||
else
|
|
||||||
vim.cmd("copen")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Visual settings
|
|
||||||
opt.inccommand = "split" -- Live substitution preview
|
|
||||||
opt.smartcase = true -- Override 'ignorecase' when pattern has uppercase
|
|
||||||
opt.ignorecase = true -- Ignore case in search
|
|
||||||
opt.number = true -- Show line numbers
|
|
||||||
opt.relativenumber = true -- Show relative line numbers
|
|
||||||
opt.splitbelow = true -- New horizontal splits open below
|
|
||||||
opt.splitright = true -- New vertical splits open to the right
|
|
||||||
opt.shiftwidth = 2 -- Spaces for auto-indent
|
|
||||||
opt.tabstop = 2 -- Spaces for a tab character
|
|
||||||
opt.expandtab = true -- Use spaces instead of tabs
|
|
||||||
opt.scrolloff = 8 -- Lines to keep above/below cursor
|
|
||||||
vim.cmd('autocmd BufEnter * set formatoptions-=cro') -- Disable auto-commenting on new lines
|
|
||||||
vim.cmd('autocmd BufEnter * setlocal formatoptions-=cro') -- Disable auto-commenting for local buffers
|
|
||||||
opt.wrap = false -- Do not wrap lines
|
|
||||||
opt.cursorline = true -- Highlight current line
|
|
||||||
|
|
||||||
-- File Handling
|
|
||||||
opt.swapfile = false -- Disable swap file
|
|
||||||
opt.backup = false -- Don't create backup files
|
|
||||||
opt.writebackup = false -- Don't create backup before writing
|
|
||||||
opt.backup = false -- Disable backup file
|
|
||||||
opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -- Set undo file directory
|
|
||||||
opt.undofile = true -- Enable persistent undo
|
|
||||||
opt.updatetime = 300 -- Faster completion
|
|
||||||
opt.autoread = true -- Auto reload files changed outside vim
|
|
||||||
opt.autowrite = false -- Don't auto save
|
|
||||||
|
|
||||||
-- Behavior settings
|
|
||||||
opt.hidden = true -- Allow hidden buffers
|
|
||||||
opt.errorbells = false -- No error bells
|
|
||||||
opt.backspace = "indent,eol,start" -- Better backspace behavior
|
|
||||||
opt.autochdir = false -- Don't auto change directory
|
|
||||||
opt.iskeyword:append("-") -- Treat dash as part of word
|
|
||||||
opt.path:append("**") -- include subdirectories in search
|
|
||||||
|
|
||||||
-- Basic autocommands
|
|
||||||
local augroup = vim.api.nvim_create_augroup("vxclutch", {})
|
local augroup = vim.api.nvim_create_augroup("vxclutch", {})
|
||||||
|
|
||||||
-- Return to last edit position when opening files
|
|
||||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -93,17 +37,16 @@ vim.api.nvim_create_autocmd("BufReadPost", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Disable line numbers in terminal
|
|
||||||
vim.api.nvim_create_autocmd("TermOpen", {
|
vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.opt_local.number = false
|
vim.vim.o_local.number = false
|
||||||
vim.opt_local.relativenumber = false
|
vim.vim.o_local.relativenumber = false
|
||||||
vim.opt_local.signcolumn = "no"
|
vim.vim.o_local.signcolumn = "no"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Create directories when saving files
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -114,22 +57,11 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Command-line completion
|
|
||||||
vim.opt.wildmenu = true
|
|
||||||
vim.opt.wildmode = "longest:full,full"
|
|
||||||
vim.opt.wildignore:append({ "*.o", "*.obj" })
|
|
||||||
|
|
||||||
-- Performance improvements
|
|
||||||
vim.opt.redrawtime = 10000
|
|
||||||
vim.opt.maxmempattern = 20000
|
|
||||||
|
|
||||||
-- Create undo directory if it doesn't exist
|
|
||||||
local undodir = vim.fn.expand("~/.vim/undodir")
|
local undodir = vim.fn.expand("~/.vim/undodir")
|
||||||
if vim.fn.isdirectory(undodir) == 0 then
|
if vim.fn.isdirectory(undodir) == 0 then
|
||||||
vim.fn.mkdir(undodir, "p")
|
vim.fn.mkdir(undodir, "p")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- terminal
|
|
||||||
local terminal_state = {
|
local terminal_state = {
|
||||||
buf = nil,
|
buf = nil,
|
||||||
win = nil,
|
win = nil,
|
||||||
@@ -137,27 +69,26 @@ local terminal_state = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function FloatingTerminal()
|
local function FloatingTerminal()
|
||||||
-- If terminal is already open, close it (toggle behavior)
|
|
||||||
if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then
|
if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then
|
||||||
vim.api.nvim_win_close(terminal_state.win, false)
|
vim.api.nvim_win_close(terminal_state.win, false)
|
||||||
terminal_state.is_open = false
|
terminal_state.is_open = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create buffer if it doesn't exist or is invalid
|
|
||||||
if not terminal_state.buf or not vim.api.nvim_buf_is_valid(terminal_state.buf) then
|
if not terminal_state.buf or not vim.api.nvim_buf_is_valid(terminal_state.buf) then
|
||||||
terminal_state.buf = vim.api.nvim_create_buf(false, true)
|
terminal_state.buf = vim.api.nvim_create_buf(false, true)
|
||||||
-- Set buffer options for better terminal experience
|
|
||||||
vim.api.nvim_buf_set_option(terminal_state.buf, 'bufhidden', 'hide')
|
vim.api.nvim_buf_set_vim.oion(terminal_state.buf, 'bufhidden', 'hide')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Calculate window dimensions
|
|
||||||
local width = math.floor(vim.o.columns * 0.8)
|
local width = math.floor(vim.o.columns * 0.8)
|
||||||
local height = math.floor(vim.o.lines * 0.8)
|
local height = math.floor(vim.o.lines * 0.8)
|
||||||
local row = math.floor((vim.o.lines - height) / 2)
|
local row = math.floor((vim.o.lines - height) / 2)
|
||||||
local col = math.floor((vim.o.columns - width) / 2)
|
local col = math.floor((vim.o.columns - width) / 2)
|
||||||
|
|
||||||
-- Create the floating window
|
|
||||||
terminal_state.win = vim.api.nvim_open_win(terminal_state.buf, true, {
|
terminal_state.win = vim.api.nvim_open_win(terminal_state.buf, true, {
|
||||||
relative = 'editor',
|
relative = 'editor',
|
||||||
width = width,
|
width = width,
|
||||||
@@ -168,18 +99,18 @@ local function FloatingTerminal()
|
|||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set transparency for the floating window
|
|
||||||
vim.api.nvim_win_set_option(terminal_state.win, 'winblend', 0)
|
|
||||||
|
|
||||||
-- Set transparent background for the window
|
vim.api.nvim_win_set_vim.oion(terminal_state.win, 'winblend', 0)
|
||||||
vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight',
|
|
||||||
|
|
||||||
|
vim.api.nvim_win_set_vim.oion(terminal_state.win, 'winhighlight',
|
||||||
'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder')
|
'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder')
|
||||||
|
|
||||||
-- Define highlight groups for transparency
|
|
||||||
vim.api.nvim_set_hl(0, "FloatingTermNormal", { bg = "none" })
|
vim.api.nvim_set_hl(0, "FloatingTermNormal", { bg = "none" })
|
||||||
vim.api.nvim_set_hl(0, "FloatingTermBorder", { bg = "none", })
|
vim.api.nvim_set_hl(0, "FloatingTermBorder", { bg = "none", })
|
||||||
|
|
||||||
-- Start terminal if not already running
|
|
||||||
local has_terminal = false
|
local has_terminal = false
|
||||||
local lines = vim.api.nvim_buf_get_lines(terminal_state.buf, 0, -1, false)
|
local lines = vim.api.nvim_buf_get_lines(terminal_state.buf, 0, -1, false)
|
||||||
for _, line in ipairs(lines) do
|
for _, line in ipairs(lines) do
|
||||||
@@ -196,7 +127,7 @@ local function FloatingTerminal()
|
|||||||
terminal_state.is_open = true
|
terminal_state.is_open = true
|
||||||
vim.cmd("startinsert")
|
vim.cmd("startinsert")
|
||||||
|
|
||||||
-- Set up auto-close on buffer leave
|
|
||||||
vim.api.nvim_create_autocmd("BufLeave", {
|
vim.api.nvim_create_autocmd("BufLeave", {
|
||||||
buffer = terminal_state.buf,
|
buffer = terminal_state.buf,
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -209,39 +140,29 @@ local function FloatingTerminal()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to explicitly close the terminal
|
|
||||||
local function CloseFloatingTerminal()
|
local function CloseFloatingTerminal()
|
||||||
if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then
|
if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then
|
||||||
vim.api.nvim_win_close(terminal_state.win, false)
|
vim.api.nvim_win_close(terminal_state.win, false)
|
||||||
terminal_state.is_open = false
|
terminal_state.is_open = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
vim.keymap.set("n", "<leader>t", FloatingTerminal, { noremap = true, silent = true })
|
||||||
-- Key mappings
|
|
||||||
vim.keymap.set("n", "<leader>t", FloatingTerminal, { noremap = true, silent = true})
|
|
||||||
vim.keymap.set("t", "<Esc>", function()
|
vim.keymap.set("t", "<Esc>", function()
|
||||||
if terminal_state.is_open then
|
if terminal_state.is_open then
|
||||||
vim.api.nvim_win_close(terminal_state.win, false)
|
vim.api.nvim_win_close(terminal_state.win, false)
|
||||||
terminal_state.is_open = false
|
terminal_state.is_open = false
|
||||||
end
|
end
|
||||||
end, { noremap = true, silent = true})
|
end, { noremap = true, silent = true })
|
||||||
|
vim.pack.add({
|
||||||
-- Plugins
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||||
local function bootstrap_pckr()
|
})
|
||||||
local pckr_path = vim.fn.stdpath("data") .. "/pckr/pckr.nvim"
|
local lspconfig = require("lspconfig")
|
||||||
|
local servers = { "lua_ls", "clangd" }
|
||||||
if not (vim.uv or vim.loop).fs_stat(pckr_path) then
|
for _, server in ipairs(servers) do
|
||||||
vim.fn.system({
|
lspconfig[server].setup({})
|
||||||
'git',
|
|
||||||
'clone',
|
|
||||||
"--filter=blob:none",
|
|
||||||
'https://github.com/lewis6991/pckr.nvim',
|
|
||||||
pckr_path
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.rtp:prepend(pckr_path)
|
|
||||||
end
|
end
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
bootstrap_pckr()
|
bootstrap_pckr()
|
||||||
|
|
||||||
@@ -296,6 +217,13 @@ require("pckr").add {
|
|||||||
end
|
end
|
||||||
lspconfig[server].setup(opts)
|
lspconfig[server].setup(opts)
|
||||||
end
|
end
|
||||||
|
=======
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(ev)
|
||||||
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
|
if client:supports_method('textDocument/completion') then
|
||||||
|
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||||
|
>>>>>>> 0fdc7d8 (save)
|
||||||
end
|
end
|
||||||
},
|
end,
|
||||||
}
|
})
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
require("vxclutch")
|
|
||||||
|
|
||||||
-- greetings
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
|
||||||
"cmp-tw2css": { "branch": "main", "commit": "1abe0eebcb57fcbd5538d054f0db61f4e4a1302b" },
|
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
|
||||||
"conform.nvim": { "branch": "master", "commit": "6dc21d4ce050c2e592d9635b7983d67baf216e3d" },
|
|
||||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
|
||||||
"fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" },
|
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "0797734e2bf229cc67b05e82a17e22a18f191913" },
|
|
||||||
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
|
||||||
"mini.nvim": { "branch": "main", "commit": "44a3ab2bc6b40edeb7a76359826c9779d5c70cb5" },
|
|
||||||
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" },
|
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
|
|
||||||
"oil.nvim": { "branch": "master", "commit": "09fa1d22f5edf0730824d2b222d726c8c81bbdc9" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
|
||||||
"rose-pine": { "branch": "main", "commit": "6b9840790cc7acdfadde07f308d34b62dd9cc675" },
|
|
||||||
"snacks.nvim": { "branch": "main", "commit": "706b1abc1697ca050314dc667e0900d53cad8aa4" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
|
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
|
||||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
|
||||||
"vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" },
|
|
||||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
require("vxclutch.set")
|
|
||||||
require("vxclutch.remap")
|
|
||||||
require("vxclutch.lazy_init")
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
function ColorMyPencils(color)
|
|
||||||
color = color or "rose-pine"
|
|
||||||
vim.cmd.colorscheme(color)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
"folke/tokyonight.nvim",
|
|
||||||
config = function()
|
|
||||||
require("tokyonight").setup({
|
|
||||||
style = "storm",
|
|
||||||
transparent = true,
|
|
||||||
terminal_colors = true,
|
|
||||||
styles = {
|
|
||||||
comments = { italic = false },
|
|
||||||
keywords = { italic = false },
|
|
||||||
sidebars = "dark",
|
|
||||||
floats = "dark",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rose-pine/neovim",
|
|
||||||
name = "rose-pine",
|
|
||||||
config = function()
|
|
||||||
require("rose-pine").setup({ disable_background = true })
|
|
||||||
|
|
||||||
vim.cmd("colorscheme rose-pine")
|
|
||||||
ColorMyPencils()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
return {
|
|
||||||
"stevearc/conform.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"tpope/vim-sleuth",
|
|
||||||
},
|
|
||||||
event = { "BufWritePre" },
|
|
||||||
cmd = { "ConformInfo" },
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>f",
|
|
||||||
function()
|
|
||||||
require("conform").format { async = true, lsp_fallback = true }
|
|
||||||
end,
|
|
||||||
mode = "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
notify_on_error = false,
|
|
||||||
format_on_save = function(bufnr)
|
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { "stylua" },
|
|
||||||
},
|
|
||||||
hooks = {
|
|
||||||
pre_format = function(lines, _)
|
|
||||||
-- Strip comments
|
|
||||||
local no_comments = {}
|
|
||||||
for _, line in ipairs(lines) do
|
|
||||||
if not line:match "%s*//" and not line:match "%s*/%*.*%*/" then
|
|
||||||
table.insert(no_comments, line)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return no_comments
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"tpope/vim-fugitive",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"lewis6991/gitsigns.nvim",
|
|
||||||
opts = {
|
|
||||||
signs = {
|
|
||||||
add = { text = "+" },
|
|
||||||
change = { text = "~" },
|
|
||||||
delete = { text = "_" },
|
|
||||||
topdelete = { text = "‾" },
|
|
||||||
changedelete = { text = "~" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
return {
|
|
||||||
"ThePrimeagen/harpoon",
|
|
||||||
branch = "harpoon2",
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
|
||||||
config = function()
|
|
||||||
local harpoon = require("harpoon")
|
|
||||||
|
|
||||||
-- REQUIRED
|
|
||||||
harpoon:setup()
|
|
||||||
-- REQUIRED
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>a", function()
|
|
||||||
harpoon:list():add()
|
|
||||||
end)
|
|
||||||
vim.keymap.set("n", "<C-e>", function()
|
|
||||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-1>", function()
|
|
||||||
harpoon:list():select(1)
|
|
||||||
end)
|
|
||||||
vim.keymap.set("n", "<C-2>", function()
|
|
||||||
harpoon:list():select(2)
|
|
||||||
end)
|
|
||||||
vim.keymap.set("n", "<C-3>", function()
|
|
||||||
harpoon:list():select(3)
|
|
||||||
end)
|
|
||||||
vim.keymap.set("n", "<C-4>", function()
|
|
||||||
harpoon:list():select(4)
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
dependencies = {
|
|
||||||
{ "mason-org/mason.nvim", version = "^1.0.0" },
|
|
||||||
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
|
||||||
"j-hui/fidget.nvim",
|
|
||||||
"stevearc/conform.nvim",
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"hrsh7th/cmp-buffer",
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"hrsh7th/cmp-cmdline",
|
|
||||||
"jcha0713/cmp-tw2css",
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
"saadparwaiz1/cmp_luasnip",
|
|
||||||
},
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = true,
|
|
||||||
signs = true,
|
|
||||||
underline = true,
|
|
||||||
update_in_insert = false,
|
|
||||||
severity_sort = true,
|
|
||||||
float = { border = "rounded" },
|
|
||||||
})
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local cmp_lsp = require("cmp_nvim_lsp")
|
|
||||||
local capabilities = vim.tbl_deep_extend(
|
|
||||||
"force",
|
|
||||||
vim.lsp.protocol.make_client_capabilities(),
|
|
||||||
cmp_lsp.default_capabilities()
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "CmpNormal", {})
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
|
||||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
|
||||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
|
||||||
["<C-e>"] = vim.NIL,
|
|
||||||
}),
|
|
||||||
window = {
|
|
||||||
completion = {
|
|
||||||
scrollbar = false,
|
|
||||||
border = "rounded",
|
|
||||||
winhighlight = "Normal:CmpNormal",
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
scrollbar = false,
|
|
||||||
border = "rounded",
|
|
||||||
winhighlight = "Normal:CmpNormal",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{
|
|
||||||
name = "nvim_lsp",
|
|
||||||
max_item_count = 5,
|
|
||||||
entry_filter = function(entry, _)
|
|
||||||
return cmp.lsp.CompletionItemKind.Snippet ~= entry:get_kind()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ name = "cmp-tw2css" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
}, {
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "path" },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
require("conform").setup({
|
|
||||||
formatters_by_ft = {},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("fidget").setup({})
|
|
||||||
require("mason").setup()
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
automatic_installation = false,
|
|
||||||
ensure_installed = {
|
|
||||||
"lua_ls",
|
|
||||||
"clangd",
|
|
||||||
"tinymist",
|
|
||||||
},
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
require("lspconfig")[server_name].setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
|
|
||||||
["lua_ls"] = function()
|
|
||||||
require("lspconfig").lua_ls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = { version = "Lua 5.1" },
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "bit", "vim", "it", "describe", "before_each", "after_each" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
|
|
||||||
["clangd"] = function()
|
|
||||||
require("lspconfig").clangd.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
cmd = { "clangd", "--header-insertion=iwyu" },
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
|
|
||||||
["tinymist"] = function()
|
|
||||||
require("lspconfig").tinymist.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
formatterMode = "typstyle",
|
|
||||||
exportPdf = "never",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
local l = vim.lsp
|
|
||||||
l.handlers["textDocument/hover"] = function(_, result, ctx, config)
|
|
||||||
config = config or { border = "rounded", focusable = true }
|
|
||||||
config.focus_id = ctx.method
|
|
||||||
if not (result and result.contents) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local markdown_lines = l.util.convert_input_to_markdown_lines(result.contents)
|
|
||||||
markdown_lines = vim.tbl_filter(function(line)
|
|
||||||
return line ~= ""
|
|
||||||
end, markdown_lines)
|
|
||||||
if vim.tbl_isempty(markdown_lines) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return l.util.open_floating_preview(markdown_lines, "markdown", config)
|
|
||||||
end
|
|
||||||
|
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
|
||||||
autocmd({ "BufEnter", "BufWinEnter" }, {
|
|
||||||
pattern = { "*.vert", "*.frag" },
|
|
||||||
callback = function()
|
|
||||||
vim.cmd("set filetype=glsl")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
autocmd("LspAttach", {
|
|
||||||
callback = function(e)
|
|
||||||
local opts = { buffer = e.buf }
|
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
return {
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
version = "v2.*",
|
|
||||||
build = "make install_jsregexp",
|
|
||||||
config = function()
|
|
||||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/vxclutch/snippets/" })
|
|
||||||
|
|
||||||
local ls = require("luasnip")
|
|
||||||
vim.keymap.set({ "i" }, "<C-e>", function()
|
|
||||||
ls.expand()
|
|
||||||
end, { silent = true })
|
|
||||||
vim.keymap.set({ "i", "s" }, "<C-J>", function()
|
|
||||||
ls.jump(1)
|
|
||||||
end, { silent = true })
|
|
||||||
vim.keymap.set({ "i", "s" }, "<C-K>", function()
|
|
||||||
ls.jump(-1)
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
ls.config.setup({
|
|
||||||
enable_autosnippets = true,
|
|
||||||
region_check_events = "InsertEnter",
|
|
||||||
delete_check_events = "InsertLeave",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
return {
|
|
||||||
"echasnovski/mini.nvim",
|
|
||||||
version = false,
|
|
||||||
config = function()
|
|
||||||
require("mini.ai").setup()
|
|
||||||
require("mini.surround").setup()
|
|
||||||
require("mini.pick").setup {
|
|
||||||
window = {
|
|
||||||
config = {
|
|
||||||
anchor = "NW",
|
|
||||||
row = 0,
|
|
||||||
col = 0,
|
|
||||||
width = 30,
|
|
||||||
},
|
|
||||||
style = 'minimal',
|
|
||||||
border = 'rounded',
|
|
||||||
},
|
|
||||||
options = {
|
|
||||||
use_cache = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
return {
|
|
||||||
"stevearc/oil.nvim",
|
|
||||||
opts = {},
|
|
||||||
config = function()
|
|
||||||
require("oil").setup({
|
|
||||||
default_file_explorer = true,
|
|
||||||
delete_to_trash = true,
|
|
||||||
skip_confirm_for_simple_edits = true,
|
|
||||||
use_default_keymaps = true,
|
|
||||||
keymaps = {
|
|
||||||
["g?"] = { "actions.show_help", mode = "n" },
|
|
||||||
["<CR>"] = { "actions.select" },
|
|
||||||
["<C-s>"] = false,
|
|
||||||
["<C-h>"] = false,
|
|
||||||
["<C-t>"] = false,
|
|
||||||
["<C-p>"] = false,
|
|
||||||
["<C-c>"] = false,
|
|
||||||
["<C-r>"] = { "actions.refresh" },
|
|
||||||
["-"] = { "actions.parent", mode = "n" },
|
|
||||||
["_"] = { "actions.open_cwd", mode = "n" },
|
|
||||||
["<leader>d"] = { "actions.cd", mode = "n" },
|
|
||||||
["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
|
|
||||||
["gs"] = false,
|
|
||||||
["gx"] = { "actions.open_external" },
|
|
||||||
["g."] = { "actions.toggle_hidden", mode = "n" },
|
|
||||||
},
|
|
||||||
view_options = {
|
|
||||||
show_hidden = true,
|
|
||||||
natural_order = true,
|
|
||||||
is_always_hidden = function(name, _)
|
|
||||||
return name == ".." or name == ".git"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
-- this is a sort of related
|
|
||||||
"stevearc/dressing.nvim",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"folke/snacks.nvim",
|
|
||||||
priority = 1000,
|
|
||||||
lazy = false,
|
|
||||||
---@type snacks.Config
|
|
||||||
opts = {
|
|
||||||
-- your configuration comes here
|
|
||||||
-- or leave it empty to use the default settings
|
|
||||||
-- refer to the configuration section below
|
|
||||||
bigfile = { enabled = true },
|
|
||||||
indent = { enabled = true },
|
|
||||||
input = { enabled = true },
|
|
||||||
quickfile = { enabled = true },
|
|
||||||
statuscolumn = { enabled = true },
|
|
||||||
words = { enabled = true },
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>t",
|
|
||||||
function()
|
|
||||||
Snacks.terminal.toggle()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>lg",
|
|
||||||
function()
|
|
||||||
Snacks.lazygit()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
return {
|
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
},
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local data = assert(vim.fn.stdpath "data") --[[@as string]]
|
|
||||||
|
|
||||||
require("telescope").setup {
|
|
||||||
extensions = {
|
|
||||||
wrap_results = true,
|
|
||||||
|
|
||||||
fzf = {},
|
|
||||||
history = {
|
|
||||||
path = vim.fs.joinpath(data, "telescope_history.sqlite3"),
|
|
||||||
limit = 100,
|
|
||||||
},
|
|
||||||
["ui-select"] = {
|
|
||||||
require("telescope.themes").get_dropdown {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
pcall(require("telescope").load_extension, "fzf")
|
|
||||||
pcall(require("telescope").load_extension, "smart_history")
|
|
||||||
pcall(require("telescope").load_extension, "ui-select")
|
|
||||||
|
|
||||||
local builtin = require "telescope.builtin"
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>pf", builtin.find_files)
|
|
||||||
vim.keymap.set("n", "<C-p>", builtin.git_files)
|
|
||||||
vim.keymap.set("n", "<space>fh", builtin.help_tags)
|
|
||||||
vim.keymap.set("n", "<space>fg", builtin.git_files)
|
|
||||||
vim.keymap.set("n", "<space>/", builtin.current_buffer_fuzzy_find)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>ps", function()
|
|
||||||
builtin.grep_string { search = vim.fn.input "Grep > " }
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>en", function()
|
|
||||||
builtin.find_files { cwd = vim.fn.stdpath "config" }
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
return {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
build = ":TSUpdate",
|
|
||||||
config = function()
|
|
||||||
require("nvim-treesitter.configs").setup {
|
|
||||||
-- A list of parser names, or "all"
|
|
||||||
ensure_installed = {
|
|
||||||
"vimdoc",
|
|
||||||
"c",
|
|
||||||
"lua",
|
|
||||||
"bash",
|
|
||||||
},
|
|
||||||
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
||||||
sync_install = false,
|
|
||||||
|
|
||||||
-- Automatically install missing parsers when entering buffer
|
|
||||||
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
|
|
||||||
auto_install = true,
|
|
||||||
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
-- `false` will disable the whole extension
|
|
||||||
enable = true,
|
|
||||||
disable = function(lang, buf)
|
|
||||||
if lang == "html" then
|
|
||||||
print "disabled"
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local max_filesize = 100 * 1024 -- 100 KB
|
|
||||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
||||||
if ok and stats and stats.size > max_filesize then
|
|
||||||
vim.notify(
|
|
||||||
"File larger than 100KB treesitter disabled for performance",
|
|
||||||
vim.log.levels.WARN,
|
|
||||||
{ title = "Treesitter" }
|
|
||||||
)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
||||||
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
|
|
||||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
||||||
-- Instead of true it can also be a list of languages
|
|
||||||
additional_vim_regex_highlighting = { "markdown" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
"folke/trouble.nvim",
|
|
||||||
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
|
||||||
cmd = "Trouble",
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>xx",
|
|
||||||
"<cmd>Trouble diagnostics toggle<cr>",
|
|
||||||
desc = "Diagnostics (Trouble)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
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({
|
|
||||||
spec = "vxclutch.lazy",
|
|
||||||
change_detection = { notify = false },
|
|
||||||
})
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
vim.g.mapleader = " "
|
|
||||||
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
|
||||||
local options = { noremap = true, silent = true }
|
|
||||||
if opts then
|
|
||||||
options = vim.tbl_extend("force", options, opts)
|
|
||||||
end
|
|
||||||
vim.keymap.set(mode, lhs, rhs, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove search highlight --
|
|
||||||
map("n", "<Esc>", ":nohlsearch<CR>")
|
|
||||||
|
|
||||||
-- Move lines --
|
|
||||||
map("v", "J", ":m '>+1<CR>gv=gv")
|
|
||||||
map("v", "K", ":m '<-2<CR>gv=gv")
|
|
||||||
|
|
||||||
-- Scrolling --
|
|
||||||
map("n", "<C-d>", "<C-d>zz")
|
|
||||||
map("n", "<C-u>", "<C-u>zz")
|
|
||||||
|
|
||||||
-- File navigation --
|
|
||||||
map("n", "<leader>o", ":Oil<CR>")
|
|
||||||
|
|
||||||
-- LSP
|
|
||||||
map("n", "gd", vim.lsp.buf.definition)
|
|
||||||
map("n", "<leader>r", vim.lsp.buf.rename, { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Window Controls
|
|
||||||
map("n", "<C-h>", "<C-w><C-h>")
|
|
||||||
map("n", "<C-l>", "<C-w><C-l>")
|
|
||||||
map("n", "<C-j>", "<C-w><C-j>")
|
|
||||||
map("n", "<C-k>", "<C-w><C-k>")
|
|
||||||
|
|
||||||
-- Typst
|
|
||||||
map("n", "<leader>p", "tinymist preview " .. vim.fn.expand("%:t"))
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
local opt = vim.opt
|
|
||||||
|
|
||||||
-- command mode --
|
|
||||||
opt.inccommand = "split"
|
|
||||||
opt.smartcase = true
|
|
||||||
opt.ignorecase = true
|
|
||||||
|
|
||||||
-- line numbers --
|
|
||||||
opt.number = true
|
|
||||||
opt.relativenumber = true
|
|
||||||
|
|
||||||
-- splits --
|
|
||||||
opt.splitbelow = true
|
|
||||||
opt.splitright = true
|
|
||||||
|
|
||||||
-- tabs --
|
|
||||||
opt.shiftwidth = 2
|
|
||||||
opt.tabstop = 2
|
|
||||||
opt.expandtab = true
|
|
||||||
|
|
||||||
-- cursor --
|
|
||||||
opt.guicursor = ""
|
|
||||||
opt.scrolloff = 8
|
|
||||||
|
|
||||||
-- format --
|
|
||||||
vim.cmd('autocmd BufEnter * set formatoptions-=cro')
|
|
||||||
vim.cmd('autocmd BufEnter * setlocal formatoptions-=cro')
|
|
||||||
opt.signcolumn = "yes"
|
|
||||||
opt.termguicolors = true
|
|
||||||
opt.colorcolumn = "80"
|
|
||||||
opt.wrap = false
|
|
||||||
|
|
||||||
-- Changes --
|
|
||||||
vim.opt.swapfile = false
|
|
||||||
vim.opt.backup = false
|
|
||||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
|
||||||
vim.opt.undofile = true
|
|
||||||
|
|
||||||
-- Statusline --
|
|
||||||
vim.o.statusline = "%f %m"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
return {
|
|
||||||
s("date", t(os.date("%Y/%m/%d")))
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
local ls = require("luasnip")
|
|
||||||
local s = ls.snippet
|
|
||||||
local i = ls.insert_node
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
return {
|
|
||||||
s(
|
|
||||||
{ trig = "main" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
int
|
|
||||||
main(void)
|
|
||||||
{
|
|
||||||
<>
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(3) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
{ trig = "for" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
for (int i = <>; i <>; i++) {
|
|
||||||
<>
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(3) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
local ls = require("luasnip")
|
|
||||||
local s = ls.snippet
|
|
||||||
local sn = ls.snippet_node
|
|
||||||
local t = ls.text_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
local f = ls.function_node
|
|
||||||
local d = ls.dynamic_node
|
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
local rep = require("luasnip.extras").rep
|
|
||||||
|
|
||||||
return {
|
|
||||||
s(
|
|
||||||
{ trig = "mla" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
Owen Westness
|
|
||||||
|
|
||||||
#datetime.today().display("d MMMM yyyy")
|
|
||||||
|
|
||||||
<>
|
|
||||||
]],
|
|
||||||
{ i(1) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user