Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ This repo is aim to unify all my dotfiles
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" &&\
curl -L http://install.ohmyz.sh | sh &&\
git clone git@github.com:gregory/dotfiles.git ~/dotfiles &&\
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim &&\
cd ~/dotfiles &&\ rake install
brew install ctags-exuberant
```

Then Enter vim and do :BundleInstall
## Neovim plugins

Neovim uses [lazy.nvim](https://github.com/folke/lazy.nvim) and bootstraps it automatically.

1. Launch Neovim (`nvim`).
2. Run `:Lazy sync` to clone and build all plugins (this replaces the old `:BundleInstall`).
3. Restart Neovim once the sync completes so all remote plugins are registered.

The Lua configuration re-sources your `~/.vimrc` so all of the existing
Vimscript options, keybindings, and autocommands remain active in Neovim. If
`~/.vimrc` is not available, it falls back to the tracked snapshot at
`nvim/legacy.vim`.


[![Analytics](https://ga-beacon.appspot.com/UA-34823890-2/dotfiles/readme?pixel)](https://github.com/gregory/dotfiles)
69 changes: 69 additions & 0 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- Neovim 0.11.2 configuration migrated from legacy Vim setup
-- Leader keys must be defined before any plugin loads or mappings run.
vim.g.mapleader = ","
vim.g.maplocalleader = ","

-- Bootstrap lazy.nvim if it is not already installed.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

-- Preserve legacy plugin behaviour.
vim.g.polyglot_disabled = { "javascript" }
vim.g.coc_global_extensions = {
"coc-css",
"coc-html",
"coc-json",
"coc-yaml",
"coc-eslint",
"coc-prettier",
}

require("plugins").setup()

-- Tell the legacy Vimscript that plugins are managed by lazy.nvim so it can
-- skip running vim-plug directives that would otherwise break and block the
-- rest of the configuration from loading.
vim.g.lazy_port_skip_plug = 1

-- Load the legacy Vimscript configuration directly from the user's ~/.vimrc so
-- new keymaps and tweaks automatically flow into Neovim. Fall back to the
-- bundled legacy.vim snapshot if ~/.vimrc cannot be found.
local config_dir = vim.fn.stdpath("config")
local init_source = debug.getinfo(1, "S").source
if init_source:sub(1, 1) == "@" then
config_dir = vim.fn.fnamemodify(init_source:sub(2), ":h")
end

local legacy_targets = {
vim.fn.expand("~/.vimrc"),
config_dir .. "/legacy.vim",
}

local sourced_legacy = false
for _, target in ipairs(legacy_targets) do
if vim.fn.filereadable(target) == 1 then
vim.cmd.source(vim.fn.fnameescape(target))
sourced_legacy = true
break
end
end

if not sourced_legacy then
vim.notify(
string.format(
"Legacy configuration file not found. Looked for: %s",
table.concat(legacy_targets, ", ")
),
vim.log.levels.WARN
)
end
Loading