Update settings

This commit is contained in:
Saeed Afzal
2024-04-12 23:54:07 +01:00
parent 088c1e113d
commit 100ea186dd
20 changed files with 128 additions and 814 deletions

View File

@@ -1,37 +1,22 @@
-- Import core configuration
require("core")
-- Core configuration
require "core"
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Import plugins
-- Init plugins
require("lazy").setup("plugins")
-- Set vim.notify
vim.notify = require("notify")
-- Terminal mappings
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
local set = vim.keymap.set
set("t", "<esc>", [[<C-\><C-n>]], opts)
set("t", "jk", [[<C-\><C-n>]], opts)
set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
set("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
end
vim.cmd("autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()")
-- Theme
vim.cmd [[colorscheme tokyonight]]

View File

@@ -1,40 +1,5 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" },
"buffer_manager.nvim": { "branch": "main", "commit": "9cd0e34522d96d08817828f1e9fd3379f27efb73" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"flutter-tools.nvim": { "branch": "main", "commit": "271eec9edb0f1a2bf30ad449ec3b4eeb2c88af05" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"go.nvim": { "branch": "master", "commit": "b111775c494105045803f65c66029012ffeb4d9a" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"image.nvim": { "branch": "master", "commit": "77df64af37ff68a1f593aa4f79b42b1388479239" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lsp_signature.nvim": { "branch": "master", "commit": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "e578fe7a5832421b0d2c5b3c0a7a1e40e0f6a47a" },
"neogit": { "branch": "master", "commit": "536b4cfc009fc6d8bd771f010f04d48204533fae" },
"neorg": { "branch": "main", "commit": "7cf5382821f661aee958bcaf7bc4111c11e6863a" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
"nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lspconfig": { "branch": "master", "commit": "1bc83418927003552505ec66fa5d6cffae953f6a" },
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
"nvim-treesitter": { "branch": "master", "commit": "b444afa1dacd3d031c0ffe4763671d89afda5ddb" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"toggleterm.nvim": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" },
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
"vim-wakatime": { "branch": "master", "commit": "a4c66faea1eca47dce7c7c3586332f75cfbe9edf" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
"tokyonight.nvim": { "branch": "main", "commit": "9bf9ec53d5e87b025e2404069b71e7ebdc3a13e5" },
"vim-wakatime": { "branch": "master", "commit": "5d11a253dd1ecabd4612a885175216032d814300" }
}

22
lua/core/autocmds.lua Normal file
View File

@@ -0,0 +1,22 @@
local api = vim.api
-- Set cargo for .rs files
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.rs" },
command = "compiler cargo"
})
-- Indentation for .go files
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.go" },
callback = function()
vim.cmd [[Tabs 4]]
vim.cmd [[set nolist]]
end
})
-- Set tsc for .ts files
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.ts", "*.tsx" },
command = "compiler tsc"
})

23
lua/core/commands.lua Normal file
View File

@@ -0,0 +1,23 @@
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 = "?" })

View File

@@ -1,50 +1,4 @@
local opt, g, api =
vim.opt,
vim.g,
vim.api
-- Disable netrw
-- g.loaded_netrw = 1
-- g.loaded_netrwPlugin = 1
-- Settings
g.mapleader = " "
g.maplocalleader = ","
opt.backup = false
opt.swapfile = false
opt.termguicolors = true
opt.number = true
opt.relativenumber = true
opt.mouse = "a"
opt.hidden = true
opt.scrolloff = 8
-- Indentation
opt.expandtab = true
opt.smartindent = true
opt.shiftwidth = 4
opt.tabstop = 4
-- Commands
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 = "?" })
require "core.settings"
require "core.commands"
require "core.autocmds"
require "core.keys"

23
lua/core/keys.lua Normal file
View File

@@ -0,0 +1,23 @@
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>")

40
lua/core/settings.lua Normal file
View File

@@ -0,0 +1,40 @@
local g, opt = vim.g, vim.opt
-- Settings
g.mapleader = " "
g.maplocalleader = ","
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 = "filename [+=-] - NVIM"
opt.wrap = false
opt.clipboard = "unnamedplus"
opt.splitbelow = true
opt.splitright = true
opt.showmode = false
opt.grepprg = "rg --vimgrep --smart-case"
opt.path = ".,**"
-- Netrw
g.netrw_banner = 0
-- Indentation
opt.expandtab = true
opt.smartindent = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.list = true
opt.listchars = "lead:·"
-- Search
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.hlsearch = true
vim.opt.incsearch = true

View File

@@ -1,33 +0,0 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
},
config = function()
local cmp = require("cmp")
cmp.setup {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" }
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item()
})
}
end
}

View File

@@ -1,14 +0,0 @@
return {
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter"
},
config = function()
require("go").setup()
end,
event = "CmdlineEnter",
ft = { "go", "gomod" },
build = ":lua require('go.install').update_all_sync()"
}

View File

