User Tools

Site Tools


linux:vim_dodger_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:vim_dodger_setup [2022/02/09 11:18] dodgerlinux:vim_dodger_setup [2022/12/14 10:32] (current) – [Globals] dodger
Line 9: Line 9:
 ^Tags:| | ^Tags:| |
  
 +
 +====== Advanced vimrc (2022) edition======
 +
 +I have additionally [[https://git.ciberterminal.net/public/vim_setup|created a repository]] with config files :-)
 +
 +
 +
 +===== System Packages (not bundled) =====
 +
 +==== ubuntu ====
 +<code>
 +vim
 +vim-addon-manager
 +vim-airline
 +vim-airline-themes
 +vim-common
 +vim-fugitive
 +vim-nox
 +vim-puppet
 +vim-python-jedi
 +vim-runtime
 +vim-syntastic
 +vim-syntax-docker
 +vim-tiny
 +vim-youcompleteme
 +</code>
 +One line:
 +<code bash>
 +apt install vim vim-addon-manager vim-airline vim-airline-themes vim-common vim-fugitive vim-nox vim-puppet vim-python-jedi vim-runtime vim-syntastic vim-syntax-docker vim-tiny vim-youcompleteme
 +</code>
 +
 +
 +===== Globals =====
 +This is the initial vimrc file.
 +<file vim ~/.vimrc>
 +" ##############################################
 +" GLOBAL CONFIG
 +" ##############################################
 +set encoding=utf-8
 +set nocompatible      " We're running Vim, not Vi!
 +
 +" map leader with , to start combos
 +let mapleader = ","
 +
 +</file>
 +
 +I'm remaping the leader key for convenience...
 +
 +===== vim-plug =====
 +Use [[https://github.com/junegunn/vim-plug|vim-plug]] as ''vundle'' is not maintained anymore...
 +<code bash>
 +curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
 +    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
 +</code>
 +
 +
 +===== patogen =====
 +The official instructions from  [[https://github.com/tpope/vim-pathogen]]:
 +<code bash>
 +mkdir -p ~/.vim/autoload ~/.vim/bundle && \
 +curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
 +
 +echo "execute pathogen#infect()" >> ~/.vimrc
 +</code>
 +
 +
 +
 +===== PlugInstall command =====
 +
 +Add to ''~/.vimrc'':
 +
 +<code vim>
 +call plug#begin()
 +" The default plugin directory will be as follows:
 +  - Vim (Linux/macOS): '~/.vim/plugged'
 +  - Vim (Windows): '~/vimfiles/plugged'
 +  - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
 +" You can specify a custom plugin directory by passing it as the argument
 +  - e.g. `call plug#begin('~/.vim/plugged')`
 +  - Avoid using standard Vim directory names like 'plugin'
 +
 +" Make sure you use single quotes
 +
 +" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
 +Plug 'junegunn/vim-easy-align'
 +
 +" Any valid git URL is allowed
 +Plug 'https://github.com/junegunn/vim-github-dashboard.git'
 +
 +" Multiple Plug commands can be written in a single line using | separators
 +Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
 +
 +" On-demand loading
 +Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
 +Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
 +
 +" Using a non-default branch
 +Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
 +
 +" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
 +Plug 'fatih/vim-go', { 'tag': '*' }
 +
 +" Plugin options
 +Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
 +
 +" Plugin outside ~/.vim/plugged with post-update hook
 +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
 +
 +" Unmanaged plugin (manually installed and updated)
 +"Plug '~/my-prototype-plugin'
 +
 +Plug 'tpope/vim-sensible'
 +Plug 'junegunn/seoul256.vim'
 +
 +Plug 'vim-syntastic/syntastic'
 +
 +Plug 'mbbill/undotree'
 +
 +" Initialize plugin system
 +call plug#end()
 +</code>
 +
 +Then call the installation:
 +<code vim>
 +:PlugInstall
 +</code>
 +
 +That will install all the above plugins:
 +  * ''junegunn/vim-easy-align''
 +  * ''https://github.com/junegunn/vim-github-dashboard.git''
 +  * ''SirVer/ultisnips''
 +  * ''scrooloose/nerdtree'',
 +  * ''tpope/vim-fireplace'',
 +  * ''rdnetto/YCM-Generator'',
 +  * ''fatih/vim-go'',
 +  * ''nsf/gocode'',
 +  * ''junegunn/fzf'',
 +  * ''tpope/vim-sensible''
 +  * ''junegunn/seoul256.vim''
 +  * ''vim-syntastic/syntastic''
 +  * ''mbbill/undotree''
 +
 +
 +
 +
 +===== Additional syntax/configs =====
 +==== Tagbar ====
 +Used for function/classes navigation [https://preservim.github.io/tagbar/|link].
 +
 +<code bash>
 +cd ~/.vim/bundle
 +git clone https://github.com/preservim/tagbar.git
 +</code>
 +And add to ''~/.vimrc'':
 +<code vim>
 +" tagbar 
 +nmap <F8> :TagbarToggle<CR>
 +
 +</code>
 +
 +
 +
 +==== terraform syntax ====
 +From [[https://github.com/hashivim/vim-terraform]] using ''patogen'':
 +<code bash>
 +git clone https://github.com/hashivim/vim-terraform.git ~/.vim/bundle/vim-terraform
 +</code>
 +
 +==== Puppet syntax ====
 +From [[https://github.com/rodjek/vim-puppet]] using ''pathogen'' :
 +<code bash>
 +git clone https://github.com/rodjek/vim-puppet.git ~/.vim/bundle/vim-puppet
 +</code>
 +
 +
 +===== Plugin config files =====
 +
 +<code vim>
 +" NERD commenter
 +source ~/.vim/pluginconf/nerd_commenter.vim
 +
 +" syntastic
 +source ~/.vim/pluginconf/syntastic.vim
 +
 +" undotree
 +source ~/.vim/pluginconf/undotree.vim
 +
 +" nerdtree
 +source ~/.vim/pluginconf/nerdtree.vim
 +</code>
 +
 +<file vim ~/.vim/pluginconf/nerd_commenter.vim>
 +" Create default mappings
 +let g:NERDCreateDefaultMappings = 1
 +
 +" Add spaces after comment delimiters by default
 +let g:NERDSpaceDelims = 1
 +
 +" Use compact syntax for prettified multi-line comments
 +let g:NERDCompactSexyComs = 1
 +
 +" Align line-wise comment delimiters flush left instead of following code indentation
 +let g:NERDDefaultAlign = 'left'
 +
 +" Set a language to use its alternate delimiters by default
 +let g:NERDAltDelims_java = 1
 +
 +" Add your own custom formats or override the defaults
 +let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
 +
 +" Allow commenting and inverting empty lines (useful when commenting a region)
 +let g:NERDCommentEmptyLines = 1
 +
 +" Enable trimming of trailing whitespace when uncommenting
 +let g:NERDTrimTrailingWhitespace = 1
 +
 +" Enable NERDCommenterToggle to check all selected lines is commented or not 
 +let g:NERDToggleCheckAllLines = 1
 +
 +" map leader with , to start combos
 +let mapleader = ","
 +</file>
 +
 +<file vim ~/.vim/pluginconf/syntastic.vim>
 +               ,
 +              / \,,_  .'|
 +           ,{{| /}}}}/_.'            _____________________________________________
 +          }}}}` '{{'  '           /                                             \
 +        {{{{{    _   ;, \          /            Ladies and Gentlemen,              \
 +     ,}}}}}}    /o`\  ` ;)        |                                                |
 +    {{{{{{   /                  |                 this is ...                    |
 +    }}}}}}              \                                                      |
 +   {{{{{{{{              \      |                                                |
 +   }}}}}}}}}   '.__      _  |        _____             __             __  _      |
 +   {{{{{{{{       /`._  (_\ /       / ___/__  ______  / /_____ ______/ /_(_)____ |
 +    }}}}}}'      |    //___/   --=:   \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
 +" jgs `{{{{`           '--'        ___/ / /_/ / / / / /_/ /_/ (__  ) /_/ / /__   |
 +     }}}`                         | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/   |
 +                                       /____/                                    |
 +                                                                                /
 +                                   \_____________________________________________/
 +
 + 
 +set statusline+=%#warningmsg#
 +set statusline+=%{SyntasticStatuslineFlag()}
 +set statusline+=%*
 + 
 +let g:syntastic_always_populate_loc_list = 1
 +let g:syntastic_auto_loc_list = 1
 +let g:syntastic_check_on_open = 1
 +let g:syntastic_check_on_wq = 0
 +</file>
 +
 +<file vim ~/.vim/pluginconf/undotree.vim>
 +" https://github.com/mbbill/undotree/blob/master/plugin/undotree.vim
 +"=================================================
 +"Options:
 +
 +" Window layout
 +" style 1
 +" +----------+------------------------+
 +" |          |                        |
 +" |          |                        |
 +" | undotree |                        |
 +" |          |                        |
 +" |          |                        |
 +" +----------+                        |
 +" |          |                        |
 +" |   diff                          |
 +" |          |                        |
 +" +----------+------------------------+
 +" Style 2
 +" +----------+------------------------+
 +" |          |                        |
 +" |          |                        |
 +" | undotree |                        |
 +" |          |                        |
 +" |          |                        |
 +" +----------+------------------------+
 +" |                                   |
 +" |   diff                            |
 +" |                                   |
 +" +-----------------------------------+
 +" Style 3
 +" +------------------------+----------+
 +" |                        |          |
 +" |                        |          |
 +" |                        | undotree |
 +" |                        |          |
 +" |                        |          |
 +" |                        +----------+
 +" |                        |          |
 +" |                        |   diff   |
 +" |                        |          |
 +" +------------------------+----------+
 +" Style 4
 +" +-----------------------++----------+
 +" |                        |          |
 +" |                        |          |
 +" |                        | undotree |
 +" |                        |          |
 +" |                        |          |
 +" +------------------------+----------+
 +" |                                   |
 +" |                            diff   |
 +" |                                   |
 +" +-----------------------------------+
 +if !exists('g:undotree_WindowLayout')
 +    let g:undotree_WindowLayout = 2
 +endif
 +
 +if has("persistent_undo")
 +   let target_path = expand('~/.vim/undodir')
 +
 +    " create the directory and any parent directories
 +    " if the location does not exist.
 +    if !isdirectory(target_path)
 +        call mkdir(target_path, "p", 0700)
 +    endif
 +
 +    let &undodir=target_path
 +    set undofile
 +endif
 +
 +nnoremap <Leader>u :UndotreeToggle<CR>
 +</file>
 +
 +
 +**Disabled, using FZF**
 +<file vim ~/.vim/pluginconf/nerdtree.vim>
 +nnoremap <leader>n :NERDTreeFocus<CR>
 +nnoremap <C-n> :NERDTree<CR>
 +nnoremap <C-t> :NERDTreeToggle<CR>
 +nnoremap <C-f> :NERDTreeFind<CR>
 +</file>
 +
 +
 +FZF:
 +<file vim ~/.vim/pluginconf/fzf.vim>
 +" https://github.com/junegunn/fzf/blob/master/README-VIM.md
 +nnoremap <leader>f :FZF<CR>
 +let g:fzf_action = {
 +  \ 'ctrl-t': 'tab split',
 +  \ 'ctrl-x': 'split',
 +  \ 'ctrl-v': 'vsplit' }
 +</file>
 +
 +
 +===== Cheatsheet generated =====
 +
 +In my config:
 +  * ''leader'' is '',''
 +  * ''<C>'' is control key
 +
 +
 +^ ##############'''Shortcut'''############## ^ ##############''command executed''############## ^ ------------------------------------------------------------------ ^
 +|''<leader>f'' | '':FZF<CR>'' | Open ''fzf'' |
 +| inside fzf -> ''<C-t> '' | ''g:fzf_action 'tab split'<CR>'' | Tab split selected file |
 +| inside fzf -> ''<C-x> '' | ''g:fzf_action 'split'<CR>'' | split selected file |
 +| inside fzf -> ''<C-v> '' | ''g:fzf_action 'vsplit'<CR>'' | vsplit selected file |
 +|''<leader>u'' | '':UndotreeToggle<CR>'' | Toggle Undotree pannel |
 +|''<leader>b'' | '':BuffergatorOpen<CR>'' | Open Buffergator pannel |
 +| ''[count]<leader>cc'' | '':NERDCommenterComment'' | Comment out the current line or text selected in visual mode. | 
 +| ''[count]<leader>cn'' | '':NERDCommenterNested'' | Same as cc but forces nesting. | 
 +| ''[count]<leader>c<space>'' | '':NERDCommenterToggle'' | Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa. | 
 +| ''[count]<leader>cm'' | '':NERDCommenterMinimal'' | Comments the given lines using only one set of multipart delimiters. | 
 +| ''[count]<leader>ci'' | '':NERDCommenterInvert'' | Toggles the comment state of the selected line(s) individually. | 
 +| ''[count]<leader>cs'' | '':NERDCommenterSexy'' | Comments out the selected lines with a pretty block formatted layout. | 
 +| ''[count]<leader>cy'' | '':NERDCommenterYank'' | Same as cc except that the commented line(s) are yanked first. | 
 +| ''<leader>c$'' | '':NERDCommenterToEOL'' | Comments the current line from the cursor to the end of line. | 
 +| ''<leader>cA'' | '':NERDCommenterAppend'' | Adds comment delimiters to the end of line and goes into insert mode between them. | 
 +| ''<leader>ca'' | '':NERDCommenterAltDelims'' | Switches to the alternative set of delimiters. | 
 +| ''[count]<leader>cl'' | '':NERDCommenterAlignLeft'' | Same as '':NERDCommenterComment'' except that the delimiters are aligned down the left side (<leader>cl) or both sides (<leader>cb). | 
 +| ''[count]<leader>cb'' | '':NERDCommenterAlignBoth'' | Same as '':NERDCommenterComment'' except that the delimiters are aligned down the left side (<leader>cl) or both sides (<leader>cb). | 
 +| ''[count]<leader>cu'' | '':NERDCommenterUncomment''| Uncomments the selected line(s). 
 +
 +
 + 
 ====== Simple vimrc ====== ====== Simple vimrc ======
  
Line 172: Line 550:
 "------------------------------------------------------------ "------------------------------------------------------------
 </file> </file>
- 
- 
-====== Advanced vimrc (2022) edition====== 
- 
-===== vim-plug ===== 
-Use [[https://github.com/junegunn/vim-plug|vim-plug]] as ''vundle'' is not maintained anymore... 
-<code bash> 
-curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 
-    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 
-</code> 
- 
- 
- 
  
  
Line 251: Line 616:
 " Plugin 'L9' " Plugin 'L9'
 " Git plugin not hosted on GitHub " Git plugin not hosted on GitHub
-jholgado: Disabled, needs ruby+dodger: Disabled, needs ruby
 "Plugin 'git://git.wincent.com/command-t.git' "Plugin 'git://git.wincent.com/command-t.git'
  
linux/vim_dodger_setup.1644405526.txt.gz · Last modified: 2022/02/09 11:18 by dodger