Simplify configuration and plugins.
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
local api = vim.api
|
||||
|
||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.rs",
|
||||
command = "compiler cargo"
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.go",
|
||||
command = "Tabs 4"
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.dart",
|
||||
callback = function()
|
||||
vim.cmd [[Spaces 2]]
|
||||
vim.cmd [[compiler dart]]
|
||||
end
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.md",
|
||||
command = "set conceallevel=3"
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.ts", "*.tsc" },
|
||||
command = "compiler tsc"
|
||||
})
|
||||
@@ -1,28 +0,0 @@
|
||||
local api, opt = vim.api, vim.opt
|
||||
|
||||
local function indent(n, expand)
|
||||
local size = 4
|
||||
if n ~= "" then size = n end
|
||||
|
||||
local num = tonumber(size)
|
||||
if num then
|
||||
size = num
|
||||
end
|
||||
|
||||
opt.expandtab = expand
|
||||
opt.shiftwidth = size
|
||||
opt.tabstop = size
|
||||
end
|
||||
|
||||
api.nvim_create_user_command("Tabs", function(v)
|
||||
indent(v.args, false)
|
||||
end, { nargs = "?" })
|
||||
|
||||
api.nvim_create_user_command("Spaces", function(v)
|
||||
indent(v.args, true)
|
||||
end, { nargs = "?" })
|
||||
|
||||
api.nvim_create_user_command("TE", function(v)
|
||||
vim.cmd("split")
|
||||
vim.cmd("term " .. v.args)
|
||||
end, { nargs = "*", force = true })
|
||||
@@ -1,5 +0,0 @@
|
||||
require "core.settings"
|
||||
require "core.commands"
|
||||
require "core.autocmds"
|
||||
require "core.keys"
|
||||
require "core.statusline"
|
||||
@@ -1,32 +0,0 @@
|
||||
local function map(mode, lhs, rhs)
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, {})
|
||||
end
|
||||
|
||||
-- Buffer navigation
|
||||
map("n", "<Tab>", ":bnext<CR>")
|
||||
map("n", "<S-Tab>", ":bprevious<CR>")
|
||||
map("n", "<leader>x", ":bd!<CR>")
|
||||
|
||||
-- Resize buffer splits
|
||||
map("n", "<S-Left>", ":vertical resize +3<CR>")
|
||||
map("n", "<S-Right>", ":vertical resize -3<CR>")
|
||||
map("n", "<S-Down>", ":horizontal resize +3<CR>")
|
||||
map("n", "<S-Up>", ":horizontal resize -3<CR>")
|
||||
|
||||
-- Netrw
|
||||
map("n", "<C-n>", ":Exp<CR>")
|
||||
|
||||
-- Remove highlights
|
||||
map("n", "<leader>h", ":noh<CR>")
|
||||
|
||||
-- Replace (visual)
|
||||
map("v", "<leader>r", "\"hy:%s/<C-r>h//g<left><left>")
|
||||
|
||||
-- Neovide
|
||||
if vim.g.neovide == true then
|
||||
map("n", "<C-+>", ":lua vim.g.neovide_scale_factor = math.min(vim.g.neovide_scale_factor + 0.1, 1.0)<CR>")
|
||||
map("n", "<C-_>", ":lua vim.g.neovide_scale_factor = math.max(vim.g.neovide_scale_factor - 0.1, 0.1)<CR>")
|
||||
end
|
||||
|
||||
-- Theme toggling
|
||||
map("n", "<leader>t", ":lua require('theme_switcher').toggle()<CR>")
|
||||
@@ -1,45 +0,0 @@
|
||||
local g, opt, o = vim.g, vim.opt, vim.o
|
||||
|
||||
-- Settings
|
||||
g.mapleader = " "
|
||||
|
||||
opt.backup = false
|
||||
opt.swapfile = false
|
||||
opt.termguicolors = true
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.scrolloff = 8
|
||||
opt.sidescrolloff = 8
|
||||
opt.title = true
|
||||
opt.titlestring = "%t - NVIM"
|
||||
opt.wrap = false
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.showmode = false
|
||||
opt.binary = false
|
||||
|
||||
opt.path = ".,**"
|
||||
opt.wildignore:append({
|
||||
"**/node_modules/**",
|
||||
"**/target/**"
|
||||
})
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.list = true
|
||||
opt.listchars = "lead:·,tab:··"
|
||||
|
||||
-- Search
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.hlsearch = true
|
||||
opt.incsearch = true
|
||||
|
||||
-- Code Folding
|
||||
opt.foldmethod = "expr"
|
||||
opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
opt.foldlevel = 99
|
||||
@@ -1,40 +0,0 @@
|
||||
local fn, api, o, bo = vim.fn, vim.api, vim.o, vim.bo
|
||||
|
||||
local modes = {
|
||||
["n"] = "NORMAL",
|
||||
["v"] = "VISUAL",
|
||||
["V"] = "VISUAL LINE",
|
||||
[""] = "VISUAL BLOCK",
|
||||
["i"] = "INSERT",
|
||||
["R"] = "REPLACE",
|
||||
["Rv"] = "VISUAL REPLACE",
|
||||
["c"] = "COMMAND",
|
||||
["nt"] = "TERMINAL"
|
||||
}
|
||||
|
||||
local function mode()
|
||||
local current_mode = api.nvim_get_mode().mode
|
||||
return string.format(" %s ", modes[current_mode]):upper()
|
||||
end
|
||||
|
||||
function StatusLine()
|
||||
local filename = fn.expand("%:t")
|
||||
local filetype = bo.filetype
|
||||
local lineinfo = fn.line(".") .. ":" .. fn.col(".")
|
||||
local percent = fn.line(".") / fn.line("$") * 100
|
||||
|
||||
return table.concat {
|
||||
mode(),
|
||||
" ",
|
||||
filename,
|
||||
"%=%#StatusLineExtra#",
|
||||
filetype,
|
||||
" ",
|
||||
string.format("%3.0f", percent) .. "%% ",
|
||||
lineinfo
|
||||
}
|
||||
end
|
||||
|
||||
o.statusline = "%!v:lua.StatusLine()"
|
||||
|
||||
api.nvim_set_hl(0, "StatusLine", { bg = "#1D293D", fg = "#CAD5E2" })
|
||||
Reference in New Issue
Block a user