Compare commits

..

11 Commits

Author SHA1 Message Date
3e63e701b4 Add ignore paths. 2025-11-30 19:36:50 +00:00
Saeed Afzal
a3c43dc5ea Refactor configuration. 2025-11-11 21:24:04 +00:00
Saeed Afzal
871d8ebc66 Add plugins and support light theme. 2025-09-11 22:45:54 +01:00
Saeed Afzal
5c27abe5f9 Add plugins and autocmd. 2025-08-31 20:12:09 +01:00
Saeed Afzal
a47124f34f Simplify configuration and plugins. 2025-07-31 10:59:03 +01:00
Saeed Afzal
4b57ad504d Remove neogit and plenary 2025-04-03 19:03:13 +01:00
Saeed Afzal
add76792b9 Add back vimwiki and add plugin list in readme 2025-04-02 09:03:33 +01:00
Saeed Afzal
626db96425 Remove plugin and add tsc compiler 2025-03-12 13:50:37 +00:00
Saeed Afzal
e2a7438807 Change to not use luaeval and set background colour for statusline. 2025-02-26 23:03:07 +00:00
Saeed Afzal
fb105a717b Add vimwiki. 2025-02-20 11:45:23 +00:00
Saeed Afzal
d805fd8dbe Add neogit and plenary. 2025-02-20 11:22:01 +00:00
11 changed files with 87 additions and 160 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "pack/vendor/start/vim-wakatime"]
path = pack/vendor/start/vim-wakatime
url = https://github.com/wakatime/vim-wakatime.git

View File

@@ -1,4 +1,9 @@
# Neovim Config
## 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
* [Wakatime](https://github.com/wakatime/vim-wakatime)

View File

@@ -1,10 +1,49 @@
-- Core configuration
require "core"
-- Settings
vim.g.mapleader = " "
vim.o.swapfile = false
vim.o.number = true
vim.o.relativenumber = true
vim.o.wrap = false
vim.o.clipboard = "unnamedplus"
vim.o.signcolumn = "yes"
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.termguicolors = true
-- 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
vim.o.wildignore = "**/node_modules/**,*.o,*.class"
vim.o.path = ".,**"
-- 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>", ":Exp<CR>")
-- Imports
require "core.commands"
require "core.autocmds"
-- Plugins
vim.pack.add({
{ src = "https://github.com/wakatime/vim-wakatime" }
})
-- Theme
vim.cmd [[
hi Normal guibg=none
hi NonText guibg=none
hi Normal ctermbg=none
hi NonText ctermbg=none
]]
vim.cmd [[colorscheme default]]

View File

@@ -1,24 +1,25 @@
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" },
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
callback = function()
vim.cmd [[Spaces 2]]
vim.cmd [[compiler dart]]
vim.cmd [[
hi Normal guibg=none ctermbg=none
hi NonText guibg=none ctermbg=none
hi NormalFloat guibg=none ctermbg=none
]]
end
})
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = "*.md",
command = "set conceallevel=3"
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.ts", "*.tsx" },
command = "compiler tsc"
})
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = "*.go",
command = "Tabs 4"
})
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = "*.rs",
command = "compiler cargo"
})

View File

@@ -1,5 +1,3 @@
local api, opt = vim.api, vim.opt
local function indent(n, expand)
local size = 4
if n ~= "" then size = n end
@@ -9,20 +7,20 @@ local function indent(n, expand)
size = num
end
opt.expandtab = expand
opt.shiftwidth = size
opt.tabstop = size
vim.o.expandtab = expand
vim.o.shiftwidth = size
vim.o.tabstop = size
end
api.nvim_create_user_command("Tabs", function(v)
vim.api.nvim_create_user_command("Tabs", function(v)
indent(v.args, false)
end, { nargs = "?" })
api.nvim_create_user_command("Spaces", function(v)
vim.api.nvim_create_user_command("Spaces", function(v)
indent(v.args, true)
end, { nargs = "?" })
api.nvim_create_user_command("TE", function(v)
vim.api.nvim_create_user_command("TE", function(v)
vim.cmd("split")
vim.cmd("term " .. v.args)
end, { nargs = "*", force = true })

View File

@@ -1,5 +0,0 @@
require "core.settings"
require "core.commands"
require "core.autocmds"
require "core.keys"
require "core.statusline"

View File

@@ -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>")

View File

@@ -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

View File

@@ -1,38 +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 = "%!luaeval('StatusLine()')"

8
nvim-pack-lock.json Normal file
View File

@@ -0,0 +1,8 @@
{
"plugins": {
"vim-wakatime": {
"rev": "d7973b1",
"src": "https://github.com/wakatime/vim-wakatime"
}
}
}