ts=4 and initial nvim.lua

This commit is contained in:
John Mertz 2023-01-07 12:03:31 -05:00
parent 412282ccee
commit 2cc8014a90
23 changed files with 917 additions and 126 deletions

View File

@ -26,4 +26,4 @@ This file contains a JSON hash of the configuration files available with either
This file contains a JSON hash of timestamps at which each configuration was last linked or dumped. The `${HOME}/scripts/update_configs.pl` script will use these times to know whether or not they need to be updated. It will do so if:
* it is a linked configuration file and the `.links` file has been updated since it was last linked.
* it is a dumpable template and the template has been updated since the last logged event.
* it is a dumpable template and the template has been updated since the last logged event.

View File

@ -55,7 +55,7 @@ alias isdistrobox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /
alias cd='export DIRCHANGED="1"; cd'
if [ $(isdistrobox) ]; then
source $HOME/.dotfiles/bash/bash_aliases.distrobox
source $HOME/.dotfiles/bash/bash_aliases.distrobox
else
source $HOME/.dotfiles/bash/bash_aliases.host
source $HOME/.dotfiles/bash/bash_aliases.host
fi

View File

@ -27,7 +27,7 @@ if [ ! -e ${HOME}/.spool/last_login_gui ]; then
fi
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_login.distrobox
source $HOME/.dotfiles/bash/bash_login.distrobox
else
source $HOME/.dotfiles/bash/bash_login.host
source $HOME/.dotfiles/bash/bash_login.host
fi

View File

@ -7,7 +7,7 @@ if [ -e $HOME/.spool/ssh-agent.env ]; then
rm $HOME/.spool/ssh-agent.env
fi
if [[ "`pgrep ssh-agent`" ]]; then
pkill ssh-agent
pkill ssh-agent
fi
. $HOME/scripts/ssh-agent.sh

View File

@ -1,7 +1,7 @@
# vim: ft=sh
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_logout.distrobox
source $HOME/.dotfiles/bash/bash_logout.distrobox
else
source $HOME/.dotfiles/bash/bash_logout.host
source $HOME/.dotfiles/bash/bash_logout.host
fi

View File

@ -17,7 +17,7 @@ PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_profile.distrobox
source $HOME/.dotfiles/bash/bash_profile.distrobox
else
source $HOME/.dotfiles/bash/bash_profile.host
source $HOME/.dotfiles/bash/bash_profile.host
fi

View File

@ -94,7 +94,7 @@ export TERM="xterm"
echo -e -n "\033]2;Welcome to Bash\007"
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bashrc.distrobox
source $HOME/.dotfiles/bash/bashrc.distrobox
else
source $HOME/.dotfiles/bash/bashrc.host
source $HOME/.dotfiles/bash/bashrc.host
fi

View File

@ -1,13 +1,13 @@
export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
if [ -z $SSH_AGENT_PID ]; then
if [ -f "$HOME/.spool/ssh-agent.env" ]; then
source $HOME/.spool/ssh-agent.env >/dev/null
else
if [ ! -f $SSH_AUTH_SOCK ]; then
touch $SSH_AUTH_SOCK
fi
$HOME/scripts/ssh-agent.sh
if [ -f "$HOME/.spool/ssh-agent.env" ]; then
source $HOME/.spool/ssh-agent.env >/dev/null
else
if [ ! -f $SSH_AUTH_SOCK ]; then
touch $SSH_AUTH_SOCK
fi
$HOME/scripts/ssh-agent.sh
fi
fi
echo "This is the host OS. You probably want to open a Distrobox."

View File

@ -32,9 +32,9 @@ fi
PATH="${HOME}/perl5/bin:$PATH"
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/path.distrobox
source $HOME/.dotfiles/bash/path.distrobox
else
source $HOME/.dotfiles/bash/path.host
source $HOME/.dotfiles/bash/path.host
fi
# Export PATH

View File

@ -11,10 +11,10 @@ fi
# If directory was just changed to the root of a git repository, print onefetch
if [ ! -z $DIRCHANGED ]; then
if [ -d $PWD/.git ]; then
$HOME/bin/onefetch
fi
unset DIRCHANGED
if [ -d $PWD/.git ]; then
$HOME/bin/onefetch
fi
unset DIRCHANGED
fi
# Default colours

9
nvim/init.lua Normal file
View File

@ -0,0 +1,9 @@
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')

View File

@ -0,0 +1,36 @@
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 })

16
nvim/lua/automations.lua Normal file
View File

@ -0,0 +1,16 @@
-- 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 })

16
nvim/lua/folding.lua Normal file
View File

@ -0,0 +1,16 @@
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()"

150
nvim/lua/generic.lua Normal file
View File

@ -0,0 +1,150 @@
-- 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

234
nvim/lua/lsp-config.lua Normal file
View File

@ -0,0 +1,234 @@
-- 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()
]])

127
nvim/lua/plugins.lua Normal file
View File

@ -0,0 +1,127 @@
-- 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)

162
nvim/lua/settings.lua Normal file
View File

@ -0,0 +1,162 @@
-- 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',',')}"
]])

41
nvim/lua/treesitter.lua Normal file
View File

@ -0,0 +1,41 @@
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 = {},
},
}

View File

@ -329,25 +329,25 @@ bindsym $mod+tab exec $HOME/scripts/wofi/alt-tab.py
# Resize Mode (you can also use the mouse for that): Entered with $mod+i
mode "resize" {
# Vim direction key to modify the size of containers
# Vim direction key to modify the size of containers
# D: shrink width
bindsym d resize shrink width 10 px or 10 ppt
# N: grow width
bindsym n resize grow width 10 px or 10 ppt
# H: shrink height
bindsym h resize shrink height 10 px or 10 ppt
# T: grow height
bindsym t resize grow height 10 px or 10 ppt
# D: shrink width
bindsym d resize shrink width 10 px or 10 ppt
# N: grow width
bindsym n resize grow width 10 px or 10 ppt
# H: shrink height
bindsym h resize shrink height 10 px or 10 ppt
# T: grow height
bindsym t resize grow height 10 px or 10 ppt
# Same system with half of the effect for more granularity with the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# Same system with half of the effect for more granularity with the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# Switch back to normal mode: Enter, Escape or Q
bindsym q mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
# Switch back to normal mode: Enter, Escape or Q
bindsym q mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}

View File

@ -1,92 +1,92 @@
[
"outputs":{
"DENON-AVAMP":"TV",
"Paperlike253":"eInk",
"0x4140":"yoga"
"DENON-AVAMP":"TV",
"Paperlike253":"eInk",
"0x4140":"yoga"
},
"layouts":{
"TV":{
"TV":{
"TV":{
"enable":1,
"width":3840,
"height":2160,
"x":0,
"y":0,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"eInk":{
"enable":0
},
"laptop":{
"enable":0
}
"enable":1,
"width":3840,
"height":2160,
"x":0,
"y":0,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"eInk":{
"TV":{
"enable":0
},
"eInk":{
"enable":1,
"width":3200,
"height":1800,
"x":0,
"y":0,
"scale":1.5,
"rotate":90,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"laptop":{
"enable":0
}
"enable":0
},
"laptop":{
"TV":{
"enable":0
},
"eInk":{
"enable":0
},
"yoga":{
"enable":1,
"width":2560,
"height":1440,
"x":0,
"y":0,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"Both":{
"TV":{
"enable":1,
"width":3840,
"height":2160,
"x":900,
"y":10,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"eInk":{
"enable":1,
"width":3200,
"height":1800,
"x":0,
"y":0,
"scale":2,
"rotate":90,
"waybar":".dotfiles/waybar/side.template",
"fallback":"#010101"
},
"laptop":{
"enable":0
}
"enable":0
}
},
"eInk":{
"TV":{
"enable":0
},
"eInk":{
"enable":1,
"width":3200,
"height":1800,
"x":0,
"y":0,
"scale":1.5,
"rotate":90,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"laptop":{
"enable":0
}
},
"laptop":{
"TV":{
"enable":0
},
"eInk":{
"enable":0
},
"yoga":{
"enable":1,
"width":2560,
"height":1440,
"x":0,
"y":0,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"Both":{
"TV":{
"enable":1,
"width":3840,
"height":2160,
"x":900,
"y":10,
"rotate":0,
"scale":1.333333,
"waybar":".dotfiles/waybar/main.template",
"fallback":"#010101"
},
"eInk":{
"enable":1,
"width":3200,
"height":1800,
"x":0,
"y":0,
"scale":2,
"rotate":90,
"waybar":".dotfiles/waybar/side.template",
"fallback":"#010101"
},
"laptop":{
"enable":0
}
}
}
]

View File

@ -263,7 +263,7 @@ window#waybar {
}
#custom-pkg.updateable {
color: @orange;
color: @orange;
}
/* Bar locker */
@ -280,7 +280,7 @@ window#waybar {
}
#custom-gammastep.enabled {
color: #fefefe;
color: #fefefe;
}
/* Idle Inhibitor */

View File

@ -1,4 +1,4 @@
width=500
location=3
yoffset=-3
height=97%
height=100%