Skip to content

Instantly share code, notes, and snippets.

@benfrain
Last active May 24, 2022
Embed
What would you like to do?
Lua init file for NeoVim 0.7+ (Always a WIP!!)
-- You will need to install language servers `npm i -g vscode-langservers-extracted` and `npm install -g typescript typescript-language-server`
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
-- Map leader to space
g.mapleader = ","
-- Bootstrap Paq when needed
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", install_path })
end
-- Plugins
require("paq")({
"f3fora/cmp-spell",
"EdenEast/nightfox.nvim",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-vsnip",
"hrsh7th/nvim-cmp",
"hrsh7th/vim-vsnip",
"jose-elias-alvarez/null-ls.nvim",
"kyazdani42/nvim-tree.lua",
"kyazdani42/nvim-web-devicons",
"lewis6991/gitsigns.nvim",
"nathom/filetype.nvim",
"neovim/nvim-lspconfig",
"norcalli/nvim-colorizer.lua",
"numToStr/Comment.nvim",
"nvim-lua/plenary.nvim",
"nvim-lua/popup.nvim",
"nvim-lualine/lualine.nvim",
"nvim-telescope/telescope-fzy-native.nvim",
"nvim-telescope/telescope.nvim",
"luukvbaal/stabilize.nvim",
"nvim-treesitter/nvim-treesitter",
"octaltree/cmp-look",
"onsails/lspkind-nvim",
"p00f/nvim-ts-rainbow",
"phaazon/hop.nvim",
"rmagatti/auto-session",
"savq/paq-nvim",
-- "tami5/lspsaga.nvim",
"filipdutescu/renamer.nvim",
"tpope/vim-repeat",
"tpope/vim-surround",
"wellle/targets.vim",
"windwp/nvim-autopairs",
"windwp/nvim-ts-autotag",
"winston0410/cmd-parser.nvim",
"winston0410/range-highlight.nvim",
})
-- Do not source the default filetype.vim
vim.g.did_load_filetypes = 1
require("nvim-tree").setup()
require("renamer").setup()
require("stabilize").setup()
require("Comment").setup()
require("nvim-autopairs").setup({})
require("range-highlight").setup({})
require("nvim-treesitter.configs").setup({
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
},
autotag = {
enable = true,
filetypes = {
"html",
"javascript",
"typescript",
"markdown",
},
},
})
-- gitsigns setup
require("gitsigns").setup({
numhl = true,
signcolumn = false,
})
-- Session
local sessionopts = {
log_level = "info",
auto_session_enable_last_session = false,
auto_session_root_dir = vim.fn.stdpath("data") .. "/sessions/",
auto_session_enabled = true,
auto_save_enabled = true,
auto_restore_enabled = true,
auto_session_suppress_dirs = nil,
}
require("auto-session").setup(sessionopts)
-- LSP this is needed for LSP completions in CSS along with the snippets plugin
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
-- Different machine VAR for office
local envMachine = os.getenv("MACHINE")
if envMachine == "work" then
machineCmd =
"/System/Volumes/Data/usr/local/lib/node_modules/vscode-langservers-extracted/bin/vscode-css-language-server"
else
machineCmd = "vscode-css-language-server"
end
-- LSP Server config
require("lspconfig").cssls.setup({
cmd = { machineCmd, "--stdio" },
settings = {
scss = {
lint = {
idSelector = "warning",
zeroUnits = "warning",
duplicateProperties = "warning",
},
completion = {
completePropertyWithSemicolon = true,
triggerPropertyValueCompletion = true,
},
},
},
capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(client)
client.resolved_capabilities.document_formatting = false
end,
})
require("lspconfig").tsserver.setup({
capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(client)
client.resolved_capabilities.document_formatting = false
end,
})
-- LSP Prevents inline buffer annotations
vim.lsp.diagnostic.show_line_diagnostics()
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = false,
signs = true,
underline = true,
update_on_insert = false,
})
local signs = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = nil })
end
-- LSP Saga config & keys https://github.com/glepnir/lspsaga.nvim
-- local saga = require("lspsaga")
-- saga.init_lsp_saga({
-- code_action_icon = " ",
-- definition_preview_icon = " ",
-- diagnostic_header_icon = "  ",
-- error_sign = " ",
-- finder_definition_icon = " ",
-- finder_reference_icon = " ",
-- hint_sign = "⚡",
-- infor_sign = "",
-- warn_sign = "",
-- })
-- Setup treesitter
local ts = require("nvim-treesitter.configs")
ts.setup({ ensure_installed = "maintained", highlight = { enable = true } })
-- cmd([[colorscheme everforest]]) -- Put your favorite colorscheme here
-- Nightfox config
local nightfox = require("nightfox")
nightfox.setup({
fox = "nordfox",
alt_nc = true,
visual = true,
search = true,
styles = {
comments = "italic",
keywords = "bold",
functions = "italic,bold",
},
})
nightfox.load()
-- Good info on overriding colors: https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f
-- Note had to add the SpecialKey to keep highlight on yank working alongside the CursorLine override
vim.api.nvim_exec(
[[
function! MyHighlights() abort
highlight CursorLine guifg=NONE guibg=#353A54
highlight CmpItemAbbr guifg=#9FA4B6
highlight SpecialKey guibg=NONE
highlight CmpItemKind guifg=#8289A0
highlight CmpItemMenu guifg=#8289A0
highlight PmenuSel guibg=#73daca guifg=#111111
highlight Pmenu guibg=#2E3248
highlight GitSignsAddNr guifg=#26A07A
highlight GitSignsDeleteNr guifg=#E87D7D
highlight GitSignsChangeNr guifg=#AD991F
endfunction
augroup MyColors
autocmd!
autocmd ColorScheme * call MyHighlights()
augroup END]],
true
)
-- cmd([[colorscheme nightfox]]) -- Put your favorite colorscheme here
require("options")
-- This little monkey has to go after termguicolors is set or gets upset
require("colorizer").setup()
-- Use spelling for markdown files ‘]s’ to find next, ‘[s’ for previous, 'z=‘ for suggestions when on one.
-- Source: http:--thejakeharding.com/tutorial/2012/06/13/using-spell-check-in-vim.html
-- Also I'm adding different sources for completion here, if you aren't on Mac you might need to install "look"
vim.api.nvim_exec(
[[
augroup markdownSpell
autocmd!
autocmd FileType markdown,md,txt setlocal spell
autocmd BufRead,BufNewFile *.md,*.txt,*.markdown setlocal spell
autocmd FileType markdown,md,txt lua require'cmp'.setup.buffer {
\ sources = {
\ { name = 'spell' },
\ { name = 'buffer' },
\ { name = 'look', keyword_length=3 },
\ },
\ }
augroup END
]],
false
)
local function getWords()
if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then
return tostring(vim.fn.wordcount().words) .. " words"
else
return ""
end
end
-- local lineNum = vim.api.nvim_win_get_cursor(0)[1]
local function getLines()
return tostring(vim.api.nvim_win_get_cursor(0)[1]) .. "/" .. tostring(vim.api.nvim_buf_line_count(0))
end
local function getColumn()
local val = vim.api.nvim_win_get_cursor(0)[2];
-- pad value to 3 units to stop geometry shift
return string.format("%03d", val)
end
local function diff_source()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end
local function blank()
return tostring(" ")
end
-- get colors from Nightfox to use in the words count
local nfColors = require("nightfox.colors").init("nordfox")
-- print(vim.inspect(nfColors))
require("lualine").setup({
options = {
icons_enabled = true,
theme = "nightfox",
component_separators = { " ", " " },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
},
sections = {
lualine_a = { "mode" },
lualine_b = {
{ "branch", icon = "" },
{ "diff", source = diff_source, color_added = "#a7c080", color_modified = "#ffdf1b", color_removed = "#ff6666" },
},
lualine_c = {
{ "diagnostics", sources = { "nvim_lsp" } },
function()
return "%="
end,
"filename",
{
getWords,
color = { fg = nfColors["bg_alt"] or "#333333", bg = nfColors["fg"] or "#eeeeee" },
separator = { left = "", right = "" },
},
},
lualine_x = { "filetype" },
lualine_y = {
{blank,
padding = 0,},
},
lualine_z = {
{getColumn, padding = {left = 1, right = 0} },
{getLines, icon = "", padding = 1},
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {
"quickfix",
},
})
-- Give me some fenced codeblock goodness
g.markdown_fenced_languages = { "html", "javascript", "typescript", "css", "scss", "lua", "vim" }
-- Telescope Global remapping
local action_state = require("telescope.actions.state")
local actions = require("telescope.actions")
require("telescope").setup({
defaults = {
winblend = 20,
sorting_strategy = "descending",
layout_strategy = "flex",
layout_config = {
flex = {
flip_columns = 140,
},
vertical = {
preview_cutoff = 40,
prompt_position = "bottom",
},
horizontal = {
width = 0.9,
height = 0.8,
},
},
mappings = {
i = {
["<esc>"] = actions.close,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
},
},
},
pickers = {
buffers = {
sort_lastused = true,
mappings = {
i = {
["<C-w>"] = "delete_buffer",
},
n = {
["<C-w>"] = "delete_buffer",
},
},
},
-- https://gitter.im/nvim-telescope/community?at=6113b874025d436054c468e6 Fabian David Schmidt
find_files = {
on_input_filter_cb = function(prompt)
local find_colon = string.find(prompt, ":")
if find_colon then
local ret = string.sub(prompt, 1, find_colon - 1)
vim.schedule(function()
local prompt_bufnr = vim.api.nvim_get_current_buf()
local picker = action_state.get_current_picker(prompt_bufnr)
local lnum = tonumber(prompt:sub(find_colon + 1))
if type(lnum) == "number" then
local win = picker.previewer.state.winid
local bufnr = picker.previewer.state.bufnr
local line_count = vim.api.nvim_buf_line_count(bufnr)
vim.api.nvim_win_set_cursor(win, { math.max(1, math.min(lnum, line_count)), 0 })
end
end)
return { prompt = ret }
end
end,
attach_mappings = function()
actions.select_default:enhance({
post = function()
-- if we found something, go to line
local prompt = action_state.get_current_line()
local find_colon = string.find(prompt, ":")
if find_colon then
local lnum = tonumber(prompt:sub(find_colon + 1))
vim.api.nvim_win_set_cursor(0, { lnum, 0 })
end
end,
})
return true
end,
},
},
})
require("telescope").load_extension("fzy_native")
-------------------- COMMANDS ------------------------------
cmd("au TextYankPost * lua vim.highlight.on_yank {on_visual = true}") -- disabled in visual mode
local lspkind = require("lspkind")
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping.confirm({ select = true }),
},
completion = {
completeopt = "menu,menuone,noinsert",
},
sources = {
{ name = "nvim_lsp" },
{ name = "vsnip" },
{ name = "buffer" },
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
maxwidth = 50,
menu = {
buffer = "",
nvim_lsp = "",
spell = "",
look = "",
},
}),
},
experimental = {
ghost_text = true,
native_menu = false,
},
})
-- Setup lspconfig.
-- Here is the formatting config
local null_ls = require("null-ls")
local lSsources = {
null_ls.builtins.formatting.prettier.with({
filetypes = {
"javascript",
"typescript",
"css",
"scss",
"html",
"json",
"yaml",
"markdown",
"graphql",
"md",
"txt",
},
}),
null_ls.builtins.formatting.stylua.with({
args = { "--indent-width", "2", "--indent-type", "Spaces", "-" },
}),
}
require("null-ls").config({
sources = lSsources,
})
require("lspconfig")["null-ls"].setup({})
-- the duration in there is to stop timeouts on massive files
vim.cmd("autocmd BufWritePost * lua vim.lsp.buf.formatting_seq_sync(nil, 7500)")
vim.o.updatetime = 250
vim.cmd([[autocmd CursorHold,CursorHoldI * lua vim.lsp.diagnostic.show_line_diagnostics({focusable=false})]])
require("mappings")
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- Nvim Tree
map("n", "<leader>e", ":NvimTreeToggle<CR>", { silent = true })
map("n", "<leader>u", ":NvimTreeFindFile<CR>", { silent = true })
-- LSP Saga
-- map("n", "<Leader>cf", ":Lspsaga lsp_finder<CR>", { silent = true })
-- map("n", "<leader>ca", ":Lspsaga code_action<CR>", { silent = true })
-- map("v", "<leader>ca", ":<C-U>Lspsaga range_code_action<CR>", { silent = true })
-- map("n", "<leader>ch", ":Lspsaga hover_doc<CR>", { silent = true })
-- map("n", "<leader>ck", '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(-1)<CR>', { silent = true })
-- map("n", "<leader>cj", '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(1)<CR>', { silent = true })
-- map("n", "<leader>cs", ":Lspsaga signature_help<CR>", { silent = true })
-- map("n", "<leader>ci", ":Lspsaga show_line_diagnostics<CR>", { silent = true })
-- map("n", "<leader>cn", ":Lspsaga diagnostic_jump_next<CR>", { silent = true })
-- map("n", "<leader>cp", ":Lspsaga diagnostic_jump_prev<CR>", { silent = true })
-- map("n", "<leader>cr", ":Lspsaga rename<CR>", { silent = true })
-- map("n", "<leader>cd", ":Lspsaga preview_definition<CR>", { silent = true })
-- Open nvimrc file
map("n", "<Leader>v", "<cmd>e $MYVIMRC<CR>")
-- Source nvimrc file
map("n", "<Leader>sv", ":luafile %<CR>")
-- Quick new file
map("n", "<Leader>n", "<cmd>enew<CR>")
-- Easy select all of file
map("n", "<Leader>sa", "ggVG<c-$>")
-- Make visual yanks place the cursor back where started
map("v", "y", "ygv<Esc>")
-- Easier file save
map("n", "<Leader>w", "<cmd>:w<CR>")
map("n", "<Delete>", "<cmd>:w<CR>")
-- Tab to switch buffers in Normal mode
map("n", "<Tab>", ":bnext<CR>")
map("n", "<S-Tab>", ":bprevious<CR>")
-- More molecular undo of text
map("i", ",", ",<c-g>u")
map("i", ".", ".<c-g>u")
map("i", "!", "!<c-g>u")
map("i", "?", "?<c-g>u")
map("i", ";", ";<c-g>u")
map("i", ":", ":<c-g>u")
-- Keep search results centred
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")
map("n", "J", "mzJ`z")
-- Make Y yank to end of the line
map("n", "Y", "y$")
-- Line bubbling
map("n", "<c-j>", "<cmd>m .+1<CR>==", { silent = true })
map("n", "<c-k>", "<cmd>m .-2<CR>==", { silent = true })
map("v", "<c-j>", ":m '>+1<CR>==gv=gv", { silent = true })
map("v", "<c-k>", ":m '<-2<CR>==gv=gv", { silent = true })
--Auto close tags
map("i", ",/", "</<C-X><C-O>")
--After searching, pressing escape stops the highlight
map("n", "<esc>", ":noh<cr><esc>", { silent = true })
-- Easy add date/time
map("n", "<Leader>t", "\"=strftime('%c')<CR>Pa", { silent = true })
-- Telescope
map("n", "<leader>p", '<cmd>lua require("telescope.builtin").find_files()<cr>')
map("n", "<leader>r", '<cmd>lua require("telescope.builtin").registers()<cr>')
map("n", "<leader>g", '<cmd>lua require("telescope.builtin").live_grep()<cr>')
map("n", "<leader>b", '<cmd>lua require("telescope.builtin").buffers()<cr>')
map("n", "<leader>j", '<cmd>lua require("telescope.builtin").help_tags()<cr>')
map("n", "<leader>h", '<cmd>lua require("telescope.builtin").git_bcommits()<cr>')
map("n", "<leader>f", '<cmd>lua require("telescope.builtin").file_browser()<cr>')
map("n", "<leader>s", '<cmd>lua require("telescope.builtin").spell_suggest()<cr>')
map("n", "<leader>i", '<cmd>lua require("telescope.builtin").git_status()<cr>')
map("n", "<leader>ca", '<cmd>lua require("telescope.builtin").lsp_code_actions()<cr>')
map("n", "<leader>cs", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<cr>')
map("n", "<leader>cd", '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<cr>')
map("n", "<leader>cr", '<cmd>lua require("telescope.builtin").lsp_references()<cr>')
map('i', '<F2>', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
map('n', '<leader>cn', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
map('v', '<leader>cn', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
map('n', '<leader>ci', '<cmd> lua vim.lsp.diagnostic.show_line_diagnostics()<cr>')
-- Easier split mappings
map("n", "<Leader><Down>", "<C-W><C-J>", { silent = true })
map("n", "<Leader><Up>", "<C-W><C-K>", { silent = true })
map("n", "<Leader><Right>", "<C-W><C-L>", { silent = true })
map("n", "<Leader><Left>", "<C-W><C-H>", { silent = true })
map("n", "<Leader>;", "<C-W>R", { silent = true })
map("n", "<Leader>[", "<C-W>_", { silent = true })
map("n", "<Leader>]", "<C-W>|", { silent = true })
map("n", "<Leader>=", "<C-W>=", { silent = true })
-- Hop
require("hop").setup()
map("n", "h", "<cmd>lua require'hop'.hint_words()<cr>")
map("n", "l", "<cmd>lua require'hop'.hint_lines()<cr>")
map("v", "h", "<cmd>lua require'hop'.hint_words()<cr>")
map("v", "l", "<cmd>lua require'hop'.hint_lines()<cr>")
vim.cmd("hi HopNextKey guifg=#ff9900")
vim.cmd("hi HopNextKey1 guifg=#ff9900")
vim.cmd("hi HopNextKey2 guifg=#ff9900")
local opt = vim.opt -- to set options
opt.backspace = { "indent", "eol", "start" }
opt.clipboard = "unnamedplus"
opt.completeopt = "menu,menuone,noselect"
opt.cursorline = true
opt.cursorcolumn = true
opt.encoding = "utf-8" -- Set default encoding to UTF-8
opt.expandtab = true -- Use spaces instead of tabs
opt.foldenable = false
opt.foldmethod = "indent"
opt.formatoptions = "l"
opt.hidden = true
opt.hidden = true -- Enable background buffers
opt.hlsearch = true -- Highlight found searches
opt.ignorecase = true -- Ignore case
opt.inccommand = "split" -- Get a preview of replacements
opt.incsearch = true -- Shows the match while typing
opt.joinspaces = false -- No double spaces with join
opt.linebreak = true -- Stop words being broken on wrap
opt.number = true -- Show line numbers
opt.list = true -- Show some invisible characters
opt.listchars = { tab = "", trail = "·" }
opt.relativenumber = true
opt.scrolloff = 4 -- Lines of context
opt.shiftround = true -- Round indent
opt.shiftwidth = 4 -- Size of an indent
opt.showmode = false -- Don't display mode
opt.sidescrolloff = 8 -- Columns of context
opt.signcolumn = "yes:1" -- always show signcolumns
opt.smartcase = true -- Do not ignore case with capitals
opt.smartindent = true -- Insert indents automatically
opt.spelllang = { "en_gb" }
opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current
opt.tabstop = 4 -- Number of spaces tabs count for
opt.termguicolors = true -- You will have bad experience for diagnostic messages when it's default 4000.
opt.wrap = true
opt.cc = "80"
opt.mouse = "a"
opt.guicursor =
"n-v-c-sm:block-blinkwait50-blinkon50-blinkoff50,i-ci-ve:ver25-Cursor-blinkon100-blinkoff100,r-cr-o:hor20"
opt.undodir = vim.fn.stdpath("config") .. "/undo"
opt.undofile = true
@benfrain
Copy link
Author

benfrain commented Oct 22, 2021

Switched to new lualine repo as original is no longer maintained. Some minor tweaks needed in the config.

@benfrain
Copy link
Author

benfrain commented Nov 5, 2021

Added some additions to the word count component of Lualine so it uses the Nightfox Nord colors if present and defaults to a light on dark otherwise

@benfrain
Copy link
Author

benfrain commented Nov 8, 2021

Updated mappings to simplify telescope calls and allow flex layout

@benfrain
Copy link
Author

benfrain commented Nov 10, 2021

Trialling using Telescope and stock Neovim stuff for LSP tasks (removed LSP Saga)

@benfrain
Copy link
Author

benfrain commented Nov 22, 2021

Adding Alpha for a nicer startup experience, switched the session manager for the recommended one (also comes with telescope plugin for simple session switching), outline-symbols for outline view in markdown.

@benfrain
Copy link
Author

benfrain commented Nov 23, 2021

Big change. Moved to packer and broke up config into individual files.

@dubcdr
Copy link

dubcdr commented Nov 25, 2021

Thanks for this great write-up. Not sure if it's others see the same problem as me but I needed some additional configuration to fix nvim-cmp

I was getting the following error

image

when I ran CmpStatus I saw that vsnip was unavailable

image

adding these two packages in hrsh7th/nvim-cmp in requires seemed to fix the issue

{ "hrsh7th/vim-vsnip" },
{ "hrsh7th/vim-vsnip-integ" }

image

Again thanks for the awesome write up and configs

@daephx
Copy link

daephx commented Dec 31, 2021

Thanks for the reference material!
Looks like you got a duplicate: https://gist.github.com/benfrain/97f2b91087121b2d4ba0dcc4202d252f#file-options-lua-L12-L13

@benfrain
Copy link
Author

benfrain commented Jan 1, 2022

@daephx thanks! I’ll de-dupe!

@benfrain
Copy link
Author

benfrain commented Jan 3, 2022

Removed the Y to delete to the end of the line as it's standard now in 0.6 or Neovim, ref: https://www.reddit.com/r/neovim/comments/ruth5m/comment/hr3m80a/?utm_source=share&utm_medium=web2x&context=3

@benfrain
Copy link
Author

benfrain commented Jan 4, 2022

Further tweaks for 6.1 compatibility

@benfrain
Copy link
Author

benfrain commented Jan 17, 2022

Switched the auto-session plugin back to https://github.com/rmagatti/auto-session as that was the one now recommended on Telescope and the previous one had started causing errors.

@the-mrd
Copy link

the-mrd commented Feb 7, 2022

Don't you have the same key mapping for both NvimTreeFindFile and Update plugins? Leader - u

@benfrain
Copy link
Author

benfrain commented Feb 7, 2022

@the-mrd Ah, yes! Never noticed it as I rarely use nvim tree these days! I’ll re assign, thanks!

@benfrain
Copy link
Author

benfrain commented Mar 1, 2022

Updated the mappings as had the Telescope mapping for diagnostics still set to the old style

@benfrain
Copy link
Author

benfrain commented Mar 30, 2022

Switched from Hop to Pounce: https://github.com/rlane/pounce.nvim and removed nvim-tree (wasn't using it, use telescope file browser for that use case)

@benfrain
Copy link
Author

benfrain commented Apr 4, 2022

Added a command to the options.lua from https://www.reddit.com/r/neovim/comments/f0qx2y/comment/fgxa0f8/ to try and deal with git updates better

@benfrain
Copy link
Author

benfrain commented Apr 19, 2022

Updates for Neovim 0.7
Also added some augroups to make the cursor lines only appear on the focused windows in a split

@benfrain
Copy link
Author

benfrain commented Apr 28, 2022

added friendly snippets as a requirement of cmp, for easy boilerplate of HTML etc

@benfrain
Copy link
Author

benfrain commented May 3, 2022

Updated to use latest Tree Sitter setup with individually specified languages. If you want all available languages, set it to 'all' instead:

require("nvim-treesitter.configs").setup({
  rainbow = {
    enable = true,
    extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
    max_file_lines = nil, -- Do not enable for files with more than n lines, int
  },
  autotag = {
    enable = true,
    filetypes = {
      "html",
      "javascript",
      "typescript",
      "markdown",
    },
  },
  incremental_selection = {
    enable = true,
    keymaps = {
      init_selection = "<CR>",
      scope_incremental = "<CR>",
      node_incremental = "<CR>",
      node_decremental = "<TAB>",
    },
  },
})
-- Setup treesitter
local ts = require("nvim-treesitter.configs")
ts.setup({
  ensure_installed = {
    "all",
  },
  highlight = { enable = true },
})

@benfrain
Copy link
Author

benfrain commented May 3, 2022

Adding mapping into cmp config so when autocompleting on the cmd mode i can press ESC and exit autocomplete but keep typing

@benfrain
Copy link
Author

benfrain commented May 5, 2022

Undoing the change with ESC in cmp as it meant I needed to press ESC twice in insert mode everytime I want

@the-mrd
Copy link

the-mrd commented May 6, 2022

Shouldn't the packer compile autocmd reference plugins.lua instead of init.lua ?

vim.api.nvim_create_autocmd(
  "BufWritePost",
  { command = "source <afile> | PackerCompile", group = packer_group, pattern = "init.lua" }
)

We want the compile command to trigger when changing something related to the plugins, no?

@benfrain
Copy link
Author

benfrain commented May 6, 2022

Shouldn't the packer compile autocmd reference plugins.lua instead of init.lua ?

vim.api.nvim_create_autocmd(
  "BufWritePost",
  { command = "source <afile> | PackerCompile", group = packer_group, pattern = "init.lua" }
)

We want the compile command to trigger when changing something related to the plugins, no?

Yes! Thanks, I’ll update.

@benfrain
Copy link
Author

benfrain commented May 10, 2022

Updated Nightfox config so overrides actually work!

@benfrain
Copy link
Author

benfrain commented May 11, 2022

updated cmp to provide completions from all visible buffers.

@benfrain
Copy link
Author

benfrain commented May 12, 2022

Switched out separate renamer plugin for dressing.

@the-mrd
Copy link

the-mrd commented May 18, 2022

Is nvim-colorizer still useful/used with nightfox? Don't they conflict or override?

@benfrain
Copy link
Author

benfrain commented May 19, 2022

Is nvim-colorizer still useful/used with nightfox? Don't they conflict or override?

They serve different purposes. colorizer just changes text/hex values in the code you are editing into the appropriate color background. night fox is the color theme.

@benfrain
Copy link
Author

benfrain commented May 24, 2022

LSP/null-ls updates to deal with neovim 0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment