modified: init.lua

modified:   lua/config.lua
	new file:   lua/functions.lua
	modified:   lua/keybinds.lua
	modified:   lua/plugins.lua
This commit is contained in:
2021-11-26 04:40:34 -06:00
parent 8500f6e932
commit 729730177f
5 changed files with 131 additions and 13 deletions
+4 -2
View File
@@ -12,6 +12,8 @@ require "lsp"
--vim.g.onedark_terminal_italics = true
--vim.opt.background = "light"
--vim.opt.background = "dark"
--vim.cmd("colorscheme onedark")
vim.cmd("colorscheme onedark")
--vim.cmd("colorscheme github_dark")
--vim.cmd("colorscheme ghdark")
--vim.cmd("colorscheme github_dark_default")
--vim.cmd("colorscheme tokyonight")
+41 -8
View File
@@ -1,5 +1,7 @@
-- env file highlighting
vim.cmd [[au BufRead,BufNewFile .env.* set filetype=sh]]
-- Dockerfile file highlighting
vim.cmd [[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]]
local opt = vim.opt -- to set options
local fn = vim.fn
@@ -44,6 +46,12 @@ opt.titlestring = [[NVIM: [%{fnamemodify(getcwd(), ':t')}] %t]]
opt.cursorline = true
opt.cursorcolumn = true
------------------
-- ONEDARK.NVIM --
------------------
g.onedark_toggle_style_keymap = "<nop>"
--g.onedark_style = "cool"
----------------
-- BCLOSE.VIM --
----------------
@@ -66,12 +74,23 @@ require("nvim-treesitter.configs").setup {
}
}
-----------------------
-- GITHUB NVIM THEME --
-----------------------
--require("github-theme").setup(
-- {
-- theme_style = "dark_default",
-- hide_inactive_statusline = false
-- }
--)
g.github_hide_inactive_statusline = false
-------------
-- LUALINE --
-------------
require("lualine").setup {
options = {theme = "github", icons_enabled = true},
options = {theme = "onedark", icons_enabled = true},
sections = {
lualine_a = {"mode"},
lualine_b = {
@@ -107,7 +126,7 @@ require("lualine").setup {
"buffers",
show_filename_only = false, -- shows shortened relative path when false
show_modified_status = true, -- shows indicator then bufder is modified
max_length = vim.o.columns * 1, -- maximum width of buffers component
max_length = vim.o.columns * 6 / 7, -- maximum width of buffers component
filetype_names = {
TelescopePrompt = "Telescope",
dashboard = "Dashboard",
@@ -132,18 +151,32 @@ require("lualine").setup {
cond = function()
return fn.tabpagenr("$") > 1
end
},
{
[[harpoon_status()]],
cond = function()
return require("harpoon.mark").get_length() > 0
end
}
}
},
extensions = {}
}
-----------------------
-- GITHUB NVIM THEME --
-----------------------
require("github-theme").setup(
-------------
-- HARPOON --
-------------
--Here is the set of global settings and their default values.
require("harpoon").setup(
{
theme_style = "dark_default",
hide_inactive_statusline = false
global_settings = {
save_on_toggle = false,
save_on_change = true,
enter_on_sendcmd = false,
tmux_autoclose_windows = false,
excluded_filetypes = {"harpoon"}
}
}
)
+60
View File
@@ -0,0 +1,60 @@
-- Determines if harpoon_bnext and harpoon_bprevious
-- should switch between buffers or harpoon marks
-- `true` - harpoon
-- `false` - buffers
local function harpoon_tab_switch()
return require("harpoon.mark").get_length() > 1
end
-- Dynamically switches between bnext and harpoon.ui.nav_next
function _G.harpoon_bnext()
if harpoon_tab_switch() then
require("harpoon.ui").nav_next()
print("Harpoon nav_next")
else
vim.api.nvim_command("bnext")
print("bnext")
end
end
-- Dynamically switches between bprevious and harpoon.ui.nav_prev
function _G.harpoon_bprevious()
if harpoon_tab_switch() then
require("harpoon.ui").nav_prev()
print("Harpoon nav_prev")
else
vim.api.nvim_command("bprevious")
print("bprevious")
end
end
-- Runs harpoon.mark.toggle_file and refreshes lualine elements
function _G.harpoon_toggle_file()
require("harpoon.mark").toggle_file()
vim.api.nvim_command("redrawtabline")
vim.api.nvim_command("redrawstatus")
end
function _G.harpoon_clear_all()
require("harpoon.mark").clear_all()
vim.api.nvim_command("redrawtabline")
vim.api.nvim_command("redrawstatus")
end
-- I want my bclose bindings to also remove harpoon marks
function _G.harpoon_rm_file()
require("harpoon.mark").rm_file()
vim.api.nvim_command("Bclose")
end
-- Lualine status element for harpoon
function _G.harpoon_status()
local marked_files = require("harpoon.mark").get_length()
local status_str = "Harpoon: %d file"
if marked_files > 1 then
status_str = status_str .. "s"
end
status_str = (harpoon_tab_switch() and "" or "") .. status_str
return string.format(status_str, marked_files)
end
--[[string.format("Harpoon: %d files", require("harpoon.mark").get_length())]]
+20 -3
View File
@@ -9,13 +9,17 @@ end
vim.g.mapleader = ","
require("functions")
map("v", "<C-C>", '"+y')
map("n", "<Tab>", ":bnext<CR>")
map("n", "<S-Tab>", ":bprevious<CR>")
--map("n", "<Tab>", ":bnext<CR>")
--map("n", "<S-Tab>", ":bprevious<CR>")
map("n", "<Tab>", ":lua harpoon_bnext()<CR>")
map("n", "<S-Tab>", ":lua harpoon_bprevious()<CR>")
map("n", "<esc>", ":noh<cr><esc>", {silent = true}) --After searching, pressing escape stops the highlight
map("n", "<Leader>w", [[:%s/\s\+$//e <CR>]])
map("n", "<Leader>x", ":Bclose <CR>")
--map("n", "<Leader>x", ":Bclose <CR>")
map("n", "<Leader>t", ":tabnew <CR>")
-- Split navigations
@@ -77,3 +81,16 @@ map("n", "<Leader>s", ":Rg <CR>")
---------
--map("n", "<c-k>", ":ALEPreviousWrap <CR>", {silent = true})
--map("n", "<c-j>", ":ALENextWrap <CR>", {silent = true})
-------------
-- HARPOON --
-------------
--map("n", "<Leader>m", [[:lua require("harpoon.mark").add_file() <CR>]])
map("n", "<Leader>x", ":lua harpoon_rm_file()<CR>")
map("n", "<Leader>m", [[:lua harpoon_toggle_file()<CR>]])
map("n", "<Leader>M", [[:lua harpoon_clear_all()<CR>]])
map("n", "<Leader>l", [[:lua require("harpoon.ui").toggle_quick_menu()<CR>]])
--map("n", "<Leader>n", [[:lua require("harpoon.ui").nav_next() <CR>]])
--map("n", "<Leader>N", [[:lua require("harpoon.ui").nav_prev() <CR>]])
+6
View File
@@ -20,13 +20,17 @@ require("packer").startup(
-- VIM THEMING
--use "rafi/awesome-vim-colorschemes" -- vim themes
use "navarasu/onedark.nvim"
use "projekt0n/github-nvim-theme"
use "wojciechkepka/vim-github-dark"
use "folke/tokyonight.nvim"
-- FILE MANAGEMENT
use "junegunn/fzf"
use "junegunn/fzf.vim"
use "rbgrouleff/bclose.vim"
use "francoiscabrol/ranger.vim"
use "tpope/vim-fugitive"
-- AIRLINE
use {
@@ -51,6 +55,8 @@ require("packer").startup(
use "jose-elias-alvarez/nvim-lsp-ts-utils"
use "jose-elias-alvarez/null-ls.nvim"
use "ThePrimeagen/harpoon"
use "L3MON4D3/LuaSnip" -- Snippets plugin
use "hrsh7th/nvim-cmp" -- Autocompletion plugin
use "saadparwaiz1/cmp_luasnip" -- Snippets source for nvim-cmp