diff --git a/.config/nvim/.DS_Store b/.config/nvim/.DS_Store new file mode 100644 index 0000000..4c889e0 Binary files /dev/null and b/.config/nvim/.DS_Store differ diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..d547881 --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1 @@ +packer_compiled.lua diff --git a/.config/nvim/README.md b/.config/nvim/README.md new file mode 100644 index 0000000..4a8573b --- /dev/null +++ b/.config/nvim/README.md @@ -0,0 +1,18 @@ +## Step one +install ripgrep: `brew install ripgrep` + +install `packer` (find install on their github repo) + +## Step two +open nvim anywhere. `nvim .` + +## Step three +run `:PackerSync` + +## Step four +go ahead and play around in the remaps. + +the vim related keymaps in are in the remaps.lua file. however, all +plugin related remaps are in their respective files. + + diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua new file mode 100644 index 0000000..e951900 --- /dev/null +++ b/.config/nvim/after/plugin/colors.lua @@ -0,0 +1,10 @@ + +require('onedark').setup { + style = 'deep' +} +require('onedark').load() + +function theme_solarized(color) + color = color or "solarized" + vim.cmd.colorscheme(color) +end diff --git a/.config/nvim/after/plugin/flutter.lua b/.config/nvim/after/plugin/flutter.lua new file mode 100644 index 0000000..484fa63 --- /dev/null +++ b/.config/nvim/after/plugin/flutter.lua @@ -0,0 +1 @@ +require("flutter-tools").setup {} -- use defaults diff --git a/.config/nvim/after/plugin/fugitive.lua b/.config/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..8abeb24 --- /dev/null +++ b/.config/nvim/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set('n', 'gg', function() vim.cmd('Git') end, {}) diff --git a/.config/nvim/after/plugin/harpoon.lua b/.config/nvim/after/plugin/harpoon.lua new file mode 100644 index 0000000..aa9db2b --- /dev/null +++ b/.config/nvim/after/plugin/harpoon.lua @@ -0,0 +1,14 @@ +local harpoon = require("harpoon") +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +harpoon.setup({ + mark_branch = true, +}) + +vim.keymap.set("n", "", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..8a55ade --- /dev/null +++ b/.config/nvim/after/plugin/lsp.lua @@ -0,0 +1,147 @@ +local lsp = require("lsp-zero") +local lsp_config = require('lspconfig') + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'tsserver' +}) + +-- Fix Undefined global 'vim' +lsp.configure('sumneko_lua', { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } +}) + + +local cmp = require('cmp') +local cmp_select = { behavior = cmp.SelectBehavior.Select } +local cmp_mappings = lsp.defaults.cmp_mappings({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), +}) + +cmp_mappings[''] = nil +cmp_mappings[''] = nil + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.set_preferences({ + suggest_lsp_servers = true, + sign_icons = { + error = 'E', + warn = 'W', + hint = 'H', + info = 'I' + } +}) + +local on_attach = function(client, bufnr) + local opts = { buffer = bufnr, remap = false } + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "lg", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "la", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "lf", function() vim.lsp.buf.format() end, opts) + vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) +end + + +lsp.on_attach(on_attach) + +lsp_config["dartls"].setup({ + on_attach = on_attach, + root_dir = lsp_config.util.root_pattern('.git'), + settings = { + dart = { + analysisExcludedFolders = { + vim.fn.expand("$HOME/AppData/Local/Pub/Cache"), + vim.fn.expand("$HOME/.pub-cache"), + vim.fn.expand("/opt/homebrew/"), + vim.fn.expand("$HOME/tools/flutter/"), + }, + updateImportsOnRename = true, + completeFunctionCalls = true, + showTodos = true, + } + }, +}) + +lsp.skip_server_setup({ 'rust_analyzer' }) +lsp.setup() + +vim.diagnostic.config({ + virtual_text = true, + update_in_insert = false, + underline = true, + severity_sort = false, + float = true, +}) + +-- RUST SETUP +local rt = require("rust-tools") + +-- Set up lspconfig. +local capabilities = require('cmp_nvim_lsp').default_capabilities() +-- Replace with each lsp server you've enabled. +require('lspconfig')['rust_analyzer'].setup { + capabilities = capabilities +} + +-- Configure LSP through rust-tools.nvim plugin. +-- rust-tools will configure and enable certain LSP features for us. +-- See https://github.com/simrat39/rust-tools.nvim#configuration +rt.setup({ + server = { + capabilities = capabilities, + + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "la", rt.code_action_group.code_action_group, { buffer = bufnr }) + vim.keymap.set("n", "lg", vim.diagnostic.open_float, { buffer = bufnr }) + vim.keymap.set("n", "lf", vim.lsp.buf.format, { buffer = bufnr }) + end, + + settings = { + -- to enable rust-analyzer settings visit: + -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc + ["rust-analyzer"] = { + diagnostics = { + enable = true, + experimental = { + enable = true + } + }, + -- -- enable clippy on save + checkOnSave = { + command = "clippy", + }, + cargo = { + -- to enable include! macro being read + -- loadOutDirsFromCheck = true, + buildScripts = { + -- to enable build scripts being read + enable = true + }, + }, + }, + }, + }, +}) diff --git a/.config/nvim/after/plugin/lualine.lua b/.config/nvim/after/plugin/lualine.lua new file mode 100644 index 0000000..6629c4d --- /dev/null +++ b/.config/nvim/after/plugin/lualine.lua @@ -0,0 +1,13 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'codedark', + }, + sections = { + lualine_a = { + { 'filename', + path = 1, + } + } + } +} diff --git a/.config/nvim/after/plugin/startup.lua b/.config/nvim/after/plugin/startup.lua new file mode 100644 index 0000000..df13f12 --- /dev/null +++ b/.config/nvim/after/plugin/startup.lua @@ -0,0 +1 @@ +require("startup").setup({theme = "dashboard"}) diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua new file mode 100755 index 0000000..708486e --- /dev/null +++ b/.config/nvim/after/plugin/telescope.lua @@ -0,0 +1,25 @@ +local builtin = require('telescope.builtin') + +require('telescope').setup { + defaults = { + mappings = { + -- normal mode + n = { + [''] = require('telescope.actions').delete_buffer + }, + -- insert mode + i = { + [''] = require('telescope.actions').delete_buffer + } + } + }, +} + +vim.keymap.set('n', 'f', builtin.find_files, {}) +vim.keymap.set('n', 'sw', builtin.live_grep, {}) +vim.keymap.set('n', 'sr', builtin.lsp_references, {}) +vim.keymap.set('n', 'ss', builtin.lsp_document_symbols, {}) +vim.keymap.set('n', 'st', builtin.lsp_workspace_symbols, {}) +vim.keymap.set('n', 'sd', builtin.diagnostics, {}) +vim.keymap.set('n', 'so', builtin.buffers, {}) +vim.keymap.set('n', 's/', builtin.current_buffer_fuzzy_find, {}) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..b891aff --- /dev/null +++ b/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,23 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "javascript", "typescript", "c", "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 = false, + }, +} + diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..97bb7ab --- /dev/null +++ b/.config/nvim/after/plugin/undotree.lua @@ -0,0 +1,2 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + diff --git a/.config/nvim/after/plugin/zenmode.lua b/.config/nvim/after/plugin/zenmode.lua new file mode 100644 index 0000000..efa7d2e --- /dev/null +++ b/.config/nvim/after/plugin/zenmode.lua @@ -0,0 +1,13 @@ +require("zen-mode").setup { + window = { + width = 100, + options = { + number = true, + relativenumber = true, + } + }, +} + +vim.keymap.set("n", "zz", function() + require("zen-mode").toggle() +end) diff --git a/.config/nvim/dev b/.config/nvim/dev new file mode 100755 index 0000000..6f51fbc --- /dev/null +++ b/.config/nvim/dev @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +rm -rf ~/.config/nvim +ln -s $(pwd) ~/.config/nvim + diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..500a402 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require("talksik") diff --git a/.config/nvim/lua/talksik/init.lua b/.config/nvim/lua/talksik/init.lua new file mode 100644 index 0000000..22d64de --- /dev/null +++ b/.config/nvim/lua/talksik/init.lua @@ -0,0 +1,34 @@ +require("talksik.packer") +require("talksik.set") +require("talksik.remap") + +local augroup = vim.api.nvim_create_augroup +local talksikGroup = augroup('talksik', {}) + +local autocmd = vim.api.nvim_create_autocmd +local yank_group = augroup('HighlightYank', {}) + +function R(name) + require("plenary.reload").reload_module(name) +end + +autocmd('TextYankPost', { + group = yank_group, + pattern = '*', + callback = function() + vim.highlight.on_yank({ + higroup = 'IncSearch', + timeout = 40, + }) + end, +}) + +autocmd({"BufWritePre"}, { + group = talksikGroup, + pattern = "*", + command = [[%s/\s\+$//e]], +}) + +vim.g.netrw_browse_split = 0 +vim.g.netrw_banner = 0 +vim.g.netrw_winsize = 25 diff --git a/.config/nvim/lua/talksik/packer.lua b/.config/nvim/lua/talksik/packer.lua new file mode 100644 index 0000000..7bce1fa --- /dev/null +++ b/.config/nvim/lua/talksik/packer.lua @@ -0,0 +1,101 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + use('nvim-lua/plenary.nvim') + + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + -- or , branch = '0.1.x', + requires = { { 'nvim-lua/plenary.nvim' } } + } + + use({ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }) + use('nvim-treesitter/playground') + use('mbbill/undotree') + + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + requires = { + -- LSP Support + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, + + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, + + -- Snippets + { 'L3MON4D3/LuaSnip' }, + { 'rafamadriz/friendly-snippets' }, + } + } + + use("folke/zen-mode.nvim") + use("github/copilot.vim") + use("eandrju/cellular-automaton.nvim") + + use("nvim-tree/nvim-web-devicons") + + use { + 'nvim-lualine/lualine.nvim', + } + + use("f-person/git-blame.nvim") + use("wellle/context.vim") + + use { + 'numToStr/Comment.nvim', + config = function() + require('Comment').setup() + end + } + + -- Adds extra functionality over rust analyzer + use("simrat39/rust-tools.nvim") + + use("ThePrimeagen/harpoon") + + -- themes + use('shaunsingh/solarized.nvim') + use('navarasu/onedark.nvim') + + use('nvim-lua/lsp-status.nvim') + + use { + "startup-nvim/startup.nvim", + requires = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"}, + } + + use('RobertBrunhage/flutter-riverpod-snippets') + use('Neevash/awesome-flutter-snippets') + + use { + 'akinsho/flutter-tools.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- optional for vim.ui.select + }, + } + + use({ + "iamcco/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end, + }) + + use('peterhoeg/vim-qml') + + use('tpope/vim-fugitive') +end) + diff --git a/.config/nvim/lua/talksik/remap.lua b/.config/nvim/lua/talksik/remap.lua new file mode 100755 index 0000000..d0ad305 --- /dev/null +++ b/.config/nvim/lua/talksik/remap.lua @@ -0,0 +1,57 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "e", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "nzzzv") +vim.keymap.set("n", "", "Nzzzv") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +vim.keymap.set("n", "*", "*zz") + +-- cycle through current and last buffer +vim.keymap.set("n", "b", "zz") + +vim.keymap.set("n", "vwm", function() + require("vim-with-me").StartVimWithMe() +end) +vim.keymap.set("n", "svwm", function() + require("vim-with-me").StopVimWithMe() +end) + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "", "") + +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); +vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); + + +-- go to different buffers with C hjkl +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "j") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "l") + diff --git a/.config/nvim/lua/talksik/set.lua b/.config/nvim/lua/talksik/set.lua new file mode 100644 index 0000000..b124ade --- /dev/null +++ b/.config/nvim/lua/talksik/set.lua @@ -0,0 +1,36 @@ + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + +vim.leader = " " + +-- case insensitive searching UNLESS /C or capital in searching +vim.opt.ignorecase = true + diff --git a/.config/nvim/nvim.appimage b/.config/nvim/nvim.appimage new file mode 100755 index 0000000..9e8c135 Binary files /dev/null and b/.config/nvim/nvim.appimage differ