Compare commits
11 Commits
1aef2d368c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e63e701b4 | |||
|
|
a3c43dc5ea | ||
|
|
871d8ebc66 | ||
|
|
5c27abe5f9 | ||
|
|
a47124f34f | ||
|
|
4b57ad504d | ||
|
|
add76792b9 | ||
|
|
626db96425 | ||
|
|
e2a7438807 | ||
|
|
fb105a717b | ||
|
|
d805fd8dbe |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "pack/vendor/start/vim-wakatime"]
|
||||
path = pack/vendor/start/vim-wakatime
|
||||
url = https://github.com/wakatime/vim-wakatime.git
|
||||
@@ -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)
|
||||
|
||||
55
init.lua
55
init.lua
@@ -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]]
|
||||
|
||||
@@ -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"
|
||||
})
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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,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
8
nvim-pack-lock.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"plugins": {
|
||||
"vim-wakatime": {
|
||||
"rev": "d7973b1",
|
||||
"src": "https://github.com/wakatime/vim-wakatime"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pack/vendor/start/vim-wakatime
vendored
1
pack/vendor/start/vim-wakatime
vendored
Submodule pack/vendor/start/vim-wakatime deleted from cf51327a9e
Reference in New Issue
Block a user