@@ -1,61 +1,13 @@
return {
"LunarVim/bigfile.nvim",
"wakatime/vim-wakatime",
"j-morano/buffer_manager.nvim",
"rcarriga/nvim-notify",
-- NOTE: Plugins
{
"lukas-reineke/indent-blankline.nvim",
event = "BufEnter",
main = "ibl",
config = true
},
{
"lewis6991/gitsigns.nvim",
event = "BufEnter",
config = true
},
{
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim",
"sindrets/diffview.nvim",
"nvim-telescope/telescope.nvim"
},
config = true
},
-- NOTE: LSP
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
},
{
"ray-x/lsp_signature.nvim",
dependencies = "neovim/nvim-lspconfig",
config = true
},
{
"numToStr/Comment.nvim",
"folke/tokyonight.nvim",
lazy = false,
config = true
},
-- NOTE: Flutter
{
"akinsho/flutter-tools.nvim",
lazy = false,
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim"
},
config = true
priority = 1000,
opts = {
style = "night",
transparent = true
}
}
}

View File

@@ -1,24 +0,0 @@
return {
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp"
},
config = function()
local lspconfig = require("lspconfig")
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
local defaultSetup = function(server)
lspconfig[server].setup {
capabilities = lsp_capabilities
}
end
require("mason").setup()
require("mason-lspconfig").setup {
ensure_installed = {},
handlers = { defaultSetup }
}
end
}

View File

@@ -1,227 +0,0 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require("lualine")
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = "#202328",
fg = "#bbc2cf",
yellow = "#ECBE7B",
cyan = "#008080",
darkblue = "#081633",
green = "#98be65",
orange = "#FF8800",
violet = "#a9a1e1",
magenta = "#c678dd",
blue = "#51afef",
red = "#ec5f67",
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x at right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return ""
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don"t need space before this
}
ins_left {
-- mode component
function()
return ""
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[""] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
-- filesize component
"filesize",
cond = conditions.buffer_not_empty,
}
ins_left {
"filename",
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = "bold" },
}
ins_left { "location" }
ins_left { "progress", color = { fg = colors.fg, gui = "bold" } }
ins_left {
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = { error = "", warn = "", info = "" },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it"s any number greater then 2
ins_left {
function()
return "%="
end,
}
ins_left {
-- Lsp server name .
function()
local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = " LSP:",
color = { fg = "#ffffff", gui = "bold" },
}
-- Add components to right sections
ins_right {
"o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I"m not sure why it"s upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = "bold" },
}
ins_right {
"fileformat",
fmt = string.upper,
icons_enabled = true, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = "bold" },
}
ins_right {
"branch",
icon = "",
color = { fg = colors.violet, gui = "bold" },
}
ins_right {
"diff",
-- Is it me or the symbol for modified us really weird
symbols = { added = "", modified = "󰝤 ", removed = "" },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return ""
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)
end
}

View File

@@ -1,20 +0,0 @@
return {
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = "nvim-lua/plenary.nvim",
opts = {
load = {
["core.defaults"] = {},
["core.concealer"] = {},
["core.dirman"] = {
config = {
workspaces = {
notes = "~/Sync/Neorg",
work = "~/Sync/Work"
},
default_workspace = "notes"
}
}
}
}
}

View File

@@ -1,56 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
"3rd/image.nvim"
},
cmd = "Neotree",
opts = {
filesystem = {
filtered_items = {
hide_dotfiles = false
}
},
window = {
position = "current",
mappings = {
["Y"] = function(state)
local node = state.tree:get_node()
local filepath = node:get_id()
local filename = node.name
local modify = vim.fn.fnamemodify
local results = {
filepath,
modify(filepath, ':.'),
modify(filepath, ':~'),
filename,
modify(filename, ':r'),
modify(filename, ':e'),
}
vim.ui.select({
'1. Absolute path: ' .. results[1],
'2. Path relative to CWD: ' .. results[2],
'3. Path relative to HOME: ' .. results[3],
'4. Filename: ' .. results[4],
'5. Filename without extension: ' .. results[5],
'6. Extension of the filename: ' .. results[6],
}, { prompt = 'Choose to copy to clipboard:' }, function(choice)
if choice then
local i = tonumber(choice:sub(1, 1))
local result = results[i]
vim.fn.setreg('"+', result)
vim.notify("Copied: " .. result)
end
end)
end
}
}
}
}

View File

@@ -1,29 +0,0 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make"
}
},
config = function()
local telescope = require("telescope")
telescope.setup {
defaults = {
layout_config = {
vertical = { width = 0.75 }
}
},
pickers = {
fd = { layout_strategy = "vertical" },
live_grep = { layout_strategy = "vertical" },
current_buffer_fuzzy_find = { layout_strategy = "vertical" }
}
}
telescope.load_extension("fzf")
end
}

View File

@@ -1,11 +0,0 @@
return {
"akinsho/toggleterm.nvim",
version = "*",
opts = {
open_mapping = [[<c-t>]],
direction = "float",
float_opts = {
border = "curved"
}
}
}

