From 736b7d36fc49c1c16dadc54210a286efb5d644f3 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 4 Jun 2022 13:33:39 +0100 Subject: First step to move to only nvim --- README.md | 25 +++--------- Xresources | 45 +++++++++++++++++++++ init.vim | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- plugins.vim | 90 ++++++++++++++++++++++++++++++++++++++++++ setup | 17 ++++++++ tmux.conf | 2 +- xresources | 42 -------------------- 7 files changed, 270 insertions(+), 78 deletions(-) create mode 100644 Xresources create mode 100644 plugins.vim create mode 100755 setup delete mode 100644 xresources diff --git a/README.md b/README.md index 873f1cc..fd93adf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# My ~/.vim +# My neovim & dot files + +This is a work in progress! Managed by [vim-plug](https://github.com/junegunn/vim-plug). @@ -8,20 +10,9 @@ For further information on installed plugins: ## Using it in a new location -**Since I moved to Tokyo Night theme, vim won't work** - -My repo is in `~/.vim/`! You shouldn't have a `~/.vimrc` or `~/.vim` directory. - - cd && git clone --recursive https://github.com/reidrac/dotvim.git .vim - -Create a `.vimrc` with: +This repo should be in `~/.config/nvim/`! - runtime vimrc - -This can be also be used to customise your local vim configuration without -having uncommitted changes in your repository. - -In case of neovim, you can link the provided `init.vim` into `~/.config/nvim/init.vim`. +git clone --recursive https://github.com/reidrac/dotvim.git ~/.config/nvim Then it is recommended you run: @@ -33,7 +24,7 @@ you can commit and push the updated version. ## Adding plugins -Add a new `Plug` entry in `~/.vim/vimrc`. +Add a new `Plug` entry in `~/.config/plugins.vim`. Then run: @@ -49,7 +40,3 @@ Remove the `Plug` line and run: :PlugClean -## TODO - -- Convert all to lua and support only nvim. - diff --git a/Xresources b/Xresources new file mode 100644 index 0000000..b3abe14 --- /dev/null +++ b/Xresources @@ -0,0 +1,45 @@ +! this may be different in ytour system +Xcursor.theme:Adwaita + +! Sensible defaults +XTerm.vt100.locale: false +XTerm.vt100.utf8: true +XTerm.vt100.scrollTtyOutput: false +XTerm.vt100.scrollKey: true +XTerm.vt100.bellIsUrgent: true +XTerm.vt100.metaSendsEscape: true +! Styling +XTerm.vt100.faceName: JetBrains Mono +XTerm.vt100.boldMode: true +XTerm.vt100.faceSize: 9 +XTerm.vt100.internalBorder: 0 +XTerm.borderWidth: 0 +XTerm.vt100.translations: #override \n\ + Ctrl Shift N: scroll-back(1, halfpage) \n\ + Ctrl Shift T: scroll-forw(1, halfpage) \n\ + Ctrl Shift C: copy-selection(CLIPBOARD) \n\ + Ctrl Shift V: insert-selection(CLIPBOARD) + +! TokyoNight colors for Xresources + +*background: #24283b +*foreground: #c0caf5 + +*color0: #1D202F +*color1: #f7768e +*color2: #9ece6a +*color3: #e0af68 +*color4: #7aa2f7 +*color5: #bb9af7 +*color6: #7dcfff +*color7: #a9b1d6 + +*color8: #414868 +*color9: #f7768e +*color10: #9ece6a +*color11: #e0af68 +*color12: #7aa2f7 +*color13: #bb9af7 +*color14: #7dcfff +*color15: #c0caf5 + diff --git a/init.vim b/init.vim index 29d3bb7..0f5da8c 100644 --- a/init.vim +++ b/init.vim @@ -1,23 +1,118 @@ -set runtimepath^=~/.vim runtimepath+=~/.vim/after -let &packpath = &runtimepath +" for long lines +set wrap -source ~/.vimrc +" tab business +set tabstop=8 +set softtabstop=4 +set shiftwidth=4 +set expandtab -" for LSC support +set autoindent + +" syntax highlighting +syntax on + +set nohlsearch + +" try to detect filetypes +filetype on + +" enable loading indent file for filetype +filetype plugin indent on + +" line numbers +set number + +" cursor line +set cursorline + +" enable mouse +set mouse=a + +" set term title +set title +set titleold= + +source ~/.config/nvim/plugins.vim + +set laststatus=2 + +" vim-autoformat (C-F5) +" +noremap :Autoformat +au BufWrite *.py,*.c,*.h,*.cpp :Autoformat + +" enable omnicompletion +set omnifunc=syntaxcomplete#Complete + +" looks nice +set termguicolors +set background=dark + +let g:tokyonight_italic_keywords = 0 + +colorscheme tokyonight + +" toggle spell check +map s :set spell! spelllang=en_gb + +" show tabs and EOL whitespace +:set list listchars=tab:»·,trail:· + +" for tmux, screen, etc +set t_ut= + +" default is too slow +set updatetime=500 + +" re-read the file if changed (if possible) +set autoread +au BufEnter,CursorHold,CursorHoldI * silent! checktime + +" NERDTree +" +map n :NERDTreeToggle +let NERDTreeQuitOnOpen=1 + +" Telescope " -" general -if has('nvim-0.6.1') - source ~/.vim/lsp.lua - source ~/.vim/treesitter.lua -end +nnoremap f Telescope find_files +nnoremap B Telescope buffers + +"" gen_tags.vim (requires GNU global, aka gtags) +" disable ctags completely, use it through gtags plugin +let g:loaded_gentags#ctags = 1 + +" vimwiki +" +let g:vimwiki_list = [{'path': '~/textfiles/', + \ 'syntax': 'markdown', 'ext': '.md'}] +let g:vimwiki_global_ext = 0 + +" vim-markdown +" +let g:vim_markdown_folding_disabled = 1 +let g:vim_markdown_frontmatter = 1 +let g:vim_markdown_conceal_code_blocks = 0 +autocmd FileType markdown setlocal conceallevel=2 + +" git gutter to play nice with others +" +let g:gitgutter_sign_allow_clobber = 0 + +" Required for operations modifying multiple buffers like rename. +set hidden -if has('nvim-0.5') - source ~/.vim/lualine.lua -end +" better for some messages +set cmdheight=2 +set shortmess+=c +" for lsc erros +set shortmess-=F -" scala and metals -source ~/.vim/metals.vim +" disable preview when doing auto-complete +set completeopt-=preview -" auto-complete -source ~/.vim/cmp.vim +" Set completeopt to have a better completion experience +set completeopt=menuone,noinsert,noselect +" EOF diff --git a/plugins.vim b/plugins.vim new file mode 100644 index 0000000..e75c293 --- /dev/null +++ b/plugins.vim @@ -0,0 +1,90 @@ +" plugin dependent conf starts + +call plug#begin('~/.config/nvim/plugged') + +" git +Plug 'tpope/vim-fugitive', { 'tag': 'v3.6' } +Plug 'airblade/vim-gitgutter' + +" tmux +Plug 'tmux-plugins/vim-tmux-focus-events' +Plug 'roxma/vim-tmux-clipboard' +Plug 'wincent/terminus' + +" life improvements +Plug 'folke/tokyonight.nvim', { 'branch': 'main' } +Plug 'scrooloose/nerdtree' +Plug 'Chiel92/vim-autoformat' +Plug 'jsfaint/gen_tags.vim' +Plug 'godlygeek/tabular' +Plug 'vimwiki/vimwiki' + +" language support +Plug 'plasticboy/vim-markdown' +Plug 'samsaga2/vim-z80' +Plug 'tomtom/tcomment_vim' + +if has('nvim-0.5') + " status line + Plug 'nvim-lualine/lualine.nvim' + " general lua + Plug 'nvim-lua/popup.nvim' + Plug 'nvim-lua/plenary.nvim' + " scala + Plug 'scalameta/nvim-metals' + if has('nvim-0.5.1') + Plug 'nvim-telescope/telescope.nvim' + end + " auto complete + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/vim-vsnip' + + " for LSP + Plug 'kyazdani42/nvim-web-devicons' + Plug 'folke/trouble.nvim' + + " life improvements + Plug 'ojroques/nvim-bufdel' + + " learning + Plug 'folke/which-key.nvim' +end + +if has('nvim-0.6.1') + " lsp + Plug 'neovim/nvim-lspconfig' + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +end + +call plug#end() + +if has('nvim-0.5') +:lua << EOF + -- BufKil + require('bufdel').setup { + next = 'cycle', + quit = false, + } + -- which-key + require("which-key").setup { } +EOF + + source ~/.config/nvim/lualine.lua +end + +" for LSC support +" +if has('nvim-0.6.1') + source ~/.config/nvim/lsp.lua + source ~/.config/nvim/treesitter.lua + + " scala and metals + source ~/.config/nvim/metals.vim +end + + +" auto-complete +source ~/.config/nvim/cmp.vim + diff --git a/setup b/setup new file mode 100755 index 0000000..d381799 --- /dev/null +++ b/setup @@ -0,0 +1,17 @@ +#!/bin/bash + +set +e + +echo "Setting symlinks for tmux..." +rm -f ~/.tmux.conf +ln -s ~/.config/nvim/tmux.conf ~/.tmux.conf + +echo "Setting symlinks for wezterm..." +mkdir -p ~/.config/wezterm/colors/ +rm -f ~/.config/wezterm/colors/wezterm_tokyonight_storm.toml +ln -s ~/.config/nvim/wezterm_tokyonight_storm.toml ~/.config/wezterm/colors/wezterm_tokyonight_storm.toml +rm -f ~/.config/wezterm/wezterm.lua +ln -s ~/.config/nvim/wezterm.lua ~/.config/wezterm/wezterm.lua + +echo "Done" + diff --git a/tmux.conf b/tmux.conf index b3cca83..7e492e5 100644 --- a/tmux.conf +++ b/tmux.conf @@ -50,5 +50,5 @@ bind h split-window -v -c "#{pane_current_path}" set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 -source-file ~/.vim/tmux_tokyonight_storm.tmux +source-file ~/.config/nvim/tmux_tokyonight_storm.tmux diff --git a/xresources b/xresources deleted file mode 100644 index 3e3665c..0000000 --- a/xresources +++ /dev/null @@ -1,42 +0,0 @@ -! Sensible defaults -XTerm.vt100.locale: false -XTerm.vt100.utf8: true -XTerm.vt100.scrollTtyOutput: false -XTerm.vt100.scrollKey: true -XTerm.vt100.bellIsUrgent: true -XTerm.vt100.metaSendsEscape: true -! Styling -XTerm.vt100.faceName: JetBrains Mono -XTerm.vt100.boldMode: true -XTerm.vt100.faceSize: 9 -XTerm.vt100.internalBorder: 0 -XTerm.borderWidth: 0 -XTerm.vt100.translations: #override \n\ - Ctrl Shift N: scroll-back(1, halfpage) \n\ - Ctrl Shift T: scroll-forw(1, halfpage) \n\ - Ctrl Shift C: copy-selection(CLIPBOARD) \n\ - Ctrl Shift V: insert-selection(CLIPBOARD) - -! TokyoNight colors for Xresources - -*background: #24283b -*foreground: #c0caf5 - -*color0: #1D202F -*color1: #f7768e -*color2: #9ece6a -*color3: #e0af68 -*color4: #7aa2f7 -*color5: #bb9af7 -*color6: #7dcfff -*color7: #a9b1d6 - -*color8: #414868 -*color9: #f7768e -*color10: #9ece6a -*color11: #e0af68 -*color12: #7aa2f7 -*color13: #bb9af7 -*color14: #7dcfff -*color15: #c0caf5 - -- cgit v1.2.3