initial nvim config

This commit is contained in:
Tyler Starr 2022-12-02 00:08:24 -08:00
parent 03d3e59014
commit 598d2fd742
17 changed files with 292 additions and 4 deletions

View File

@ -2,5 +2,6 @@
"security.workspace.trust.untrustedFiles": "newWindow",
"redhat.telemetry.enabled": true,
"editor.minimap.enabled": false,
"workbench.activityBar.visible": false
"workbench.activityBar.visible": false,
"git.enableSmartCommit": true
}

View File

@ -0,0 +1,4 @@
require('onedark').setup {
style = 'warmer'
}
require('onedark').load()

View File

@ -0,0 +1,10 @@
local nnoremap = require("tstarr.keymap").nnoremap
local silent = { silent = true }
nnoremap("<leader>ha", function() require("harpoon.mark").add_file() end, silent)
nnoremap("<leader>hl", function() require("harpoon.ui").toggle_quick_menu() end, silent)
nnoremap("<leader>1", function() require("harpoon.ui").nav_file(1) end, silent)
nnoremap("<leader>2", function() require("harpoon.ui").nav_file(2) end, silent)
nnoremap("<leader>3", function() require("harpoon.ui").nav_file(3) end, silent)
nnoremap("<leader>4", function() require("harpoon.ui").nav_file(4) end, silent)

View File

@ -0,0 +1,5 @@
local Remap = require("tstarr.keymap")
local nnoremap = Remap.nnoremap
local silent = { silent = true }
nnoremap("<leader>gg", "<cmd>LazyGit<CR>", silent)

View File

@ -0,0 +1,19 @@
local Remap = require("tstarr.keymap")
local nnoremap = Remap.nnoremap
nnoremap("<leader>ff", function ()
require('telescope.builtin').find_files({hidden=true, no_ignore=true})
end)
nnoremap("<leader>fg", function ()
require('telescope.builtin').live_grep()
end)
nnoremap("<leader>fb", function ()
require('telescope.builtin').buffers()
end)
nnoremap("<leader>fh", function ()
require('telescope.builtin').help_tags()
end)
nnoremap("<leader>p", function ()
require('telescope').extensions.project.project()
end)

1
.config/nvim/init.lua Normal file
View File

@ -0,0 +1 @@
require("tstarr")

View File

@ -0,0 +1,4 @@
require("tstarr.set")
require("tstarr.packer")
require("tstarr.remap")
require("tstarr.telescope")

View File

@ -0,0 +1,20 @@
local M = {}
local function bind(op, outer_opts)
outer_opts = outer_opts or {noremap = true}
return function(lhs, rhs, opts)
opts = vim.tbl_extend("force",
outer_opts,
opts or {}
)
vim.keymap.set(op, lhs, rhs, opts)
end
end
M.nmap = bind("n", {noremap = false})
M.nnoremap = bind("n")
M.vnoremap = bind("v")
M.xnoremap = bind("x")
M.inoremap = bind("i")
return M

View File

@ -0,0 +1,21 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Colors
use 'navarasu/onedark.nvim'
-- IDE
use('nvim-lua/plenary.nvim')
use("nvim-treesitter/nvim-treesitter", {
run = ":TSUpdate"
})
use ('nvim-telescope/telescope.nvim')
use ('nvim-telescope/telescope-project.nvim')
use ('ThePrimeagen/harpoon')
use ('kdheepak/lazygit.nvim')
end)

View File

@ -0,0 +1,3 @@
local nnoremap = require("tstarr.keymap").nnoremap
nnoremap("<leader>pv", "<cmd>Ex<CR>")

View File

@ -0,0 +1,41 @@
vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.errorbells = false
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
-- Give more space for displaying messages.
vim.opt.cmdheight = 1
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
-- delays and poor user experience.
vim.opt.updatetime = 50
-- Don't pass messages to |ins-completion-menu|.
vim.opt.shortmess:append("c")
vim.g.mapleader = " "

View File

@ -0,0 +1 @@
require'telescope'.load_extension('project')

View File

@ -0,0 +1,134 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/tstarr/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/tstarr/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/tstarr/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/tstarr/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tstarr/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
harpoon = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/harpoon",
url = "https://github.com/ThePrimeagen/harpoon"
},
["lazygit.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/lazygit.nvim",
url = "https://github.com/kdheepak/lazygit.nvim"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["onedark.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/onedark.nvim",
url = "https://github.com/navarasu/onedark.nvim"
},
["packer.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope-project.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/telescope-project.nvim",
url = "https://github.com/nvim-telescope/telescope-project.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/tstarr/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
}
}
time([[Defining packer_plugins]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View File

@ -1,2 +1,8 @@
# Ansible Galaxy Roles
roles:
- src: https://github.com/starr-dusT/ansible-role-customize-gnome
collections:
- name: community.general
version: 6.0.1
source: https://galaxy.ansible.com

View File

@ -7,6 +7,7 @@
- btrfs-assistant # GUI to manage btrfs
- btrbk # Backup tool for btrfs subvolumes
- mpv # Movie player playing most video formats and DVDs
- alacritty
state: present
become: true

View File

@ -12,3 +12,16 @@
shell: >
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
creates=/home/{{ user }}/.nvm/nvm.sh
- name: Clone packer for nvim
tags: ["once"]
git:
repo: https://github.com/wbthomason/packer.nvim.git
dest: /home/{{ user }}/.local/share/nvim/site/pack/packer/start/packer.nvim
- name: Enable lazygit copr repo
tags: ["once"]
community.general.copr:
name: atim/lazygit
state: enabled
become: true

View File

@ -6,6 +6,10 @@
- python3-pip # A tool for installing and managing Python3 packages
- nodejs # JavaScript runtime
- npm # Node.js Package Manager
- gcc-c++
- ripgrep
- fd-find
- lazygit
state: present
become: true