diff --git a/dotfiles/.config/nvim/autocommands.vim b/dotfiles/.config/nvim/autocommands.vim index 4a397fd..d6c62e1 100644 --- a/dotfiles/.config/nvim/autocommands.vim +++ b/dotfiles/.config/nvim/autocommands.vim @@ -1,3 +1,9 @@ +" This makes the location of the current open file always the current working +" directory of vim. This pairs very nicely with tmux. Added - Sept 15th 2020 +autocmd BufEnter * lcd %:p:h + + + augroup vyper_ft au! autocmd BufNewFile,BufRead *.vy set syntax=vyper diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim index 183b97c..1dc7c15 100644 --- a/dotfiles/.config/nvim/init.vim +++ b/dotfiles/.config/nvim/init.vim @@ -6,13 +6,13 @@ runtime coc.vim runtime keys.vim " Check code as python3 by default -let g:neomake_python_python_maker = neomake#makers#ft#python#python() -let g:neomake_python_flake8_maker = neomake#makers#ft#python#flake8() -let g:neomake_python_python_maker.exe = 'python3 -m py_compile' -let g:neomake_python_flake8_maker.exe = 'python3 -m flake8' +" let g:neomake_python_python_maker = neomake#makers#ft#python#python() +" let g:neomake_python_flake8_maker = neomake#makers#ft#python#flake8() +" let g:neomake_python_python_maker.exe = 'python3 -m py_compile' +" let g:neomake_python_flake8_maker.exe = 'python3 -m flake8' " Disable error messages inside the buffer, next to the problematic line -let g:neomake_virtualtext_current_error = 1 +" let g:neomake_virtualtext_current_error = 1 "------------------------------------------------------------------------------ " Shawn Anderson as of September 30th 2020 @@ -43,9 +43,4 @@ inoremap nnoremap nnoremap -:set cursorline -:set number -:set relativenumber! -:set autoread - let g:coc_global_extensions = ['coc-json', 'coc-git', 'coc-tsserver', 'coc-pyright', 'coc-solidity'] diff --git a/dotfiles/.config/nvim/keys.vim b/dotfiles/.config/nvim/keys.vim index 9bdfd6f..ea46e8f 100644 --- a/dotfiles/.config/nvim/keys.vim +++ b/dotfiles/.config/nvim/keys.vim @@ -1,18 +1,52 @@ +"------------------------------------------------------------------------------ +" Use comma for leader +let mapleader = "," "------------------------------------------------------------------------------ -" Inherited from MattCoding4Days -" remap default leader key to comma -let mapleader = "," -nnoremap r :source $MYVIMRC +" Shawn Anderson as of September 30th 2020 +noremap f 0 +noremap j $ + +" Highlight search +map / :nohl + +" Faster scrolling with control +noremap jj +noremap kk + +" Spookie bug. I think I was hacked and that someone i fucking with me. +" Whenever I would pres shift K it would open a new tab in nvim. +" inoremap +" inoremap + +" Here, I borrow some mappings from readline! These are great, google +" `readline cheatsheet` I map alt-a to home because I use ctr-a for tmux +" leader. +inoremap +inoremap +inoremap +inoremap +nnoremap +nnoremap + + + +" Edit Vim Config File nnoremap e :e $MYVIMRC -nnoremap w :w -nnoremap i :w:source $MYVIMRC:PlugInstall +" Source Vim Config File +nnoremap r :source $MYVIMRC +" Save file +"nnoremap w :w +" Install Plugins +"nnoremap i :w:source $MYVIMRC:PlugInstall + +" Nerd Tree!!! (I think) " Change Ctrl N mapping to Ctrl Space " inoremap - +" Clip Board!!! " " Copy to clipboard vnoremap y "+y nnoremap Y "+yg_ @@ -26,27 +60,27 @@ vnoremap p "+p vnoremap P "+P -" tab navigation mappings +" Tab navigation mappings " New tab -map :tabnew -imap :tabnew +" map :tabnew +" imap :tabnew " Close tab -map :tabclose -imap :tabclose +" map :tabclose +" imap :tabclose " Move Right -map :tabn -imap :tabn -map :tabn -imap :tabn +" map :tabn +" imap :tabn +" map :tabn +" imap :tabn " Move Left -map :tabp -imap :tabp -map :tabp -imap :tabp +" map :tabp +" imap :tabp +" map :tabp +" imap :tabp " clear search results nnoremap // :noh diff --git a/dotfiles/.config/nvim/lua/plugins/example.lua b/dotfiles/.config/nvim/lua/plugins/example.lua new file mode 100644 index 0000000..21ca43a --- /dev/null +++ b/dotfiles/.config/nvim/lua/plugins/example.lua @@ -0,0 +1,266 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +-- if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/dotfiles/.config/nvim/settings.vim b/dotfiles/.config/nvim/settings.vim index 03758cc..8b409dc 100644 --- a/dotfiles/.config/nvim/settings.vim +++ b/dotfiles/.config/nvim/settings.vim @@ -1,39 +1,69 @@ " ------------------------------------------------------------------------------ " Neoconfig by Shawn Anderson starting September 30 2020 + +set cursorline +set autoread + +" ignores case of letters on searches +set ignorecase + +" Override the 'ignorecase' option if the search pattern contains upper case characters +set smartcase + +" Follow the open file set autochdir + +" Don't produce swap files set noswapfile -set tags=tags -" -" ------------------------------------------------------------------------------ -" These are inherited from MattCoding4Days -"" Make vim scroll faster + +" Something about tags... going to get away from tags. +"set tags=tags + +" Make vim scroll faster set ttyfast " Removed in Nvim " -set mouse=a + +" Finish updates before redrawing screen set lazyredraw -set nu + +" Mouse support All +set mouse=a + +" Line Numbers +set number + +" Relative line numbers +set relativenumber! + +" No line wrap set nowrap -set relativenumber + +" Encoding set encoding=UTF-8 + " set tabline to (not) display full path -set guitablabel=%F +" set guitablabel=%F " Set to remove + +" Always display tabline set showtabline=2 -" tabs and spaces handling -set expandtab -set tabstop=4 +" Tabs and spaces handling +set expandtab " Uses spaces instead of tabs +set tabstop=4 " Number of spaces per tab " set softtabstop=4 set shiftwidth=4 -" remove ugly vertical lines on window division + + +" Windowing Splitting +" Remove ugly vertical lines on window division set fillchars+=vert:\ -" autocompletion of files and commands behaves like shell +" Autocompletion of files and commands behaves like shell " (complete only the common part, list the options that match) set wildmode=list:longest " when scrolling, keep cursor 3 lines away from screen border set scrolloff=3 - " fix problems with uncommon shells (fish, xonsh) and plugins running commands " (neomake, ...) set shell=$SHELL diff --git a/dotfiles/.config/nvim/themes.vim b/dotfiles/.config/nvim/themes.vim index cc6f5ca..c3ba380 100644 --- a/dotfiles/.config/nvim/themes.vim +++ b/dotfiles/.config/nvim/themes.vim @@ -1,4 +1,3 @@ - "" Color Scheme set up for Material =============================== if (has("nvim")) "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >