Skip to content

Commit

Permalink
Added Poimandres theme and transparency by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-j-ibanez committed Mar 6, 2024
0 parents commit 18b1340
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lazy-lock.json
8 changes: 8 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require("zzz.core")
require("zzz.lazy")

-- If using Windows,
-- Set shell to Powershell
if jit.os == "Windows" then
vim.o.shell = "powershell"
end
2 changes: 2 additions & 0 deletions lua/zzz/core/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require("zzz.core.keymaps")
require("zzz.core.options")
81 changes: 81 additions & 0 deletions lua/zzz/core/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
------------------
-- Key bindings --
------------------
vim.g.mapleader=" "

-- TOGGLE NETRW SIDEBAR
local nw = {}

function ToggleVExplorer()
if nw.expl_buf_num then
local expl_win_num = vim.fn.bufwinnr(nw.expl_buf_num)
local cur_win_num = vim.fn.winnr()

if expl_win_num ~= -1 then
while expl_win_num ~= cur_win_num do
vim.cmd('wincmd w')
cur_win_num = vim.fn.winnr()
end
vim.cmd('close')
end

nw.expl_buf_num = nil
else
vim.cmd('Vexplore')
nw.expl_buf_num = vim.fn.bufnr('%')
end
end

-- Map <leader>e to call ToggleVExplorer
vim.keymap.set('n', '<leader>e', ':lua ToggleVExplorer()<CR>', { silent = true })

-- TOGGLE TERMINAL
local tw = {}

function ToggleTerm()
if tw.expl_buf_num then
local expl_win_num = vim.fn.bufwinnr(tw.expl_buf_num)
local cur_win_num = vim.fn.winnr()

if expl_win_num ~= -1 then
while expl_win_num ~= cur_win_num do
vim.cmd('wincmd w')
cur_win_num = vim.fn.winnr()
end
vim.cmd('close')
end

tw.expl_buf_num = nil
else
vim.cmd('split')
vim.cmd('terminal')
vim.cmd('res 20_')
tw.expl_buf_num = vim.fn.bufnr('%')
end
end

-- Map <leader>t to call ToggleTerm
vim.keymap.set('n', '<leader>t', ':lua ToggleTerm()<CR>', { silent = true })

-- WINDOW NAVIGATION
vim.api.nvim_set_keymap('t', '<A-h>', '<C-\\><C-n><C-w>h', { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<A-j>', '<C-\\><C-n><C-w>j', { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<A-k>', '<C-\\><C-n><C-w>k', { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<A-l>', '<C-\\><C-n><C-w>l', { noremap = true, silent = true })

vim.api.nvim_set_keymap('i', '<A-h>', '<C-\\><C-n><C-w>h', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<A-j>', '<C-\\><C-n><C-w>j', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<A-k>', '<C-\\><C-n><C-w>k', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<A-l>', '<C-\\><C-n><C-w>l', { noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<A-h>', '<C-w>h', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<A-j>', '<C-w>j', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<A-k>', '<C-w>k', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<A-l>', '<C-w>l', { noremap = true, silent = true })

-- TELESCOPE
vim.keymap.set('n', '<leader>fd', ":Telescope lsp_document_symbols<CR>", {silent = true})
vim.keymap.set('n', '<leader>ff', ":Telescope find_files<CR>", { silent = true })
vim.keymap.set('n', '<leader>fg', ":Telescope live_grep<CR>", { silent = true })
vim.keymap.set('n', '<leader>fb', ":Telescope buffers<CR>", { silent = true })
vim.keymap.set('n', '<leader>fh', ":Telescope help_tags<CR>", { silent = true })
24 changes: 24 additions & 0 deletions lua/zzz/core/options.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-----------------
-- Options --
-----------------

-- UI
vim.opt.termguicolors = true
vim.opt.number = true -- Shows line numbers
vim.opt.showmatch = true -- Highlights matching brace pairs
vim.opt.cursorline = true -- Highlight cursor line underneath the cursor horizontally
vim.opt.splitbelow = true -- open new vertical split bottom
vim.opt.splitright = true -- open new horizontal splits right

-- Netrw
vim.g.netrw_banner = 0
vim.g.netrw_winsize = -28
vim.g.netrw_liststyle = 3 -- Set netrw to tree view
vim.g.netrw_browse_split = 4

-- Tab
vim.opt.tabstop = 4 -- Sets number of spaces a tab uses
vim.opt.softtabstop = 4 -- Number of spacesin tab when editing
vim.opt.shiftwidth = 4 -- Insert 4 spaces on a tab
vim.opt.expandtab = true -- Tabs are spaces, mainly because of python

22 changes: 22 additions & 0 deletions lua/zzz/lazy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Lazy setup
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("zzz.plugins")

-- Specify startup theme
-- Default: bamboo
vim.cmd([[colorscheme poimandres]])

-- Enable transparency
vim.cmd("TransparentEnable")
26 changes: 26 additions & 0 deletions lua/zzz/plugins/colorscheme.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
return {
-- Nightfox
{
"EdenEast/nightfox.nvim",
},
-- Poimandres
{
'olivercederborg/poimandres.nvim',
lazy = false,
priority = 1000,
config = function()
require('poimandres').setup { }
end,
},
-- Tokyonight
{
"folke/tokyonight.nvim",
--lazy = false,
--priority = 1000,
},
-- VS Code
{
"askfiy/visual_studio_code",
},
}

7 changes: 7 additions & 0 deletions lua/zzz/plugins/lualine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
"nvim-lualine/lualine.nvim",
lazy = false,
config = function()
require('lualine').setup()
end,
}
54 changes: 54 additions & 0 deletions lua/zzz/plugins/mason.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
return {
"williamboman/mason.nvim",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
},
config = function()
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
})

mason_lspconfig.setup({
-- list of servers to automatically install
ensure_installed = {
"clangd",
"cmake",
"omnisharp",
"golangci_lint_ls",
"html",
"cssls",
"lua_ls",
"jsonls"
},
automatic_installation = true,
})
-- Setup installed servers
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup {}
end,
-- Lua server config
["lua_ls"] = function ()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
}
end,
})
end,
}
53 changes: 53 additions & 0 deletions lua/zzz/plugins/nvim-cmp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"onsails/lspkind.nvim",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
require("luasnip.loaders.from_vscode").lazy_load()

cmp.setup({
completion = {
completeopt = "menu,menuone,preview,noselect",
},
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},

mapping = cmp.mapping.preset.insert({
["<C-j>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-k>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
}),
-- configure lspkind for vs-code like pictograms in completion menu
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
})
end,
}
7 changes: 7 additions & 0 deletions lua/zzz/plugins/startup.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
"startup-nvim/startup.nvim",
requires = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"},
config = function()
require"startup".setup()
end
}
12 changes: 12 additions & 0 deletions lua/zzz/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {
{
"nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {
defaults = {
layout_strategy = "horizontal",
sorting_strategy = "ascending",
},
},
},
}
3 changes: 3 additions & 0 deletions lua/zzz/plugins/transparent.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
"xiyaowong/transparent.nvim",
}
4 changes: 4 additions & 0 deletions lua/zzz/plugins/trouble.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
}

0 comments on commit 18b1340

Please sign in to comment.