Skip to content

Commit

Permalink
πŸ“›
Browse files Browse the repository at this point in the history
  • Loading branch information
mikker committed Feb 26, 2023
1 parent f6e86ce commit bc0555b
Show file tree
Hide file tree
Showing 18 changed files with 585 additions and 460 deletions.
3 changes: 0 additions & 3 deletions nvim/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ mkdir -p ~/.config
[ -d ~/.config/nvim ] && mv ~/.config/nvim ~/.config/nvim.bak
ln -sf ~/.dotfiles/nvim ~/.config/nvim

git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim

164 changes: 29 additions & 135 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,137 +1,31 @@
require("packer").startup(function(use)
use "wbthomason/packer.nvim"

-- TPOPE IS THE DEFAULT
use "tpope/vim-abolish"
use "tpope/vim-bundler"
use "tpope/vim-commentary"
use "tpope/vim-endwise"
use "tpope/vim-eunuch"
use "tpope/vim-fugitive"
use "tpope/vim-git"
use "tpope/vim-projectionist"
use "tpope/vim-rails"
use "tpope/vim-rake"
use "tpope/vim-repeat"
use "tpope/vim-rhubarb"
use "tpope/vim-speeddating"
use "tpope/vim-surround"
use "tpope/vim-unimpaired"
use "tpope/vim-vinegar"

-- FEATURES
use "mikker/vim-rerunner"
use "AndrewRadev/splitjoin.vim"
use "janko-m/vim-test"
use "christoomey/vim-tmux-runner"
use "jreybert/vimagit"
use "junegunn/vim-easy-align"
use "junegunn/vim-slash"
use "mattn/emmet-vim"
use "mbbill/undotree"
use "mikker/vim-togglebg"
use "whiteinge/diffconflicts"
use "wincent/ferret"
use "machakann/vim-highlightedyank"
use { "prettier/vim-prettier", run = "yarn install --frozen-lockfile --production" }
use { "nvim-telescope/telescope.nvim", requires = { { "nvim-lua/plenary.nvim" } } }
use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }
use { "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }
use 'NvChad/nvim-colorizer.lua'
use 'windwp/nvim-spectre'

-- FILE TYPES
use "etdev/vim-hexcolor"
use "jparise/vim-graphql"
use "maxmellon/vim-jsx-pretty"
use "slim-template/vim-slim"
use "tomlion/vim-solidity"
use "vim-ruby/vim-ruby"
use "vimwiki/vimwiki"
use "yuezk/vim-js"
use "zackhsi/sorbet.vim"
use "pantharshit00/vim-prisma"
use "Glench/Vim-Jinja2-Syntax"

-- WRITING
use "junegunn/goyo.vim"
use "reedes/vim-pencil"
use "junegunn/limelight.vim"

-- LOOKS
use { "mcchrish/zenbones.nvim", requires = "rktjmp/lush.nvim" }
use {
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true }
}
use "andreypopp/vim-colors-plain"

-- LSP
use {
"VonHeikemen/lsp-zero.nvim",
requires = {
-- LSP Support
{ "neovim/nvim-lspconfig" },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },

-- Autocompletion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },

-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
}
}
use {
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
end)

-- Add dotfiles to runtimepath
vim.opt.runtimepath = "~/.config/nvim,$VIMRUNTIME"

require "basics"
require "mappings"
require "commands"
require "plugin_config"
require "gui"

-- Looks
vim.cmd("colorscheme zenwritten")

-- Automatic dark mode on boot
-- <F5> to toggle background
if vim.fn.executable("is-this-dark-mode") then
vim.fn.system("is-this-dark-mode")

if vim.v.shell_error == 0 then
vim.opt.background = "dark"
else
vim.opt.background = "light"
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end

-- Initialize LSP
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.configure('sorbet', {
["sorbet.configFilePatterns"] = { "**/sorbet/config" },
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

require("commands")

require("lazy").setup({
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
opts = {
colorscheme = "zenwritten",
defaults = {
options = false,
keymaps = false,
},
},
},
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "plugins" },
}, {
install = { colorscheme = { "zenwritten" } },
dev = {
path = "~/dev",
patterns = { "mikker" },
fallback = true,
},
})
lsp.nvim_workspace()
lsp.setup()

require("luasnip.loaders.from_snipmate").lazy_load({ paths = "./snippets" })
67 changes: 67 additions & 0 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"LazyVim": { "branch": "main", "commit": "befa6c67a4387b0db4f8421d463f5d03f91dc829" },
"LuaSnip": { "branch": "master", "commit": "f7c845749aba6096f041a73a26ba64f3817bab99" },
"alpha-nvim": { "branch": "main", "commit": "b6c7b5d9d6d2633722255abf2be3ecb8733e8d2d" },
"catppuccin": { "branch": "main", "commit": "4175759297350557315987d479fb687a9f0b781f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"diffconflicts": { "branch": "master", "commit": "05e8d2e935a235b8f8e6d308a46a5f028ea5bf97" },
"dressing.nvim": { "branch": "master", "commit": "5f44f829481640be0f96759c965ae22a3bcaf7ce" },
"emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" },
"friendly-snippets": { "branch": "main", "commit": "6fa50a94ba5378bb73013a6e163376d8e69bd8a5" },
"gitsigns.nvim": { "branch": "main", "commit": "f388995990aba04cfdc7c3ab870c33e280601109" },
"lazy.nvim": { "branch": "main", "commit": "8077428e63feb0f3bf795d53b23ba1695b28ab0e" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"lush.nvim": { "branch": "main", "commit": "b1e8eb1da3fee95ef31515a73c9eff9bf251088d" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3f9c0ea157e88b08e2d11ec65002eeb6e421f0da" },
"mason.nvim": { "branch": "main", "commit": "01dfdfd36be77cb1195b60d580315bf4e2d8e62c" },
"mini.ai": { "branch": "main", "commit": "ce822c6e6fe3aaf7cb29874e669b2d96febc97e5" },
"mini.bufremove": { "branch": "main", "commit": "8464390c932556dbb298ccf8a7587d6ef765e94f" },
"mini.comment": { "branch": "main", "commit": "5e8c7f75c48d958ef84ed75772b0263284c8621d" },
"mini.pairs": { "branch": "main", "commit": "61811b4f3e29dc4926f8418dd64aebe0013914c2" },
"mini.surround": { "branch": "main", "commit": "21babf8f50afbb403ab1b9c2053806ccc28e40b6" },
"neoconf.nvim": { "branch": "main", "commit": "4bb77407903935551756fec6278c37121a36139d" },
"neodev.nvim": { "branch": "main", "commit": "8c28ddd85b22a4503f902e34238dfe7681533856" },
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
"null-ls.nvim": { "branch": "main", "commit": "689cdd78f70af20a37b5309ebc287ac645ae4f76" },
"nvim-cmp": { "branch": "main", "commit": "7a3b1e76f74934b12fda82158237c6ad8bfd3d40" },
"nvim-colorizer.lua": { "branch": "master", "commit": "afbcc17d1279180db28a58044dca39b6e909c6b9" },
"nvim-lspconfig": { "branch": "master", "commit": "62856b20751b748841b0f3ec5a10b1e2f6a6dbc9" },
"nvim-notify": { "branch": "master", "commit": "9c987081390753b625e2d94e749e80e9b4a3e082" },
"nvim-spectre": { "branch": "master", "commit": "b71b64afe9fedbfdd25a8abec897ff4af3bd553a" },
"nvim-treesitter": { "branch": "master", "commit": "8d2f9903f11542c3363353a65a8e08adfcca9d29" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "4b30081d2736e09f90c890a8a7adfe4df36f5b36" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-web-devicons": { "branch": "master", "commit": "4709a504d2cd2680fb511675e64ef2790d491d36" },
"persistence.nvim": { "branch": "main", "commit": "d8a3eda0e19b4d5f3180fc832c25baab1709f2a1" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"splitjoin.vim": { "branch": "main", "commit": "6304a77e6cefc2f861c2dd4a6b633869a2de8228" },
"telescope.nvim": { "branch": "master", "commit": "a486ac3e8fb2198f3636da1927ed57a28836fbd8" },
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
"tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" },
"trouble.nvim": { "branch": "main", "commit": "3b754285635a66a93aeb15fa71a23417d8997217" },
"typescript.nvim": { "branch": "main", "commit": "f66d4472606cb24615dfb7dbc6557e779d177624" },
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
"vim-abolish": { "branch": "master", "commit": "880a562ff9176773897930b5a26a496f68e5a985" },
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
"vim-eunuch": { "branch": "master", "commit": "291ef1f8c8996ca7715df1032a35a27b12d7b5cf" },
"vim-fugitive": { "branch": "master", "commit": "62f42f013d866139fa23068ac2651b3f7e05a56f" },
"vim-projectionist": { "branch": "master", "commit": "3a088946adb24a2fac7b47f3dea97a3b99f52ddd" },
"vim-rails": { "branch": "master", "commit": "959e94b76e6ebdf984acef61649ba7d0f62bd425" },
"vim-rake": { "branch": "master", "commit": "e08049f812d241bbc72127aeafa8afa2f6720886" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-rhubarb": { "branch": "master", "commit": "cad60fe382f3f501bbb28e113dfe8c0de6e77c75" },
"vim-slash": { "branch": "master", "commit": "31aee09b7ea8893a18fa34f65e63e364fc998444" },
"vim-speeddating": { "branch": "master", "commit": "5a36fd29df63ea3f65562bd2bb837be48a5ec90b" },
"vim-startuptime": { "branch": "master", "commit": "6580cf539c33a212f4f5542068a3b4dd2b3ad834" },
"vim-test": { "branch": "master", "commit": "c63b94c1e5089807f4532e05f087351ddb5a207c" },
"vim-tmux-runner": { "branch": "master", "commit": "dc5224acd6e03f0544f10625b3e42aba37e66827" },
"vim-togglebg": { "branch": "main", "commit": "455c2aa2885c44d9d502529e6fa63164acd647e6" },
"vim-vinegar": { "branch": "master", "commit": "bb1bcddf43cfebe05eb565a84ab069b357d0b3d6" },
"vimagit": { "branch": "master", "commit": "308650ddc1e9a94e49fae0ea04bbc1c45f23d4c4" },
"vimwiki": { "branch": "dev", "commit": "fea8bee382b2051b0137fd2cacf0862823ee69b3" },
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" },
"zenbones.nvim": { "branch": "main", "commit": "910b8c240c6aaf5263db038db81c538602c766c3" }
}
54 changes: 0 additions & 54 deletions nvim/lua/basics.lua

This file was deleted.

42 changes: 17 additions & 25 deletions nvim/lua/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,21 @@ fun! <SID>StripTrailingWhitespaces()
endfun
noremap <leader>S :call <SID>StripTrailingWhitespaces()<cr>
augroup vimrcEx
autocmd!
" Auto-open quickfix window after grep cmds
autocmd QuickFixCmdPost *grep* cwindow
" magic markers: enable using `H/S/J/C to jump back to
" last HTML, stylesheet, JS or app code buffer
au BufLeave *.{erb,html,haml,slim,eex} exe "normal! mH"
au BufLeave *.{css,scss} exe "normal! mS"
au BufLeave *.{js,jsx,ts,tsx} exe "normal! mJ"
au BufLeave *.{rb,ex,exs} exe "normal! mC"
au BufLeave *.yml exe "normal! mY"
" Resize windows when the terminal window size changes (from https://vimrcfu.com/snippet/186)
autocmd VimResized * wincmd =
" Don't auto insert a comment when using O/o for a newline
autocmd VimEnter,BufRead,FileType * set formatoptions-=o
" Automatically reload files when changed
autocmd FocusGained, BufEnter * :checktime
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
\ if mode() == 'n' && getcmdwintype() == '' | checktime | endif
augroup END
" augroup vimrcEx
" autocmd!
"
" " Auto-open quickfix window after grep cmds
" autocmd QuickFixCmdPost *grep* cwindow
"
" " Resize windows when the terminal window size changes (from https://vimrcfu.com/snippet/186)
" autocmd VimResized * wincmd =
"
" " Don't auto insert a comment when using O/o for a newline
" autocmd VimEnter,BufRead,FileType * set formatoptions-=o
"
" " Automatically reload files when changed
" autocmd FocusGained, BufEnter * :checktime
" autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
" \ if mode() == 'n' && getcmdwintype() == '' | checktime | endif
" augroup END
]])
30 changes: 30 additions & 0 deletions nvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local function augroup(name)
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
end

local magic_markers = augroup("magic_markers")
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "*.{erb,html,haml,slim,eex}",
group = magic_markers,
command = 'exe "normal! mH"',
})
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "*.css",
group = magic_markers,
command = 'exe "normal! mS"',
})
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "*.{js,jsx,ts,tsx}",
group = magic_markers,
command = 'exe "normal! mJ"',
})
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "*.{rb,ex,exs}",
group = magic_markers,
command = 'exe "normal! mC"',
})
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "*.yml",
group = magic_markers,
command = 'exe "normal! mY"',
})
Loading

0 comments on commit bc0555b

Please sign in to comment.