Showing posts with label plugin. Show all posts
Showing posts with label plugin. Show all posts

11 May 2023

How to install Control-P for vim?

https://ctrlpvim.github.io/ctrlp.vim/


  1. Clone the plugin into a separate directory:
    $ cd ~/.vim
    $ git clone https://github.com/ctrlpvim/ctrlp.vim.git bundle/ctrlp.vim
  2. Add to your ~/.vimrc:
    set runtimepath^=~/.vim/bundle/ctrlp.vim
  3. Run at Vim's command line:
    :helptags ~/.vim/bundle/ctrlp.vim/doc
  4. Restart Vim and check :help ctrlp.txt (or simply :help ctrlp) for usage instructions and configuration details. 
  5. When CtrlP helps find the file you want to open, if you simple press Enter, it will fill the current full window. Maybe that is not what you want.
  6. If you want to split the current window vertically and open it, press Ctrl-V; 
  7. If you want to split the current window horizontally,, and open it, press Ctrl-S.
  8. If you want to open the file on a new tab, press Ctrl-T.

05 October 2022

My vim plugin bible - How to Make Vim a Python IDE - Best IDE for Python.

https://dev.to/shahinsha/how-to-make-vim-a-python-ide-best-ide-for-python-23e1

 

I revised it a little bit as -


set nocompatible              " required
filetype off                  " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'

" All Plugins

Plugin 'mhartington/oceanic-next'
Plugin 'tmhedberg/SimpylFold'      "<space>
Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
" Plugin 'nvie/vim-flake8' (pip3 install flake8) <F7>
Plugin 'scrooloose/nerdtree'       ":nerd
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'zxqfl/tabnine-vim'
Plugin 'frazrepo/vim-rainbow'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'davidhalter/jedi-vim'       "Auto complete. Ctrl+<space>
Plugin 'ycm-core/YouCompleteMe'     "Automatic, or Ctrl-n


call vundle#end()            " required
filetype plugin indent on    " required


" setting horizontal and vertical splits
set splitbelow
set splitright

"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" Enable folding
set foldmethod=indent
set foldlevel=99

" Enable folding with the spacebar
" nnoremap <space> za


" Setting up indendation

au BufNewFile, BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix

au BufNewFile, BufRead *.js, *.html, *.css
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2

highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/

let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>

" setting up pyflakes

let python_highlight_all=1
syntax on

" nerd tree settings
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
nnoremap <leader>nerd :NERDTreeToggle      "by Sherman Chen

" setting up line numbering
set nu

" not break a word when newline
:set linebreak

" Max. row length 78
:set textwidth=78

" Rainbow bracket settings
let g:rainbow_active = 1

10 May 2022

How to install vim plugin from github?

e.g.1  install ctrlp from github


Clone the plugin from the git repository
To clone from github:

git clone https://github.com/kien/ctrlp.vim.git ~/.vim/bundle/ctrlp.vim

2
Update your vimrc
Add the following to your vimrc file:

set runtimepath^=~/.vim/bundle/ctrlp.vim

To edit vimrc, type:

vim ~/.vimrc

3
Restart vim

============================

e.g. 2 install airline from github


git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline

Put the following line into ~/.vimrc

set funtimepath^=~/.vim/bundle/vim-airline

I got :help airline to work with this command:

:helptags ~/.vim/bundle/vim-airline/doc

Like you, now the help-page displays when I type :help airline.

To add airline and the buffer list, install airline, and then just add this to your .vimrc:

" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1

" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'


Next I needed to replace the tab shortcuts that I’d no longer be using. I did this by adding these to my .vimrc as well:

" This allows buffers to be hidden if you've modified a buffer.
" This is almost a must if you wish to use buffers in this way.
set hidden

" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nmap <leader>T :enew<cr>

" Move to the next buffer
nmap <leader>l :bnext<CR>

" Move to the previous buffer
nmap <leader>h :bprevious<CR>

" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>

" Show all open buffers and their status
nmap <leader>bl :ls<CR>
These settings gave me a hybrid approach to how I expected tabs to work in Vim yet it still gave me the same power that comes from understanding and using buffers.