diff --git a/README.md b/README.md index e8e93814c..48c01d1b1 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +* it is a dumpable template and the template has been updated since the last logged event. diff --git a/bash/bash_aliases b/bash/bash_aliases index 9b6b4b5cb..8e1e06969 100644 --- a/bash/bash_aliases +++ b/bash/bash_aliases @@ -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 diff --git a/bash/bash_login b/bash/bash_login index 2289b092a..5170b56a4 100644 --- a/bash/bash_login +++ b/bash/bash_login @@ -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 diff --git a/bash/bash_login.host b/bash/bash_login.host index 0e7d43398..d96e2932a 100644 --- a/bash/bash_login.host +++ b/bash/bash_login.host @@ -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 diff --git a/bash/bash_logout b/bash/bash_logout index db9dac378..18cb6baf8 100644 --- a/bash/bash_logout +++ b/bash/bash_logout @@ -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 diff --git a/bash/bash_profile b/bash/bash_profile index 07603a0e8..d272491aa 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -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 diff --git a/bash/bashrc b/bash/bashrc index 68aef450e..8f27a2ae7 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -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 diff --git a/bash/bashrc.host b/bash/bashrc.host index d5e6b91a8..5b71d683e 100644 --- a/bash/bashrc.host +++ b/bash/bashrc.host @@ -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." diff --git a/bash/path b/bash/path index 1659c246d..23719ed8d 100644 --- a/bash/path +++ b/bash/path @@ -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 diff --git a/bash/prompt.sh b/bash/prompt.sh index 95c4a3c18..984421832 100755 --- a/bash/prompt.sh +++ b/bash/prompt.sh @@ -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 diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 000000000..181a5a011 --- /dev/null +++ b/nvim/init.lua @@ -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') diff --git a/nvim/lua/autocompletion.lua b/nvim/lua/autocompletion.lua new file mode 100644 index 000000000..705e95ecd --- /dev/null +++ b/nvim/lua/autocompletion.lua @@ -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", "", "compe#confirm({ 'keys': '', 'select': v:true })", { expr = true }) diff --git a/nvim/lua/automations.lua b/nvim/lua/automations.lua new file mode 100644 index 000000000..906d3c3f8 --- /dev/null +++ b/nvim/lua/automations.lua @@ -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 }) + diff --git a/nvim/lua/folding.lua b/nvim/lua/folding.lua new file mode 100644 index 000000000..aece7d2c5 --- /dev/null +++ b/nvim/lua/folding.lua @@ -0,0 +1,16 @@ +require('fold-cycle').setup({ + open_if_closed = true, + close_if_opened = true, + softwrap_movement_fix = true, +}) +vim.keymap.set('n', '', + function() return require('fold-cycle').open() end, + {silent = true, desc = 'Fold-cycle: open folds'}) +vim.keymap.set('n', '', + 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()" diff --git a/nvim/lua/generic.lua b/nvim/lua/generic.lua new file mode 100644 index 000000000..8cac1a16e --- /dev/null +++ b/nvim/lua/generic.lua @@ -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 i mmgg=G`m +vim.g.mapleader = ',' +vim.g.maplocalleader = '\\' +vim.keymap.set("i", "kj", "", { 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 + diff --git a/nvim/lua/lsp-config.lua b/nvim/lua/lsp-config.lua new file mode 100644 index 000000000..5d6e1c2c6 --- /dev/null +++ b/nvim/lua/lsp-config.lua @@ -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 <lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'tab split | lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', 't', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.diagnostic.open_float(0, {{opts2}, scope="line", border="rounded"})', opts) + buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev({ float = { border = "rounded" }})', opts) + buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next({ float = { border = "rounded" }})', opts) + buf_set_keymap("n", "q", "lua vim.diagnostic.setloclist({open = true})", opts) + -- Set some keybinds conditional on server capabilities + if client.resolved_capabilities.document_formatting then + buf_set_keymap("n", "lf", "lua vim.lsp.buf.formatting()", opts) + end + if client.resolved_capabilities.document_range_formatting then + buf_set_keymap("n", "lf", "lua vim.lsp.buf.formatting()", 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', '', + function() return require('fold-cycle').open() end, + {silent = true, desc = 'Fold-cycle: open folds'}) +vim.keymap.set('n', '', + 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() +]]) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 000000000..dc790a0ce --- /dev/null +++ b/nvim/lua/plugins.lua @@ -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) diff --git a/nvim/lua/settings.lua b/nvim/lua/settings.lua new file mode 100644 index 000000000..2367e6b5c --- /dev/null +++ b/nvim/lua/settings.lua @@ -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\+\%#\@i mmgg=G`m +vim.g.mapleader = ',' +vim.g.maplocalleader = '\\' +vim.keymap.set("i", "kj", "", { silent = true }) + +-- Configure tabline +vim.cmd([[ +set showtabline=2 +let g:tablabel = "%N%{flagship#tabmodified()} %{flagship#tabcwds('shorten',',')}" +]]) diff --git a/nvim/lua/treesitter.lua b/nvim/lua/treesitter.lua new file mode 100644 index 000000000..bb8a464a8 --- /dev/null +++ b/nvim/lua/treesitter.lua @@ -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 = {}, + }, +} diff --git a/sway/bindings b/sway/bindings index d0a8688c8..211803178 100644 --- a/sway/bindings +++ b/sway/bindings @@ -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" } diff --git a/sway/sway-displays.json b/sway/sway-displays.json index 24017fb3a..1d23cd46c 100644 --- a/sway/sway-displays.json +++ b/sway/sway-displays.json @@ -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 + } + } } ] diff --git a/waybar/style.css b/waybar/style.css index 72bb34113..da9f5f65d 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -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 */ diff --git a/wofi/sidebar b/wofi/sidebar index d7508fa0a..6a39a0154 100644 --- a/wofi/sidebar +++ b/wofi/sidebar @@ -1,4 +1,4 @@ width=500 location=3 yoffset=-3 -height=97% +height=100%