commit 525475fc205402146e1a81b431c7a5a4a4ee7ea5 Author: Zev Averbach Date: Thu Feb 8 20:48:50 2024 +0100 first diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ef2c20 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Purpose + +Get up and going in Linux with some nice bash aliases, neovim configuration + plugins, and tmux. + +# Prerequisites + + - tmux + - npm or nvm + - neovim 0.8+ + +# Installation + +Symlink the config files to `~/.config/nvim` and `~`, respectively. + + > ln -s $HOME/repos/dotfiles/init.lua $HOME/.config/nvim/init.lua + > ln -s $HOME/repos/dotfiles/vimrc.vim $HOME/.config/nvim/vimrc.vim + > ln -s $HOME/repos/dotfiles/bash_aliases $HOME/.bash_aliases + > ln -s $HOME/repos/dotfiles/tmux.conf $HOME/.tmux.conf + +After Coc is installed, install coc-pyright and pyright: + + # terminal: + > npm install -g pyright + > sudo apt install ripgrep + # inside nvim: + :CocInstall coc-pyright diff --git a/bash_aliases b/bash_aliases new file mode 100644 index 0000000..7c91161 --- /dev/null +++ b/bash_aliases @@ -0,0 +1,24 @@ +alias nvim=~/nvim-linux64/bin/nvim +alias vi=nvim +alias ss='source ~/.bashrc' +alias bb='vi ~/.bashrc' +alias ba='vi ~/.bash_aliases' +alias bs='vi ~/.git_secret' +alias r='cd ~/repos && pwd' +alias vl='vi ~/.config/nvim/init.lua' +alias vv='vi ~/.config/nvim/vimrc.vim' +alias gb='git branch' +alias gl='git log' +alias pp='vi ~/.profile' +alias pg='git pull origin $(git branch --show-current)' +alias gp='git push origin $(git branch --show-current)' +alias gs='git status' +alias gd='git diff' +alias ga='git add --all' +alias l='ls -l' +alias i='ipython' +alias python=python3 + +function gc() { + git commit -m "$1" +} diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2ff69d5 --- /dev/null +++ b/init.lua @@ -0,0 +1,77 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) +vim.opt.colorcolumn = "120" +vim.opt.updatetime = 50 -- improve perf, less frequent swp writes +vim.opt.termguicolors = true +vim.opt.hlsearch = false +vim.opt.incsearch = true +vim.opt.smartindent = true +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +require("lazy").setup({ + "github/copilot.vim", + "folke/tokyonight.nvim", + "tpope/vim-commentary", + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + }, + }, + { + 'nvim-telescope/telescope.nvim', tag = '0.1.5', + dependencies = { 'nvim-lua/plenary.nvim', + 'BurntSushi/ripgrep'} + }, + {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'}, + {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, + {'neovim/nvim-lspconfig'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/nvim-cmp'}, + {'L3MON4D3/LuaSnip'}, + {"neoclide/coc.nvim", branch = 'release'}, + { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + }) + end + }, +}) +require('telescope').setup { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } +} +local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim" +vim.cmd.source(vimrc) +local lsp_zero = require('lsp-zero') + +lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({buffer = bufnr}) +end) +require('lspconfig').pyright.setup({ +virtual_text=false, +}) diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..62e57a1 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,4 @@ +# remap prefix +unbind C-b +set-option -g prefix ` +bind-key ` send-prefix diff --git a/vimrc.vim b/vimrc.vim new file mode 100644 index 0000000..722cc94 --- /dev/null +++ b/vimrc.vim @@ -0,0 +1,48 @@ +set autoindent expandtab tabstop=4 shiftwidth=4 +set hidden + +" When editing a file, always jump to the last known cursor position. +autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif + +nnoremap :w +nnoremap :noh +nnoremap :bn +nnoremap :bp +inoremap :wi +let mapleader=" " +nnoremap w :w:bw +nnoremap W :bw +nnoremap v :e ~/.config/nvim/init.lua +nnoremap r :e ~/.config/nvim/vimrc.vim +nnoremap t :e ~/.tmux.conf +nnoremap x :Sex +nnoremap s :source ~/.config/nvim/init.lua +nnoremap q :xa +nnoremap f Telescope find_files +nnoremap g Telescope live_grep +nnoremap b Telescope buffers +nnoremap h Telescope help_tags +nmap j (coc-diagnostic-prev) +nmap d (coc-diagnostic-next) +inoremap CheckBackspace() ? "\" : "\" + +vnoremap :m '<-2gv=gv +vnoremap :m '>+1gv=gv +nnoremap :m -2 +nnoremap :m +1 + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +colorscheme tokyonight-night + +let g:LanguageClient_useVirtualText = 0 " disable inline errors + +set undodir=~/.config/nvim/undodir +set undofile +set number relativenumber