/README.md Secret
-
Star
(142)
You must be signed in to star a gist -
Fork
(23)
You must be signed in to fork a gist
-
-
Save benfrain/97f2b91087121b2d4ba0dcc4202d252f to your computer and use it in GitHub Desktop.
-- 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 |
Is nvim-colorizer
still useful/used with nightfox? Don't they conflict or override?
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.
LSP/null-ls updates to deal with neovim 0.8
made Ivy the default picker layout for all the Telescope pickers
swapped the surround plugin put it back to original tpope surround as new one seems flakey
Changed Telescope buffers so it shows Most Recently Used and ignores the current buffer from the list
Added indent blank line and used options so it only shows on active buffer
Noticed that the mapping map("n", "n", "nzz")
, which I was using to move to the next search result but center it, was actually stopping the built it search result from displaying and updating. Removed those and similar mappings and removed some other mappings I never actually use like tab to move to next buffer.
Removed a few plugins I rarely use. removed stabilize as it is in Nightly core now as splitkeep option: https://www.reddit.com/r/neovim/comments/xx3fom/new_option_splitkeep_merged_into_master/
Added descriptions to mappings, added Which Key
Swapped to Lazy based config
Added mini.move for line bubbling and removed the existing mappings I had from mappings.lua
Added an LSP hover shortcut and a function to remove any popups when Esc is pressed.
Lualine has its own searchcount component now, so removed my own from Lualine config
Added comment box plugin and mappings, removed headlines plugin
Amended the LSP and mappings so that I only see diagnostic messages on a line with my mapping. Still get the gutter icon at all times.
Removing these:
treesitter-textobjects can go.
nvim-autopairs
num2str comment
kylechui surround
welle targets
famiu/bufdelete.nvim
indentblankline
And replacing with these:
mini.ai
mini.pairs
mini.surround
mini.comment
mini.move
mini.bracketed
mini.bufremove
mini.indentscope
Updated the Kanagawa config to deal with breaking changes there
Gone back to Kylechui for surround; prefer it.
Gone back to nvim-autopairs over mini.pairs; think it works better
Updated auto-session config and lualine usage
Adding navbuddy
removed null-ls/pounce, trying conform and flash
switching out mini.comment as it seemed to constantly fail with block comments in scss/ts files.
Currently unused plugin configs now prefixed with 'x-' so they are at the bottom
Going back to Pounce, find Flash does too much
Added symbols from NerdFonts to Which key as the default ones were not showing up
Updated the options.lua file to add a !silent to the autocmd which stopped this error: Error detected while processing CursorHold Autocommands for "*": E11: Invalid in command-line window; <CR> executes, CTRL-C quits: checktime | endif
Found the solution here: https://morgan.cugerone.com/blog/troubleshooting-vim-error-while-processing-cursorhold-autocommands-in-command-line-window/
Also learnt that when you are in cmd mode, you can press ctrl+f
to get a window up that lets you enter commands like a normal buffer and press enter to execute. You can also then press ctrl+c
to exit that mode, and again to exit cmd mode!
Few tweaks for Which Key v3
Switched out separate renamer plugin for dressing.