diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..03475f3 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,15 @@ +--require('plugins.nord') +require('user.settings') +require('user.plugins') +require('user.keys') +require('plugins.lspconfig') +require('plugins.null-ls') +require('plugins.cmp') +require('plugins.lualine') +require('plugins.inlayhints') +require('plugins.gitsigns') +require('plugins.coverage') +require('plugins.treesitter') +require('plugins.eslint') +require('plugins.dap') +require('plugins.neotest') diff --git a/.config/nvim/lua/init.lua b/.config/nvim/lua/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..31168e2 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,84 @@ +vim.opt.completeopt = {'menu', 'menuone', 'noselect', 'preview'} + +require('luasnip.loaders.from_vscode').lazy_load() + +local cmp = require('cmp') +local luasnip = require('luasnip') + +local select_opts = {behavior = cmp.SelectBehavior.Select} + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lsp_signature_help'}, + {name = 'buffer'}, + {name = 'luasnip'}, + }, + window = { + documentation = cmp.config.window.bordered() + }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu_icon = { + nvim_lsp = 'λ', + nvim_lsp_signature_help = 'λ', + luasnip = '⋗', + buffer = 'Ω', + path = '🖫', + } + + item.menu = menu_icon[entry.source.name] + return item + end, + }, + mapping = { + [''] = cmp.mapping.select_prev_item(select_opts), + [''] = cmp.mapping.select_next_item(select_opts), + + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({select = false}), + + [''] = cmp.mapping(function(fallback) + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, {'i', 's'}), + + [''] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, {'i', 's'}), + + [''] = cmp.mapping(function(fallback) + local col = vim.fn.col('.') - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + fallback() + else + cmp.complete() + end + end, {'i', 's'}), + + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item(select_opts) + else + fallback() + end + end, {'i', 's'}), + }, +}) diff --git a/.config/nvim/lua/plugins/coverage.lua b/.config/nvim/lua/plugins/coverage.lua new file mode 100644 index 0000000..4859799 --- /dev/null +++ b/.config/nvim/lua/plugins/coverage.lua @@ -0,0 +1,5 @@ +local cov = require("coverage") +cov.setup() +vim.keymap.set('n', 'cl', function() cov.load(true) end) +vim.keymap.set('n', 'cc', cov.clear) +vim.keymap.set('n', 'cs', cov.summary) diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..48dcb26 --- /dev/null +++ b/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,29 @@ + + +require("dap-vscode-js").setup({ + -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" + -- debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", -- Path to vscode-js-debug installation. + -- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. + adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap + -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging + -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging. + -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output. +}) + +for _, language in ipairs({ "typescript", "javascript" }) do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "attach", + name = "Attach", + port = 9229, + cwd = "${workspaceFolder}", + }, + } +end + +local dapui = require('dapui') +dapui.setup() +require("nvim-dap-virtual-text").setup() + +vim.keymap.set('n', 'du', dapui.toggle) diff --git a/.config/nvim/lua/plugins/eslint.lua b/.config/nvim/lua/plugins/eslint.lua new file mode 100644 index 0000000..54b808c --- /dev/null +++ b/.config/nvim/lua/plugins/eslint.lua @@ -0,0 +1,24 @@ +local null_ls = require("null-ls") +local eslint = require("eslint") + +null_ls.setup() + +eslint.setup({ + bin = 'eslint_d', -- or `eslint_d` + code_actions = { + enable = true, + apply_on_save = { + enable = true, + types = { "directive", "problem", "suggestion", "layout" }, + }, + disable_rule_comment = { + enable = true, + location = "separate_line", -- or `same_line` + }, + }, + diagnostics = { + enable = true, + report_unused_disable_directives = false, + run_on = "type", -- or `save` + }, +}) diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..3b6a191 --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,10 @@ +local gs = require('gitsigns') +gs.setup({ + current_line_blame_opts = { + delay = 0, + }, + on_attach = function(bufnr) + -- Toggle blame hint with Ctrl+B + vim.keymap.set('n', '', gs.toggle_current_line_blame) + end +}) diff --git a/.config/nvim/lua/plugins/inlayhints.lua b/.config/nvim/lua/plugins/inlayhints.lua new file mode 100644 index 0000000..2b93199 --- /dev/null +++ b/.config/nvim/lua/plugins/inlayhints.lua @@ -0,0 +1,28 @@ +require('lsp-inlayhints').setup({ + inlay_hints = { + parameter_hints = { + show = false + }, + type_hints = { + remove_colon_start = true, + remove_colon_end = true + }, + max_len_align = false, + highlight = "Comment", + }, + enabled_at_startup = false, +}) + +vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_inlayhints", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + require("lsp-inlayhints").on_attach(client, bufnr) + end, +}) diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..9687c51 --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,36 @@ +local lspconfig = require('lspconfig') +local lsp_defaults = lspconfig.util.default_config + +lsp_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() +) + +require'lspconfig'.tsserver.setup({ + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + } + } +}) + diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..4df4e94 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,9 @@ +local setup = function() + require('lualine').setup({ + options = { + theme = 'nord' + } + }) +end + +return { setup = setup } diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua new file mode 100644 index 0000000..3398d13 --- /dev/null +++ b/.config/nvim/lua/plugins/neotest.lua @@ -0,0 +1,12 @@ +require('neotest').setup { + adapters = { + require('neotest-jest')({ + jestCommand = "pnpm test --", + env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }), + require 'neotest-plenary', + } +} diff --git a/.config/nvim/lua/plugins/nord.lua b/.config/nvim/lua/plugins/nord.lua new file mode 100644 index 0000000..1366791 --- /dev/null +++ b/.config/nvim/lua/plugins/nord.lua @@ -0,0 +1 @@ +require('nord').setup() diff --git a/.config/nvim/lua/plugins/null-ls.lua b/.config/nvim/lua/plugins/null-ls.lua new file mode 100644 index 0000000..dbddb26 --- /dev/null +++ b/.config/nvim/lua/plugins/null-ls.lua @@ -0,0 +1,9 @@ +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.completion.spell, + }, +}) diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..4eee009 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,22 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "typescript", "lua", "rust" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- 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 = true, + }, +} diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua new file mode 100644 index 0000000..97a154b --- /dev/null +++ b/.config/nvim/lua/user/keys.lua @@ -0,0 +1,14 @@ + +-- Fuzzy switch +vim.keymap.set('n', '', ':Files') +vim.keymap.set('n', '', ':Buffers') + +vim.keymap.set("n", "xx", "TroubleToggle", + {silent = true, noremap = true} +) + +vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end) +vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end) +vim.keymap.set("n", "gi", function() vim.lsp.buf.implementation() end) + +vim.keymap.set("n", "tt", function() require('lsp-inlayhints').toggle() end) diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua new file mode 100644 index 0000000..7986e86 --- /dev/null +++ b/.config/nvim/lua/user/plugins.lua @@ -0,0 +1,107 @@ +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +local packer_bootstrap = ensure_packer() + +return require('packer').startup(function() + -- Packer manages itself + use 'wbthomason/packer.nvim' + + -- LSP Magic + use 'neovim/nvim-lspconfig' + + -- Inlay type hints, i.e. type hints merged into codelines + use 'lvimuser/lsp-inlayhints.nvim' + + -- CMP + use 'L3MON4D3/LuaSnip' + use { + 'saadparwaiz1/cmp_luasnip', + requires = { 'L3MON4D3/LuaSnip' }, + } + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use 'hrsh7th/cmp-nvim-lsp-signature-help' + use { + 'hrsh7th/nvim-cmp', + requires = { 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp' }, + } + + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true }, + } + + --use 'vim-airline/vim-airline' + --use 'vim-airline/vim-airline-themes' + use 'lewis6991/gitsigns.nvim' + use 'junegunn/fzf.vim' + use 'udalov/kotlin-vim' + use 'rust-lang/rust.vim' + use 'zivyangll/git-blame.vim' + use 'arcticicestudio/nord-vim' + --use 'gbprod/nord.nvim' + use 'hashivim/vim-terraform' + use 'chaoren/vim-wordmotion' + use 'cappyzawa/starlark.vim' + use 'editorconfig/editorconfig-vim' + + use({ + "andythigpen/nvim-coverage", + requires = "nvim-lua/plenary.nvim", + }) + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + use 'jose-elias-alvarez/null-ls.nvim' + use 'muniftanjim/eslint.nvim' + use 'kyazdani42/nvim-web-devicons' + use { + 'folke/trouble.nvim', + requires = 'kyazdani42/nvim-web-devicons', + config = function() + require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + end + } + use { + "nvim-neotest/neotest", + requires = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + 'nvim-neotest/neotest-plenary', + 'antoinemadec/FixCursorHold.nvim', + 'haydenmeade/neotest-jest', + } + } + + use 'mfussenegger/nvim-dap' + use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } + use { "mxsdev/nvim-dap-vscode-js", requires = {"mfussenegger/nvim-dap"} } + use { + "microsoft/vscode-js-debug", + opt = true, + run = "npm install --legacy-peer-deps && npm run compile" + } + use 'theHamsta/nvim-dap-virtual-text' + + use 'wakatime/vim-wakatime' + + if packer_bootstrap then + require('packer').sync() + end +end) diff --git a/.config/nvim/lua/user/settings.lua b/.config/nvim/lua/user/settings.lua new file mode 100644 index 0000000..d4b40d8 --- /dev/null +++ b/.config/nvim/lua/user/settings.lua @@ -0,0 +1,65 @@ + +vim.cmd[[colorscheme nord]] +vim.cmd[[syntax enable]] + +-- Switch leader to minus +vim.g.mapleader = '-' + +-- Default to utf-8 unix +vim.opt.encoding = 'utf-8' +vim.opt.fileformats = 'unix,dos' + +-- Skip swaps +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.swapfile = false + +-- Blink matching brackets +vim.opt.showmatch = true + +-- Allow hidden buffers +vim.opt.hidden = true + +-- Line numbers +vim.opt.number = true + +-- Marker line at 80 and 120 char and enable ruler +vim.opt.cc = '80,120' +vim.opt.ruler = true + +-- Prevent mouse from selecting numbers +vim.opt.mouse = 'a' + +-- Show Tab characters and trailing whitespace +vim.opt.list = true +vim.opt.listchars='tab:▒░,trail:▓' + +-- Space-indentation please +vim.opt.expandtab = true +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 4 +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'typescript', 'typescriptreact', 'json', 'javascript' }, + command = 'setlocal shiftwidth=2 softtabstop=2 expandtab', +}) + +-- Smart searching +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true +vim.opt.hlsearch = true + +-- Support backspace across lines +vim.opt.backspace = 'indent,eol,start' + +-- Ripgrep FZF +vim.cmd[[function! RipgrepFzf(query, fullscreen) + let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' + let initial_command = printf(command_fmt, shellescape(a:query)) + let reload_command = printf(command_fmt, '{q}') + let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} + call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) +endfunction +]] + +vim.cmd[[command! -nargs=* -bang RG call RipgrepFzf(, 0)]] diff --git a/.config/nvim/old.init.vim b/.config/nvim/old.init.vim new file mode 100644 index 0000000..0003aeb --- /dev/null +++ b/.config/nvim/old.init.vim @@ -0,0 +1,192 @@ + +lua require('plugins') + +" Specify a directory for plugins +" - For Neovim: stdpath('data') . '/plugged' +" - Avoid using standard Vim directory names like 'plugin' +" call plug#begin('~/.vim/plugged') + +" Make sure you use single quotes + +"Plug 'vim-airline/vim-airline' +"Plug 'vim-airline/vim-airline-themes' +"Plug 'sickill/vim-monokai' +"Plug 'airblade/vim-gitgutter' +"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +"Plug 'junegunn/fzf.vim' +"Plug 'udalov/kotlin-vim' +"Plug 'rust-lang/rust.vim' +"Plug 'zivyangll/git-blame.vim' +"Plug 'mfukar/robotframework-vim' +"" Plug 'dense-analysis/ale' +"Plug 'arcticicestudio/nord-vim' +"Plug 'eliba2/vim-node-inspect' +"Plug 'hashivim/vim-terraform' +"Plug 'chaoren/vim-wordmotion' +"Plug 'cappyzawa/starlark.vim' +"Plug 'editorconfig/editorconfig-vim' +" +"" Initialize plugin system +"call plug#end() + +" Coloring +syntax enable +colorscheme nord + +" Airline +let g:airline#extensions#tabline#enabled = 1 +let g:airline_powerline_fonts = 1 +let g:airline_theme='nord' + +" -- Buffer/Window Workflow +" Allow hidden buffers +set hidden + +" Line numbers +set number + +" Marker line at col 80 +set cc=80 + +" Stop mouse from selecting numbers +set mouse=a + +" Show tab characters +set list +set listchars=tab:▒░,trail:▓ + +" Space-indentation please +set expandtab +set shiftwidth=4 +set tabstop=4 +autocmd FileType typescript setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType typescriptreact setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType json setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab + +" Default to UTF-8 encoding +set encoding=utf-8 + +" Some languages have different indentation preferences. Try to use them. +filetype plugin indent on + +" Don't try to be Vi compatible. Just stick to Vim! +set nocompatible + +" Allow backspace to always work, across linebreaks/indentation etc. +set backspace=indent,eol,start + +" Blink matching bracket +set showmatch + +" We never use octals, but we do use zero-prefixed numbers. +set nrformats-=octal + +" We are fast, don't get stuck in an old aborted command +set ttimeout +set ttimeoutlen=50 + +" Always retain the status line +set laststatus=2 + +" Enable ruler to show column position +set ruler + +" Retain last command in command line +set showcmd + +" Give me a menu for completion in the command line +set wildmenu + +" Stop asking me, just reload the changed file! +set autoread + +" Don't litter backup files. Don't do swaps (we're not that paranoid) +set nobackup +set nowritebackup +set noswapfile + +" Check for file endings +set fileformats=unix,dos + +" Quicky to exit insert mode +inoremap + +" Smartcase search +set ignorecase +set smartcase + +" Incremental search +set incsearch + +" Highlight search +set hlsearch +" Use to clear the highlighting of :set hlsearch. +if maparg('', 'n') ==# '' + nnoremap :nohlsearch +endif + +" +" Plugins config +" + +" Ripgrep FZF +function! RipgrepFzf(query, fullscreen) + let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' + let initial_command = printf(command_fmt, shellescape(a:query)) + let reload_command = printf(command_fmt, '{q}') + let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} + call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) +endfunction + +command! -nargs=* -bang RG call RipgrepFzf(, 0) + +" FZF +nnoremap :Files +nnoremap :Buffers + +" Tabs +nnoremap :tabnext +nnoremap :tabprevious + +" Rust +let g:rustfmt_autosave = 1 + +" Git Blame +nnoremap :call gitblame#echo() + +" JSX +let g:jsx_ext_required = 0 + +" Don't highlight shitty comments in JSON +autocmd FileType json syntax match Comment +\/\/.\+$+ + +" this machine config +if filereadable(expand("~/.vimrc.local")) + source ~/.vimrc.local +endif + +" CTags +set tags+=.tags " We like hidden files +let g:fzf_tags_command = 'ctags -R -f .tags --exclude=@.ctagsignore' + +" ALE +"highlight ALEWarning ctermbg=DarkGrey +"let g:ale_completion_enabled=1 +" +"let g:ale_javascript_eslint_use_global = 1 +"let g:ale_javascript_eslint_executable = 'yarn' +"let g:ale_javascript_eslint_options = 'run eslint' +" +"call ale#linter#Define('typescript', { +"\ 'name': 'tsserver2', +"\ 'lsp': 'tsserver', +"\ 'executable': '/usr/bin/yarn', +"\ 'command': '%e run tsserver', +"\ 'project_root': function('ale#handlers#tsserver#GetProjectRoot'), +"\ 'language': '', +"\}) +" +"let g:ale_linters = { +"\ 'typescript': ['eslint', 'tsserver2'] +"\} diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..8807baa --- /dev/null +++ b/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,295 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/patrick/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/patrick/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/patrick/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/patrick/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/patrick/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["FixCursorHold.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim", + url = "https://github.com/antoinemadec/FixCursorHold.nvim" + }, + LuaSnip = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lsp-signature-help"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help", + url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["editorconfig-vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/editorconfig-vim", + url = "https://github.com/editorconfig/editorconfig-vim" + }, + ["eslint.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/eslint.nvim", + url = "https://github.com/muniftanjim/eslint.nvim" + }, + ["fzf.vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/fzf.vim", + url = "https://github.com/junegunn/fzf.vim" + }, + ["git-blame.vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/git-blame.vim", + url = "https://github.com/zivyangll/git-blame.vim" + }, + ["gitsigns.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, + ["kotlin-vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/kotlin-vim", + url = "https://github.com/udalov/kotlin-vim" + }, + ["lsp-inlayhints.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/lsp-inlayhints.nvim", + url = "https://github.com/lvimuser/lsp-inlayhints.nvim" + }, + ["lualine.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + neotest = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/neotest", + url = "https://github.com/nvim-neotest/neotest" + }, + ["neotest-jest"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/neotest-jest", + url = "https://github.com/haydenmeade/neotest-jest" + }, + ["neotest-plenary"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/neotest-plenary", + url = "https://github.com/nvim-neotest/neotest-plenary" + }, + ["nord-vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nord-vim", + url = "https://github.com/arcticicestudio/nord-vim" + }, + ["null-ls.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + url = "https://github.com/jose-elias-alvarez/null-ls.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-coverage"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-coverage", + url = "https://github.com/andythigpen/nvim-coverage" + }, + ["nvim-dap"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-dap", + url = "https://github.com/mfussenegger/nvim-dap" + }, + ["nvim-dap-ui"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-dap-ui", + url = "https://github.com/rcarriga/nvim-dap-ui" + }, + ["nvim-dap-virtual-text"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-dap-virtual-text", + url = "https://github.com/theHamsta/nvim-dap-virtual-text" + }, + ["nvim-dap-vscode-js"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-dap-vscode-js", + url = "https://github.com/mxsdev/nvim-dap-vscode-js" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["rust.vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/rust.vim", + url = "https://github.com/rust-lang/rust.vim" + }, + ["starlark.vim"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/starlark.vim", + url = "https://github.com/cappyzawa/starlark.vim" + }, + ["trouble.nvim"] = { + config = { "\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0" }, + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/trouble.nvim", + url = "https://github.com/folke/trouble.nvim" + }, + ["vim-terraform"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/vim-terraform", + url = "https://github.com/hashivim/vim-terraform" + }, + ["vim-wakatime"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/vim-wakatime", + url = "https://github.com/wakatime/vim-wakatime" + }, + ["vim-wordmotion"] = { + loaded = true, + path = "/home/patrick/.local/share/nvim/site/pack/packer/start/vim-wordmotion", + url = "https://github.com/chaoren/vim-wordmotion" + }, + ["vscode-js-debug"] = { + loaded = false, + needs_bufread = false, + path = "/home/patrick/.local/share/nvim/site/pack/packer/opt/vscode-js-debug", + url = "https://github.com/microsoft/vscode-js-debug" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: trouble.nvim +time([[Config for trouble.nvim]], true) +try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim") +time([[Config for trouble.nvim]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/.config/waybar/config b/.config/waybar/config index b396e9a..3573b4e 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -24,12 +24,11 @@ "sway/workspaces": { "disable-scroll": true, "all-outputs": true, - "format": "{icon}", + "format": "{icon} {value}", "format-icons": { "1": "", "2": "", - "3": "", - "4": "", + "3": "", "9": "", "urgent": "", "focused": "", diff --git a/.vimrc b/.vimrc index 1040516..da1c71b 100644 --- a/.vimrc +++ b/.vimrc @@ -51,6 +51,8 @@ set listchars=tab:▒░,trail:▓ set expandtab set shiftwidth=4 set tabstop=4 +autocmd FileType typescript setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType typescriptreact setlocal shiftwidth=2 softtabstop=2 expandtab " Default to UTF-8 encoding set encoding=utf-8 diff --git a/.zshrc b/.zshrc index 77bb668..4ce147b 100644 --- a/.zshrc +++ b/.zshrc @@ -2,6 +2,7 @@ zstyle :compinstall filename '/home/patrick/.zshrc' autoload -Uz promptinit && promptinit autoload -Uz compinit && compinit autoload -Uz colors && colors +autoload -Uz bashcompinit && bashcompinit zmodload -i zsh/complist zstyle ':completion:*' accept-exact "*(N)" @@ -35,35 +36,6 @@ fi bindkey '^R' history-incremental-search-backward # Reverse history search -# Enable colors - -# GIT PROMPT -function parse_git_dirty() { - STATUS=$(command git status --porcelain --untracked-files=no | tail -n1) - if [[ -n $STATUS ]]; then - echo "%{$fg[red]%}✘" - else - echo "%{$fg[green]%}✔" - fi -} - -function git_prompt() { - isgit=$(command git rev-parse --is-inside-work-tree 2>/dev/null) - if [[ $isgit == "true" ]]; then - ref=$(command git symbolic-ref HEAD -q --short) - echo "%{$fg[cyan]%}$ref$(parse_git_dirty)%{$reset_color%}" - fi -} - - -# Theme -setopt promptsubst -GIT='$(git_prompt)' -PROMPT="%(?, ,%{$fg[red]%}FAIL%{$reset_color%} -) -%{$fg[green]%}[%*]%{$reset_color%} %m %{$fg[yellow]%}%~%{$reset_color%} $GIT -%_ $ " - # Autocomplete menu bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select @@ -88,6 +60,9 @@ expand-or-complete-with-dots() { zle -N expand-or-complete-with-dots bindkey '^I' expand-or-complete-with-dots +# Starship! +eval "$(starship init zsh)" + HISTFILE=~/.zsh_history HISTSIZE=1000 SAVEHIST=1000 @@ -118,3 +93,7 @@ export FZF_DEFAULT_COMMAND='fd --type f' # RIPGREP export RIPGREP_CONFIG_PATH="${HOME}/.ripgrep" + +# tabtab source for packages +# uninstall by removing these lines +[[ -f ~/.config/tabtab/zsh/__tabtab.zsh ]] && . ~/.config/tabtab/zsh/__tabtab.zsh || true