View File

@@ -1,8 +0,0 @@
return {
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
config = function()
vim.cmd[[colorscheme tokyonight-night]]
end
}

View File

@@ -1,31 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
{ "windwp/nvim-ts-autotag", config = true }
},
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup {
ensure_installed = { "lua" },
highlight = { enable = true },
indent = {
enable = true,
disable = { "dart" }
},
autotag = { enable = true }
}
end,
opts = {
ensure_installed = { "lua" },
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
autotag = { enable = true }
}
}

View File

@@ -1,80 +0,0 @@
local function config()
local wk = require("which-key")
wk.register({
["<leader>"] = {
-- Finders
f = {
name = "Finders",
f = { "<cmd>Telescope fd<CR>", "Find files" },
w = { "<cmd>Telescope live_grep<CR>", "Text grep" },
s = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
t = { "<cmd>TodoTelescope<CR>", "Todos" },
b = { "<cmd>Telescope buffers<CR>", "Buffers" },
["."] = { "<cmd>Telescope keymaps<CR>", "Keymaps" }
},
-- Git
g = {
name = "Git",
b = { "<cmd>Gitsigns blame_line<CR>", "Blame line" },
d = { "<cmd>Gitsigns diffthis<CR>", "Diff" },
D = { "<cmd>DiffviewOpen<CR>", "Diff view & merge tool" },
C = { "<cmd>DiffviewClose<CR>", "Close diffview & merge tool" }
},
-- LSP
l = {
name = "LSP",
f = { "<cmd>lua vim.lsp.buf.format { async = true }<CR>", "Format" },
a = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Code Action" },
r = { "<cmd>lua vim.lsp.buf.rename()<CR>", "Rename" }
},
-- Buffers
b = { "<cmd>lua require('buffer_manager.ui').toggle_quick_menu()<CR>", "Buffer Manager" },
-- Misc
h = { "<cmd>noh<CR>", "No highlight" },
s = { "<cmd>SymbolsOutline<CR>", "Symbols outline" },
-- Terminal
t = {
t = { "<cmd>ToggleTerm size=40 direction=horizontal<CR>", "Horizontal Terminal" }
},
T = { "<cmd>TroubleToggle<CR>", "Toggle trouble" }
},
g = {
d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "definition" },
t = { "<cmd>lua vim.lsp.buf.type_definition()<CR>", "type definition" }
},
-- Find in file
["<C-f>"] = { "<cmd>Telescope current_buffer_fuzzy_find<CR>", "Find in file" },
-- Neotree
["<C-n>"] = { "<cmd>Neotree reveal_force_cwd<CR>", "Neotree" },
-- Misc
K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Hover" }
})
end
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
local o = vim.o
o.timeout = true
o.timeoutlen = 300
end,
config = config,
opts = {
ignore_missing = true,
key_labels = {
["<space>"] = "SPC"
}
}
}

117
lunar.lua
View File

@@ -1,117 +0,0 @@
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
local opt = vim.opt
local api = vim.api
-- Indentation
opt.smartindent = true
opt.expandtab = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.scrolloff = 8
-- Plugins
lvim.plugins = {
{
"folke/todo-comments.nvim",
event = "BufRead",
dependencies = "nvim-lua/plenary.nvim",
config = true
},
{
"akinsho/flutter-tools.nvim",
lazy = false,
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim"
},
config = true
},
{
"nmac427/guess-indent.nvim",
lazy = false,
config = true,
},
{
"NvChad/nvim-colorizer.lua",
event = "BufEnter",
opts = {
filetypes = {
"*",
"!markdown",
},
user_default_options = {
RRGGBBAA = true,
AARRGGBB = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
sass = { enable = true }
}
}
},
{
"nvim-pack/nvim-spectre",
dependencies = "nvim-lua/plenary.nvim"
},
{
"ellisonleao/glow.nvim",
cmd = "Glow",
config = true
},
{
"f-person/git-blame.nvim",
cmd = "GitBlameToggle"
},
{
"sindrets/diffview.nvim",
dependencies = "nvim-lua/plenary.nvim",
cmd = "DiffviewOpen",
config = true
},
{
"ray-x/lsp_signature.nvim",
dependencies = "neovim/nvim-lspconfig",
config = true
},
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = true
}
}
-- Mappings
lvim.keys.normal_mode["<TAB>"] = "<cmd>BufferLineCycleNext<CR>"
lvim.keys.normal_mode["<S-TAB>"] = "<cmd>BufferLineCyclePrev<CR>"
lvim.keys.normal_mode["<C-f>"] = "<cmd>Telescope current_buffer_fuzzy_find<CR>"
lvim.builtin.terminal.open_mapping = "<C-t>"
-- Commands
local function indent(n, expand)
local size = 4
if n ~= "" then size = n end
-- Number conversion
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 = "?" })