Move to Astrovim/Neovide
This commit is contained in:
parent
c630d25a1b
commit
6570bb45af
|
@ -1,9 +1,21 @@
|
|||
require('plugins')
|
||||
require('settings')
|
||||
require('treesitter') -- Configure TreeSitter plugin
|
||||
require('folding') -- Configure Folding parameters
|
||||
require('automations') -- Init and Async functions
|
||||
require('autocompletion')
|
||||
--require('telescope-config')
|
||||
--require('lsp-config')
|
||||
--require('run-current')
|
||||
local impatient_ok, impatient = pcall(require, "impatient")
|
||||
if impatient_ok then impatient.enable_profile() end
|
||||
|
||||
for _, source in ipairs {
|
||||
"core.utils",
|
||||
"core.options",
|
||||
"core.bootstrap",
|
||||
"core.diagnostics",
|
||||
"core.autocmds",
|
||||
"core.mappings",
|
||||
"configs.which-key-register",
|
||||
} do
|
||||
local status_ok, fault = pcall(require, source)
|
||||
if not status_ok then vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) end
|
||||
end
|
||||
|
||||
astronvim.conditional_func(astronvim.user_plugin_opts("polish", nil, false))
|
||||
|
||||
if vim.fn.has "nvim-0.8" ~= 1 or vim.version().prerelease then
|
||||
vim.schedule(function() astronvim.notify("Unsupported Neovim Version! Please check the requirements", "error") end)
|
||||
end
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
min_length = 1;
|
||||
preselect = 'enable';
|
||||
throttle_time = 80;
|
||||
source_timeout = 200;
|
||||
resolve_timeout = 800;
|
||||
incomplete_delay = 400;
|
||||
max_abbr_width = 100;
|
||||
max_kind_width = 100;
|
||||
max_menu_width = 100;
|
||||
documentation = {
|
||||
border = { '', '' ,'', ' ', '', '', '', ' ' }, -- the border option is the same as `|help nvim_open_win|`
|
||||
winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder",
|
||||
max_width = 120,
|
||||
min_width = 60,
|
||||
max_height = math.floor(vim.o.lines * 0.3),
|
||||
min_height = 1,
|
||||
};
|
||||
source = {
|
||||
path = true;
|
||||
buffer = true;
|
||||
calc = true;
|
||||
nvim_lsp = true;
|
||||
nvim_lua = true;
|
||||
vsnip = false;
|
||||
ultisnips = false;
|
||||
luasnip = false;
|
||||
treesitter = true;
|
||||
};
|
||||
}
|
||||
|
||||
-- select first option when none selected
|
||||
vim.api.nvim_set_keymap("i", "<CR>", "compe#confirm({ 'keys': '<CR>', 'select': v:true })", { expr = true })
|
|
@ -1,16 +0,0 @@
|
|||
-- Start Git commit in insert mode
|
||||
vim.api.nvim_create_augroup("bufcheck", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = "bufcheck",
|
||||
pattern = { "gitcommit", "gitrebase" },
|
||||
command = "startinsert | 1",
|
||||
})
|
||||
|
||||
-- Write buffers every 5 seconds
|
||||
local function write_buf_timer()
|
||||
vim.fn.timer_start(5000, function()
|
||||
vim.api.nvim_command('wall')
|
||||
end)
|
||||
end
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = write_buf_timer })
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
require('fold-cycle').setup({
|
||||
open_if_closed = true,
|
||||
close_if_opened = true,
|
||||
softwrap_movement_fix = true,
|
||||
})
|
||||
vim.keymap.set('n', '<tab>',
|
||||
function() return require('fold-cycle').open() end,
|
||||
{silent = true, desc = 'Fold-cycle: open folds'})
|
||||
vim.keymap.set('n', '<s-tab>',
|
||||
function() return require('fold-cycle').close() end,
|
||||
{silent = true, desc = 'Fold-cycle: close folds'})
|
||||
vim.keymap.set('n', 'zC',
|
||||
function() return require('fold-cycle').close_all() end,
|
||||
{remap = true, silent = true, desc = 'Fold-cycle: close all folds'})
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
@ -1,150 +0,0 @@
|
|||
-- Variables
|
||||
HOME = os.getenv("HOME")
|
||||
|
||||
-- Basic Functions/Settings
|
||||
vim.o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
vim.o.history = 1000
|
||||
vim.o.startofline = true
|
||||
|
||||
-- UI
|
||||
vim.o.background= 'dark'
|
||||
vim.o.termguicolors = true
|
||||
vim.o.ttyfast = true
|
||||
vim.o.autoread = true
|
||||
vim.o.hlsearch = true
|
||||
vim.o.number = true
|
||||
vim.o.title = true
|
||||
vim.o.scrolloff = 1000 -- center current line in screen
|
||||
vim.o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
||||
vim.o.laststatus = 2 -- always show status line
|
||||
|
||||
-- Styleguide/Preferences
|
||||
vim.o.autoindent = true
|
||||
|
||||
-- Localization
|
||||
vim.o.encoding = "utf-8"
|
||||
vim.o.dictionary = '/usr/share/dict/words'
|
||||
vim.o.spelllang = 'en_ca'
|
||||
|
||||
-- Define files to spellcheck
|
||||
vim.api.nvim_create_autocmd(
|
||||
{
|
||||
"BufRead",
|
||||
"BufNewFile"
|
||||
},{
|
||||
pattern = {
|
||||
"gitcommit",
|
||||
"gitrebase",
|
||||
"*.txt",
|
||||
"*.md",
|
||||
"*.tex"
|
||||
},
|
||||
command = "setlocal spell"
|
||||
}
|
||||
)
|
||||
|
||||
-- Mapping Timeouts
|
||||
vim.o.timeout = false
|
||||
vim.o.ttimeout = true
|
||||
vim.o.ttimeoutlen = 100
|
||||
|
||||
-- Display Hints/Highlights
|
||||
vim.o.colorcolumn=101
|
||||
vim.highlight.create('ColorColumn', {ctermbg=lightred, guibg=lightred}, false)
|
||||
vim.highlight.create('ExtraWhitespace', {ctermbg=lightred, guibg=lightred}, false)
|
||||
vim.o.showmatch = true -- show matching brackets
|
||||
vim.o.list = 'listchars=tab:»\ ,trail:·'
|
||||
vim.o.foldenable = false
|
||||
vim.o.foldlevel = 4 -- limit folding to 4 levels
|
||||
vim.o.foldmethod = 'syntax' -- use language syntax to generate folds
|
||||
vim.o.wrap = true --do not wrap lines even if very long
|
||||
vim.o.eol = false -- show if there's no eol char
|
||||
vim.o.showbreak= '↪' -- character to show when line is broken
|
||||
-- Remove trailing whitespace
|
||||
vim.api.nvim_create_autocmd(
|
||||
{
|
||||
"BufWritePre",
|
||||
"BufWinEnter",
|
||||
"InsertEnter",
|
||||
"InsertLeave"
|
||||
},{
|
||||
pattern = { "*" },
|
||||
command = [[%s/\s\+$//e]]
|
||||
}
|
||||
)
|
||||
|
||||
-- Sidebar
|
||||
vim.o.number = true -- line number on the left
|
||||
vim.o.numberwidth = 4 -- always reserve 4 spaces for line number
|
||||
vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check
|
||||
vim.o.modelines = 0
|
||||
vim.o.showcmd = true -- display command in bottom bar
|
||||
|
||||
-- Search
|
||||
vim.o.incsearch = true -- starts searching as soon as typing, without enter needed
|
||||
vim.o.ignorecase = true -- ignore letter case when searching
|
||||
vim.o.smartcase = true -- case insentive unless capitals used in search
|
||||
vim.o.matchtime = 2 -- delay before showing matching paren
|
||||
vim.o.mps = vim.o.mps .. ",<:>"
|
||||
|
||||
-- White characters
|
||||
vim.o.autoindent = true
|
||||
vim.o.smartindent = true
|
||||
vim.o.tabstop = 4 -- 1 tab = 2 spaces
|
||||
vim.o.shiftwidth = 4 -- indentation rule
|
||||
vim.o.formatoptions = 'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
|
||||
vim.o.expandtab = true -- expand tab to spaces
|
||||
|
||||
-- Backup files
|
||||
vim.o.undodir = HOME .. '/.spool/nvim/tmp/undo//' -- undo files
|
||||
vim.o.backup = true -- use backup files
|
||||
vim.o.writebackup = true -- use temporary backup during write
|
||||
vim.o.backupdir = HOME .. '/.spool/nvim/tmp/backup//' -- backups
|
||||
vim.o.swapfile = false -- don't use swap file
|
||||
--vim.o.directory = HOME .. '/.spool/nvim/tmp/swap//' -- swap files
|
||||
|
||||
-- Commands mode
|
||||
vim.o.wildmenu = true -- on TAB, complete options for system command
|
||||
vim.o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
|
||||
|
||||
-- Executables
|
||||
vim.g.python3_host_prog = "/var/home/jpm/.pyenv/shims/python3"
|
||||
vim.g.python_host_prog = "/var/home/jpm/.pyenv/shims/python2"
|
||||
|
||||
-- Theme
|
||||
vim.o.background = 'dark'
|
||||
vim.colorscheme = 'gruvbox'
|
||||
vim.o.t_Co = 16
|
||||
vim.cmd([[
|
||||
let g:gruvbox_contrast_dark="hard"
|
||||
let g:gruvbox_italic=1
|
||||
let g:gruvbox_bold=1
|
||||
let g:gruvbox_underline=1
|
||||
let g:gruvbox_undercurl=1
|
||||
let g:gruvbox_termcolors=256
|
||||
syn on se title
|
||||
]])
|
||||
|
||||
-- Abbreviations
|
||||
vim.cmd([[
|
||||
source ${HOME}/.dotfiles/vim/abbreviations/personalAbbreviations.vim
|
||||
source ${HOME}/.dotfiles/vim/abbreviations/codingAbbreviations.vim
|
||||
]])
|
||||
|
||||
-- Fix indentation in file
|
||||
--viml: map <leader>i mmgg=G`m<CR>
|
||||
vim.g.mapleader = ','
|
||||
vim.g.maplocalleader = '\\'
|
||||
vim.keymap.set("i", "kj", "<esc>", { silent = true })
|
||||
|
||||
-- Configure tabline
|
||||
vim.cmd([[
|
||||
set showtabline=2
|
||||
let g:tablabel = "%N%{flagship#tabmodified()} %{flagship#tabcwds('shorten',',')}"
|
||||
]])
|
||||
|
||||
-- 100 characters line
|
||||
--"execute "set colorcolumn=" . join(range(101,335), ',')
|
||||
--highlight ColorColumn ctermbg=Black ctermfg=DarkRed
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
-- God forbid I ever have to use Windows, this should make it compatible
|
||||
local sep = vim.loop.os_uname().sysname == 'Windows_NT' and [[\]] or [[/]]
|
||||
local function join(...)
|
||||
return table.concat({ ... }, sep)
|
||||
end
|
||||
|
||||
local home = os.getenv 'HOME'
|
||||
local len = #home
|
||||
|
||||
local homepath = join(home, '.dotfiles', 'config-name')
|
||||
local cachepath = join(home, '.cache', 'config-name')
|
||||
|
||||
-- Add path locations for configuration
|
||||
local rtp = { homepath, cachepath }
|
||||
|
||||
-- Add paths that dont start with home.
|
||||
for _, p in ipairs(vim.opt.runtimepath:get()) do
|
||||
if p:sub(1, len) ~= home then
|
||||
rtp[#rtp + 1] = p
|
||||
end
|
||||
end
|
||||
|
||||
vim.opt.runtimepath = rtp
|
||||
|
||||
-- Packer paths and files
|
||||
local pack_path = join(homepath, 'site')
|
||||
local package_root = join(pack_path, 'pack')
|
||||
local compile_path = join(homepath, 'plugins', 'packer_compiled.lua')
|
||||
vim.g.loaded_remote_plugins = 1
|
||||
|
||||
vim.opt.packpath:prepend(pack_path)
|
||||
|
||||
local packer_bootstrap = false
|
||||
local packer_install_path = join(package_root, 'packer', 'start', 'packer.nvim')
|
||||
if vim.fn.isdirectory(packer_install_path) == 0 then
|
||||
vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_install_path }
|
||||
vim.cmd.packadd 'packer.nvim'
|
||||
packer_bootstrap = true
|
||||
end
|
||||
|
||||
require('packer').startup {
|
||||
function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- LSP - Language Server Protocol
|
||||
--use 'neovim/nvim-lspconfig'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-cmdline'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
-- TreeSitter - Syntax highlighting
|
||||
use 'nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}
|
||||
-- Fold-Cycle - Better management of foldable blocks
|
||||
use 'jghauser/fold-cycle.nvim'
|
||||
-- Git Gutter - Git diff markers
|
||||
use 'airblade/vim-gitgutter'
|
||||
-- Lightline - lightweight status/tabline beautification
|
||||
use 'itchyny/lightline.vim'
|
||||
-- Nerdtree - Tree explorer
|
||||
use 'preservim/nerdtree'
|
||||
-- Conqueror of Completion
|
||||
use 'neoclide/coc.nvim', {branch = 'release'}
|
||||
use 'bmeneg/coc-perl', {run = 'yarn install && yarn build'}
|
||||
-- use 'dart-lang/dart-vim-plugin'
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end,
|
||||
config = {
|
||||
package_root = package_root,
|
||||
compile_path = compile_path,
|
||||
},
|
||||
}
|
||||
|
||||
call plug#end()
|
||||
|
||||
let g:coc_global_extensions = ['coc-json', 'coc-html', 'coc-python', 'coc-php', 'coc-perl', 'coc-flutter', 'coc-git']
|
||||
if plug_install
|
||||
PlugInstall --sync
|
||||
endif
|
||||
unlet plug_install
|
||||
|
||||
source $HOME/.dotfiles/vim/generic
|
||||
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"dart",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"perl",
|
||||
"php",
|
||||
"rasi",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = true,
|
||||
-- List of parsers to ignore installing
|
||||
ignore_install = { },
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
-- list of language that will be disabled
|
||||
disable = { "" },
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
-- dont enable this, messes up python indentation
|
||||
enable = false,
|
||||
disable = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- local nvim_lsp = require('lspconfig')
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
-- Mappings
|
||||
local opts = { noremap=true, silent=false }
|
||||
local opts2 = { focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = 'rounded',
|
||||
source = 'always', -- show source in diagnostic popup window
|
||||
prefix = ' '}
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>tab split | lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>t', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float(0, {{opts2}, scope="line", border="rounded"})<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev({ float = { border = "rounded" }})<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next({ float = { border = "rounded" }})<CR>', opts)
|
||||
buf_set_keymap("n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist({open = true})<CR>", opts)
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
-- NOTE: Don't use more than 1 servers otherwise nvim is unstable
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
-- Use pylsp
|
||||
-- nvim_lsp.pylsp.setup({
|
||||
-- on_attach = on_attach,
|
||||
-- settings = {
|
||||
-- pylsp = {
|
||||
-- plugins = {
|
||||
-- pylint = { enabled = true, executable = "pylint" },
|
||||
-- pyflakes = { enabled = true },
|
||||
-- pycodestyle = { enabled = false },
|
||||
-- jedi_completion = { fuzzy = true },
|
||||
-- pyls_isort = { enabled = true },
|
||||
-- pylsp_mypy = { enabled = true },
|
||||
-- },
|
||||
-- }, },
|
||||
-- flags = {
|
||||
-- debounce_text_changes = 200,
|
||||
-- },
|
||||
-- capabilities = capabilities,
|
||||
-- })
|
||||
-- Use pyright or jedi_language_server
|
||||
--local servers = {'jedi_language_server'}
|
||||
--local servers = {'pyright'}
|
||||
--for _, lsp in ipairs(servers) do
|
||||
-- nvim_lsp[lsp].setup({
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities
|
||||
--})
|
||||
--end
|
||||
-- Change diagnostic signs.
|
||||
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
-- global config for diagnostic
|
||||
vim.diagnostic.config({
|
||||
underline = false,
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
-- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998.
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
-- require'lspconfig'.perlpls.setup()
|
||||
|
||||
require('fold-cycle').setup({
|
||||
open_if_closed = true,
|
||||
close_if_opened = true,
|
||||
softwrap_movement_fix = true,
|
||||
})
|
||||
vim.keymap.set('n', '<tab>',
|
||||
function() return require('fold-cycle').open() end,
|
||||
{silent = true, desc = 'Fold-cycle: open folds'})
|
||||
vim.keymap.set('n', '<s-tab>',
|
||||
function() return require('fold-cycle').close() end,
|
||||
{silent = true, desc = 'Fold-cycle: close folds'})
|
||||
vim.keymap.set('n', 'zC',
|
||||
function() return require('fold-cycle').close_all() end,
|
||||
{remap = true, silent = true, desc = 'Fold-cycle: close all folds'})
|
||||
|
||||
vim.cmd([[
|
||||
set foldmethod=expr
|
||||
set cursorline
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
]])
|
|
@ -1,127 +0,0 @@
|
|||
-- Join paths
|
||||
local function join(...)
|
||||
local sep = '/'
|
||||
return table.concat({ ... }, sep)
|
||||
end
|
||||
|
||||
-- Packer paths and files
|
||||
local home = os.getenv 'HOME'
|
||||
local homepath = join(home, '.var', 'app', 'io.neovim.nvim', 'data', 'site')
|
||||
local pack_path = join(homepath)
|
||||
local package_root = join(pack_path, 'pack')
|
||||
|
||||
-- Bootstrap packer
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local packer_install_path = join(package_root, 'packer', 'start', 'packer.nvim')
|
||||
if fn.empty(fn.glob(packer_install_path)) > 0 then
|
||||
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', packer_install_path})
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function()
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- Add plugins here:
|
||||
use { "ellisonleao/gruvbox.nvim" }
|
||||
-- TreeSitter - Syntax highlighting
|
||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = false,
|
||||
disable = { }
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"dart",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"perl",
|
||||
"php",
|
||||
"rasi",
|
||||
"toml",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
sync_install = true,
|
||||
ignore_install = { },
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "" },
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = { "python", "python2", "python3" },
|
||||
},
|
||||
}
|
||||
-- Fold-Cycle - Better management of foldable blocks
|
||||
use 'jghauser/fold-cycle.nvim'
|
||||
use { 'yamatsum/nvim-cursorline',
|
||||
config = function()
|
||||
require('nvim-cursorline').setup({
|
||||
cursorline = {
|
||||
enable = true,
|
||||
timeout = 0,
|
||||
number = true,
|
||||
hl = {
|
||||
underline = false,
|
||||
},
|
||||
},
|
||||
cursorword = {
|
||||
enable = true,
|
||||
min_length = 1,
|
||||
hl = {
|
||||
underline = false,
|
||||
bold = true
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
-- LSP - Language Server Protocol
|
||||
--use 'neovim/nvim-lspconfig'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-cmdline'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
-- Search
|
||||
use { 'nvim-telescope.nvim', requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} }
|
||||
use 'tpope/vim-eunuch'
|
||||
use 'tpope/vim-surround'
|
||||
use 'tpope/vim-vinegar'
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
-- Testing
|
||||
use 'vim-test/vim-test'
|
||||
-- Git
|
||||
use 'tpope/vim-fugitive'
|
||||
use 'vim-airline/vim-airline'
|
||||
use 'vim-airline/vim-airline-themes'
|
||||
use 'airblade/vim-gitgutter'
|
||||
-- Lightline - lightweight status/tabline beautification
|
||||
use 'itchyny/lightline.vim'
|
||||
-- Nerdtree - Tree explorer
|
||||
use 'preservim/nerdtree'
|
||||
-- Conqueror of Completion
|
||||
use { 'hrsh7th/nvim-compe' }
|
||||
use { 'neoclide/coc.nvim', branch = 'release'}
|
||||
use { 'bmeneg/coc-perl', run = 'yarn install && yarn build'}
|
||||
-- use 'dart-lang/dart-vim-plugin'
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
|
@ -1,162 +0,0 @@
|
|||
-- Change diagnostic signs.
|
||||
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
-- global config for diagnostic
|
||||
vim.diagnostic.config({
|
||||
underline = false,
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
-- Variables
|
||||
HOME = os.getenv("HOME")
|
||||
|
||||
-- Basic Functions/Settings
|
||||
vim.opt.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
||||
vim.opt.completeopt = 'menuone,noselect'
|
||||
vim.opt.history = 1000
|
||||
vim.opt.startofline = true
|
||||
|
||||
-- UI
|
||||
vim.opt.background= 'dark'
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.ttyfast = true
|
||||
vim.opt.autoread = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.number = true
|
||||
vim.opt.title = true
|
||||
vim.opt.scrolloff = 1000 -- center current line in screen
|
||||
vim.opt.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
||||
vim.opt.laststatus = 2 -- always show status line
|
||||
|
||||
-- Styleguide/Preferences
|
||||
vim.opt.autoindent = true
|
||||
|
||||
-- Localization
|
||||
vim.opt.encoding = "utf-8"
|
||||
vim.opt.dictionary = '/usr/share/dict/words'
|
||||
vim.opt.spelllang = 'en_ca'
|
||||
|
||||
-- Define files to spellcheck
|
||||
vim.api.nvim_create_autocmd(
|
||||
{
|
||||
"BufRead",
|
||||
"BufNewFile"
|
||||
},{
|
||||
pattern = {
|
||||
"gitcommit",
|
||||
"gitrebase",
|
||||
"*.txt",
|
||||
"*.md",
|
||||
"*.tex"
|
||||
},
|
||||
command = "setlocal spell"
|
||||
}
|
||||
)
|
||||
|
||||
-- Mapping Timeouts
|
||||
vim.opt.timeout = false
|
||||
vim.opt.ttimeout = true
|
||||
vim.opt.ttimeoutlen = 100
|
||||
|
||||
-- Display Hints/Highlights
|
||||
vim.opt.colorcolumn="101"
|
||||
vim.api.nvim_set_hl(0, 'ColorColumn', { bg='red' })
|
||||
vim.api.nvim_set_hl(0, 'TODO', { bg='white' })
|
||||
vim.api.nvim_set_hl(0, 'ExtraWhitespace', { bg='lightred' })
|
||||
vim.cmd[[ match ExtraWhitespace /\s\+\%#\@<!$/ ]]
|
||||
vim.cmd[[ match TODO /\bTODO\b/ ]]
|
||||
|
||||
vim.opt.showmatch = true -- show matching brackets
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = 'tab:» ,trail:·'
|
||||
vim.opt.foldenable = false
|
||||
vim.opt.foldlevel = 4 -- limit folding to 4 levels
|
||||
vim.opt.foldmethod = 'syntax' -- use language syntax to generate folds
|
||||
vim.opt.wrap = true --do not wrap lines even if very long
|
||||
vim.opt.eol = false -- show if there's no eol char
|
||||
vim.opt.showbreak= '↳' -- character to show when line is broken
|
||||
-- Remove trailing whitespace
|
||||
vim.api.nvim_create_autocmd(
|
||||
{
|
||||
"BufWritePre",
|
||||
"BufWinEnter",
|
||||
"InsertEnter",
|
||||
"InsertLeave"
|
||||
},{
|
||||
pattern = { "*" },
|
||||
command = [[%s/\s\+$//e]]
|
||||
}
|
||||
)
|
||||
|
||||
-- Sidebar
|
||||
vim.opt.number = true -- line number on the left
|
||||
vim.opt.numberwidth = 4 -- always reserve 4 spaces for line number
|
||||
vim.opt.signcolumn = 'yes' -- keep 1 column for coc.vim check
|
||||
vim.opt.modelines = 0
|
||||
vim.opt.showcmd = true -- display command in bottom bar
|
||||
|
||||
-- Search
|
||||
vim.opt.incsearch = true -- starts searching as soon as typing, without enter needed
|
||||
vim.opt.ignorecase = true -- ignore letter case when searching
|
||||
vim.opt.smartcase = true -- case insentive unless capitals used in search
|
||||
vim.opt.matchtime = 2 -- delay before showing matching paren
|
||||
|
||||
-- White characters
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.tabstop = 4 -- 1 tab = 2 spaces
|
||||
vim.opt.shiftwidth = 4 -- indentation rule
|
||||
vim.opt.formatoptions = 'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
|
||||
vim.opt.expandtab = true -- expand tab to spaces
|
||||
|
||||
-- Backup files
|
||||
vim.opt.undodir = HOME .. '/.spool/nvim/tmp/undo//' -- undo files
|
||||
vim.opt.backup = true -- use backup files
|
||||
vim.opt.writebackup = true -- use temporary backup during write
|
||||
vim.opt.backupdir = HOME .. '/.spool/nvim/tmp/backup//' -- backups
|
||||
vim.opt.swapfile = false -- don't use swap file
|
||||
--vim.opt.directory = HOME .. '/.spool/nvim/tmp/swap//' -- swap files
|
||||
|
||||
-- Commands mode
|
||||
vim.opt.wildmenu = true -- on TAB, complete options for system command
|
||||
vim.opt.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
|
||||
|
||||
-- Executables
|
||||
vim.g.python3_host_prog = "/var/home/jpm/.pyenv/shims/python3"
|
||||
vim.g.python_host_prog = "/var/home/jpm/.pyenv/shims/python2"
|
||||
|
||||
-- Theme
|
||||
vim.opt.background = 'dark'
|
||||
vim.colorscheme = 'gruvbox'
|
||||
vim.cmd([[
|
||||
set t_Co=256
|
||||
let g:airline_theme="base16_gruvbox_dark_hard"
|
||||
let g:gruvbox_contrast_dark="hard"
|
||||
let g:gruvbox_italic=1
|
||||
let g:gruvbox_bold=1
|
||||
let g:gruvbox_underline=1
|
||||
let g:gruvbox_undercurl=1
|
||||
let g:gruvbox_termcolors=256
|
||||
syn on se title
|
||||
]])
|
||||
|
||||
-- Abbreviations
|
||||
vim.cmd([[
|
||||
source ${HOME}/.dotfiles/vim/abbreviations/personalAbbreviations.vim
|
||||
source ${HOME}/.dotfiles/vim/abbreviations/codingAbbreviations.vim
|
||||
]])
|
||||
|
||||
-- Fix indentation in file
|
||||
--viml: map <leader>i mmgg=G`m<CR>
|
||||
vim.g.mapleader = ','
|
||||
vim.g.maplocalleader = '\\'
|
||||
vim.keymap.set("i", "kj", "<esc>", { silent = true })
|
||||
|
||||
-- Configure tabline
|
||||
vim.cmd([[
|
||||
set showtabline=2
|
||||
let g:tablabel = "%N%{flagship#tabmodified()} %{flagship#tabcwds('shorten',',')}"
|
||||
]])
|
|
@ -1,41 +0,0 @@
|
|||
require 'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"dart",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"perl",
|
||||
"php",
|
||||
"rasi",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = true,
|
||||
-- List of parsers to ignore installing
|
||||
ignore_install = { },
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
-- list of language that will be disabled
|
||||
disable = { "" },
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
-- dont enable this, messes up python indentation
|
||||
enable = false,
|
||||
disable = {},
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue