Simplify configuration and plugins.
This commit is contained in:
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,6 +0,0 @@
|
|||||||
[submodule "pack/vendor/start/vim-wakatime"]
|
|
||||||
path = pack/vendor/start/vim-wakatime
|
|
||||||
url = https://github.com/wakatime/vim-wakatime.git
|
|
||||||
[submodule "pack/vendor/start/vimwiki"]
|
|
||||||
path = pack/vendor/start/vimwiki
|
|
||||||
url = https://github.com/vimwiki/vimwiki.git
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
# Neovim Config
|
# Neovim Config
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
`git clone https://github.com/saeedafzal/neovim-config.git ~/.config/nvim --recursive`
|
Requires nightly version of Neovim with built-in plugin manager.
|
||||||
|
|
||||||
|
`git clone https://github.com/saeedafzal/neovim-config.git ~/.config/nvim`
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
* [Wakatime](https://github.com/wakatime/vim-wakatime)
|
* [Wakatime](https://github.com/wakatime/vim-wakatime)
|
||||||
* [Vimwiki](https://github.com/vimwiki/vimwiki)
|
|
||||||
|
|||||||
53
init.lua
53
init.lua
@@ -1,10 +1,48 @@
|
|||||||
-- Core configuration
|
-- Settings
|
||||||
require "core"
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- Vimwiki
|
vim.o.swapfile = false
|
||||||
vim.g.vimwiki_list = {
|
vim.o.number = true
|
||||||
{ path = "~/Documents/Notes", index = "index" }
|
vim.o.relativenumber = true
|
||||||
}
|
vim.o.wrap = false
|
||||||
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
vim.o.signcolumn = "yes"
|
||||||
|
|
||||||
|
-- Indentation
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.smartindent = true
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.list = true
|
||||||
|
vim.o.listchars = "lead:·,tab:··"
|
||||||
|
|
||||||
|
-- Search
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
vim.o.hlsearch = true
|
||||||
|
vim.o.incsearch = true
|
||||||
|
|
||||||
|
-- Keybindings
|
||||||
|
vim.keymap.set("n", "<leader>o", ":update<CR>:source<CR>")
|
||||||
|
vim.keymap.set("n", "<Tab>", ":bnext<CR>")
|
||||||
|
vim.keymap.set("n", "<S-Tab>", ":bprevious<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>x", ":bd!<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>h", ":noh<CR>")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-n>", ":Oil<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>f", ":Pick files<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>b", ":Pick buffers<CR>")
|
||||||
|
|
||||||
|
-- Plugins
|
||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/wakatime/vim-wakatime" },
|
||||||
|
{ src = "https://github.com/stevearc/oil.nvim" },
|
||||||
|
{ src = "https://github.com/echasnovski/mini.pick" }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Setup plugins
|
||||||
|
require("mini.pick").setup()
|
||||||
|
require("oil").setup()
|
||||||
|
|
||||||
-- Theme
|
-- Theme
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
@@ -12,4 +50,7 @@ vim.cmd [[
|
|||||||
hi NonText guibg=none
|
hi NonText guibg=none
|
||||||
hi Normal ctermbg=none
|
hi Normal ctermbg=none
|
||||||
hi NonText ctermbg=none
|
hi NonText ctermbg=none
|
||||||
|
|
||||||
|
hi statusline guibg=none
|
||||||
|
hi statusline guifg=white
|
||||||
]]
|
]]
|
||||||
|
|||||||
@@ -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" })
|
|
||||||
1
pack/vendor/start/vim-wakatime
vendored
1
pack/vendor/start/vim-wakatime
vendored
Submodule pack/vendor/start/vim-wakatime deleted from e46d7c4f98
1
pack/vendor/start/vimwiki
vendored
1
pack/vendor/start/vimwiki
vendored
Submodule pack/vendor/start/vimwiki deleted from 72792615e7
Reference in New Issue
Block a user