From f16b6cf760cdb0899a87c8823695e63698a73a5f Mon Sep 17 00:00:00 2001 From: Waffles Date: Sat, 31 Dec 2022 18:09:49 -0800 Subject: [PATCH] Remove vim from the yttrx role --- hosts | 2 +- roles/yttrx/tasks/main.yml | 15 -- templates/nvim/init.vim.j2 | 408 ------------------------------------- 3 files changed, 1 insertion(+), 424 deletions(-) delete mode 100644 templates/nvim/init.vim.j2 diff --git a/hosts b/hosts index 50efb3c..952b86a 100644 --- a/hosts +++ b/hosts @@ -8,7 +8,7 @@ wooly.masto.yttrx.com ansible_user=root #tusky.masto.yttrx.com ansible_user=root [sidekiq] -#wooly.masto.yttrx.com ansible_user=root +wooly.masto.yttrx.com ansible_user=root [frontend] #wooly.masto.yttrx.com ansible_user=root diff --git a/roles/yttrx/tasks/main.yml b/roles/yttrx/tasks/main.yml index cc1b4e4..9d12180 100644 --- a/roles/yttrx/tasks/main.yml +++ b/roles/yttrx/tasks/main.yml @@ -6,21 +6,6 @@ name: prometheus-node-exporter state: present -- name: Create nvim config dir - file: - path: /root/.config/nvim - state: directory - -- name: Install nvim config file - template: - src: templates/nvim/init.vim.j2 - dest: /root/.config/nvim/init.vim - -- name: Install nvim plugins - command: nvim --headless +PluginInstall +qall - args: - creates: /root/.vim/bundle/ - - name: Clone fzf git: repo: https://github.com/junegunn/fzf diff --git a/templates/nvim/init.vim.j2 b/templates/nvim/init.vim.j2 deleted file mode 100644 index 16a5567..0000000 --- a/templates/nvim/init.vim.j2 +++ /dev/null @@ -1,408 +0,0 @@ -" Setup runtime path -let s:editor_root=expand("~/.vim") -let &rtp = &rtp . ',' . s:editor_root . '/bundle/Vundle.vim' - -" Install Vundle if not present -let vundle_installed=1 -let vundle_readme=s:editor_root . '/bundle/Vundle.vim/README.md' -let vundle_repo = 'https://github.com/VundleVim/Vundle.vim' - -if !filereadable(vundle_readme) - echo "Installing Vundle.." - echo "" - silent call mkdir(s:editor_root . '/bundle', "p") - silent execute "!git clone " . vundle_repo . " " . s:editor_root . "/bundle/Vundle.vim" - let vundle_installed=0 -endif - -call vundle#rc(s:editor_root . '/bundle') -call vundle#begin() - -Plugin 'VundleVim/Vundle.vim' -Plugin 'airblade/vim-gitgutter' -Plugin 'vim-airline/vim-airline-themes' -Plugin 'jeffkreeftmeijer/vim-numbertoggle' -Plugin 'majutsushi/tagbar' -Plugin 'blueyed/vim-diminactive' -Plugin 'tell-k/vim-autopep8' -Plugin 'mhinz/vim-signify' - - -" Syntax plugins -"Plugin 'tmhedberg/SimpylFold' -Plugin 'trapd00r/irc.vim' -Plugin 'PotatoesMaster/i3-vim-syntax' -Plugin 'ClockworkNet/vim-junos-syntax' -Plugin 'nathanalderson/yang.vim' -Plugin 'mitsuhiko/vim-jinja' -Plugin 'sheerun/vim-polyglot' -Plugin 'ekalinin/Dockerfile.vim' -"Plugin 'fatih/vim-go' -Plugin 'rust-lang/rust.vim' -Plugin 'hhvm/vim-hack' - -" Color schemes -Plugin 'chriskempson/base16-vim' -Plugin 'tomasr/molokai' -Plugin 'joshdick/onedark.vim' -Plugin 'arakashic/nvim-colors-solarized' -Plugin 'drewtempelmeyer/palenight.vim' -Plugin 'skbolton/embark' - -Plugin 'guns/xterm-color-table.vim' - -" Airline -" Plugin 'joshdick/airline-onedark.vim' -Plugin 'vim-airline/vim-airline' -Plugin 'bling/vim-bufferline' - -" Utility plugins -Plugin 'benmills/vimux' -"Plugin 'neomake/neomake' -" Plugin 'coxley/codepad' -Plugin 'keith/gist.vim' -Plugin 'nvie/vim-flake8' -" Plugin 'ntpeters/vim-better-whitespace' -Plugin 'suan/vim-instant-markdown' -Plugin 'dhruvasagar/vim-table-mode' -Plugin 'powerline/powerline' -" Plugin 'kana/vim-fakeclip' -Plugin 'petermblair/vim-arcanist' -Plugin 'phleet/vim-mercenary' -Plugin 'hynek/vim-python-pep8-indent' -Plugin 'tpope/vim-abolish' -Plugin 'junegunn/fzf.vim' -Plugin 'christoomey/vim-tmux-navigator' -Plugin 'flazz/vim-colorschemes' -Plugin 'jbgutierrez/vim-better-comments' -" Ranger integration -"Plugin 'francoiscabrol/ranger.vim' -"Plugin 'w0rp/ale' -" Powerhouse plugins -Plugin 'Rykka/riv.vim' -" Plugin 'Rykka/InstantRst' -" Plugin 'sjl/gundo.vim' -" Plugin 'tomtom/tcomment_vim' -Plugin 'scrooloose/nerdtree' -Plugin 'godlygeek/tabular' -Plugin 'Shougo/deoplete.nvim' -Plugin 'zchee/deoplete-clang' -" Vim go completion -Plugin 'nsf/gocode', {'rtp': 'vim/'} -"Plugin 'davidhalter/jedi-vim' -"Plugin 'deoplete-plugins/deoplete-jedi' -" Plugin 'SirVer/ultisnips' -" Plugin 'honza/vim-snippets' -Plugin 'ervandew/supertab' -" Plugin 'Yggdroot/indentLine' -" Plugin 'terryma/vim-expand-region' - -" Distraction free -" Plugin 'junegunn/goyo.vim' -" Plugin 'junegunn/limelight.vim' - -" C++ -Plugin 'vim-scripts/a.vim' - -" Web Development -" Plugin 'mattn/emmet-vim' -Plugin 'chrisbra/Colorizer' -Plugin 'jelera/vim-javascript-syntax' - -call vundle#end() - -let g:python3_host_prog = '/usr/bin/python3' - -"let g:onedark_termcolors=256 - -let g:deoplete#enable_at_startup = 1 -"let g:deoplete#sources = ['buffer', 'tag'] - -let g:deoplete#sources#clang#libclang_path = '/usr/lib/libclang.so' -let g:deoplete#sources#clang#clang_header = '/usr/lib/clang' - -autocmd FileType python nnoremap y :0,$!yapf -autocmd CompleteDone * pclose " To close preview window of deoplete - -syntax enable -set background=dark -set termguicolors - -if !exists('g:colors_name') || g:colors_name != 'base16-flat' - colorscheme base16-flat -endif - -" Italics for my favorite color scheme -let g:palenight_terminal_italics=1 - -" " be kind to the 80 character limit -" " Create a giant wall of highlight past 80 characters -"let &colorcolumn=join(range(81,999),",") -highlight colorcolumn ctermbg=235 guibg=#2c2d27 - -" Toggle search hilighting with f3 -nnoremap :set hlsearch! -" Don't hilight searches -set nohlsearch - -" Remap the leader key -" let mapleader = "\" -"let mapleader = "\\" - -" remap ; to : so that ;w works instead of :w -nnoremap ; : - -" remap key as jj -"inoremap jj -" Same for jj -inoremap jk -inoremap kj - -" quickly clear highlights -map n :noh - -" quickly close quickfix -map C :ccl - -" quickly open a new tab -map T :tabnew - -" no more pesky escape (for insert and visual mode) -imap kj -imap kJ -imap Kj -imap KJ - -" vv to generate a new vertical split -nnoremap vv v - -" Navigate buffers -" Tab navigation like Firefox. -nnoremap :bnext - -" Find all occurances under cursor within file -nnoremap ff g# - -" map leader rv to resize window to 80 columns -nnoremap rr :vertical resize 86 - -" Manage tabs with jk -nnoremap j :tabp -nnoremap k :tabn - -" Buffer navigation like Firefox. -nnoremap :bprev -nnoremap :bnext - -" manage the buffers -nnoremap [ :bprev -nnoremap ] :bnext:w - -"set list -set hidden -set ai -set magic -set mouse=a -set number -set ignorecase -set smartcase -set hlsearch -set incsearch -set pastetoggle= -set cursorline " hilight the current line -set splitright -"set splitbelow -set tags=~/mytags - -:au FocusLost * :set number -:au FocusGained * :set relativenumber - -" Make splits nicer -nnoremap -nnoremap -nnoremap -nnoremap - -" Show just the filename -let g:airline#extensions#tabline#fnamemod = ':t' - -" used patched fonts for airline arrows/triangles -let g:airline_powerline_fonts=1 - -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#show_buffers = 0 -let g:airline#extensions#tabline#show_close_button = 0 - -" Ensure that for Makefiles we don't replace TABs with spaces -let _curfile = expand("%:t") -if _curfile =~ "Makefile" || _curfile =~ "makefile" || _curfile =~ ".*\mk" - set noexpandtab -else - " Don't use tabs, use spaces - set expandtab - - " make tab insert indents instead of tabs at begining of line - set smarttab -endif - -" Tell vim to treat certain files with python syntax -au BufRead,BufNewFile *.cconf set filetype=python -au BufRead,BufNewFile *.cinc set filetype=python -au BufRead,BufNewFile *.thrift set filetype=thrift -au BufRead,BufNewFile TARGETS set filetype=python -au! Syntax thrift source $LOCAL_ADMIN_SCRIPTS/vim/syntax/thrift.vim - -" NERDTree - map Ctrl+n to toggle the tree on/off -nnoremap :NERDTreeToggle -nnoremap :autopep8 -nnoremap :TagbarToggle - -" Configures ripgrep with fzf -command! -bang -nargs=* FzfRg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(), 1, {'options': '--delimiter : --nth 4..'}, 0) -command! -bang -nargs=* Rgg call fzf#vim#grep("rg --no-ignore --column --line-number --no-heading --color=always --smart-case ".shellescape(), 1, {'options': '--delimiter : --nth 4..'}, 0) - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" https://github.com/christoomey/vim-tmux-navigator -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -source ~/.vim/bundle/vim-tmux-navigator/plugin/tmux_navigator.vim - - -let g:tmux_navigator_no_mappings = 1 - -nnoremap {Left-mapping} :TmuxNavigateLeft -nnoremap {Down-Mapping} :TmuxNavigateDown -nnoremap {Up-Mapping} :TmuxNavigateUp -nnoremap {Right-Mapping} :TmuxNavigateRight -nnoremap {Previous-Mapping} :TmuxNavigatePrevious - -"############################################################################# -" Mappings -"############################################################################# - -" Next buffer -nnoremap :bnext -" Previous buffer -nnoremap :bprevious -" Create vsplit -nnoremap \| :vsp -" Creat hsplit -nnoremap - :sp -" Save file -nnoremap w :w -" Open startify with leader l -nnoremap l :Startify -" Open fuzzy files with leader \ -nnoremap \ :Files -" Open fuzzy lines with leader o -nnoremap o :Lines -" Open fuzzy buffers with leader b -nnoremap b :Buffers -" Open grep -nnoremap g :FzfRg -" Open grep for cursor word -nnoremap c :FzfRg -" Close the current buffer -nnoremap x :bd -" Close all buffers -nnoremap z :%bd -" Alternate file navigation -nnoremap a :A -" Alternate file navigation vertical split -nnoremap v :AV -" Cycle line number modes -nnoremap r :call CycleNumbering() -" Open project -nnoremap m :call ToggleProject() -" Open scratch term -nnoremap s :call ToggleScratchTerm() -" Open lazygit -nnoremap ' :call ToggleLazyGit() -" Open vifm -nnoremap / :Vifm -" Get outline -nnoremap co :CocList outline -" Get symbols -nnoremap cs :CocList -I symbols -" Get errors -nnoremap cl :CocList locationlist -" Get available commands -nnoremap cc :CocList commands -" Restart server -nnoremap cR :CocRestart -" Quit term buffer with ESC -tnoremap -" Go to definition -nnoremap gd (coc-definition) -" Go to type definition -nnoremap gy (coc-type-definition) -" Go to implementation -nnoremap gi (coc-implementation) -" Find references -nnoremap gr (coc-references) -" Get hint -nnoremap gh :call CocActionAsync('doHover') - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" vim-autopep8 -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -"let g:autopep8_disable_show_diff=1 -nnoremap :autopep8 - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" airline -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:airline_powerline_fonts = 1 -let g:airline_theme = 'tomorrow' - -" There needs to be a "fbgrep" command present in the home directory for this -" to work properly. If it doesn't exist, then we can back it up to using -" ack, or silver surfer. -set grepprg=rg -if filereadable(expand("~/bin/fbgrep")) - set grepprg=~/bin/fbgrep -endif -" bind K to grep word under cursor -nnoremap K :grep! "":cw - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Custom Functions -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Creates a floating window with a most recent buffer to be used -function! CreateCenteredFloatingWindow() - let width = float2nr(&columns * 0.6) - let height = float2nr(&lines * 0.6) - let top = ((&lines - height) / 2) - 1 - let left = (&columns - width) / 2 - let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} - - let top = "╭" . repeat("─", width - 2) . "╮" - let mid = "│" . repeat(" ", width - 2) . "│" - let bot = "╰" . repeat("─", width - 2) . "╯" - let lines = [top] + repeat([mid], height - 2) + [bot] - let s:buf = nvim_create_buf(v:false, v:true) - call nvim_buf_set_lines(s:buf, 0, -1, v:true, lines) - call nvim_open_win(s:buf, v:true, opts) - set winhl=Normal:Floating - let opts.row += 1 - let opts.height -= 2 - let opts.col += 2 - let opts.width -= 4 - call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts) - autocmd BufWipeout exe 'bwipeout '.s:buf - tnoremap :bw! -endfunction - -" Cycle through relativenumber + number, number (only), and no numbering. -function! CycleNumbering() abort - if exists('+relativenumber') - execute { - \ '00': 'set relativenumber | set number', - \ '01': 'set norelativenumber | set number', - \ '10': 'set norelativenumber | set nonumber', - \ '11': 'set norelativenumber | set number' }[&number . &relativenumber] - else - " No relative numbering, just toggle numbers on and off. - set number! - endif -endfunction -