Last active
October 7, 2021 06:33
-
-
Save 303248153/950a8c986c8ba302701ae9fa34ab656a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install vim python3-pip | |
sudo update-alternatives --config vi # choose vim.basic auto mode | |
# https://github.com/tpope/vim-pathogen | |
mkdir -p ~/.vim/autoload ~/.vim/bundle && \ | |
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | |
# https://github.com/morhetz/gruvbox/wiki/Installation | |
git clone https://github.com/morhetz/gruvbox.git ~/.vim/bundle/gruvbox | |
# https://github.com/Shougo/deoplete.nvim | |
git clone https://github.com/Shougo/deoplete.nvim ~/.vim/bundle/deoplete | |
git clone https://github.com/roxma/nvim-yarp ~/.vim/bundle/nvim-yarp | |
git clone https://github.com/roxma/vim-hug-neovim-rpc ~/.vim/bundle/vim-hug-neovim-rpc | |
pip3 install --user pynvim | |
# https://github.com/itchyny/lightline.vim | |
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim | |
git clone https://github.com/tpope/vim-fugitive ~/.vim/bundle/vim-fugitive | |
# https://github.com/tweekmonster/deoplete-clang2 | |
# git clone https://github.com/tweekmonster/deoplete-clang2 ~/.vim/bundle/deoplete-clang2 | |
# for neovim | |
# vi ~/.config/nvim/init.vim | |
``` | |
set runtimepath^=~/.vim runtimepath+=~/.vim/after | |
let &packpath = &runtimepath | |
source ~/.vimrc | |
``` | |
vi ~/.vimrc | |
``` | |
set nocompatible | |
execute pathogen#infect() | |
let g:deoplete#enable_at_startup = 1 | |
call g:deoplete#custom#option('min_pattern_length', 1) | |
call g:deoplete#custom#option('auto_complete_delay', 0) | |
call g:deoplete#custom#var('buffer', { 'require_same_filetype': v:false }) | |
set background=dark | |
set mouse=a | |
set showmode | |
set cursorline | |
set backspace=indent,eol,start | |
set number | |
set showmatch | |
set incsearch | |
set hlsearch | |
set ignorecase | |
set list | |
set listchars=tab:'.,trail:.,nbsp:. | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set autoindent | |
set smartindent | |
set nocindent | |
set pastetoggle=<F12> | |
set clipboard=unnamed | |
set encoding=utf-8 | |
set fileencodings=utf-8,iso-2022-jp,euc-jp,sjis,cp932 | |
set tabpagemax=100 | |
set nomodeline " to avoid arbitrary code execution | |
" set columns=120 | |
" set lines=30 | |
colorscheme gruvbox | |
filetype plugin indent off | |
syntax on | |
" easier moving in tabs and windows | |
noremap <C-J> <C-W>j | |
noremap <C-K> <C-W>k | |
noremap <C-L> <C-W>l | |
noremap <C-H> <C-W>h | |
" wrapped lines goes down/up to next row rather than next | |
nnoremap j gj | |
nnoremap k gk | |
" autocomplete key mappings | |
" inoremap <expr><Esc> pumvisible() ? "\<C-y>" : "\<Esc>" | |
" inoremap <expr><Enter> pumvisible() ? "\<C-n>" : "\<Enter>" | |
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr><Down> pumvisible() ? "\<C-n>" : "\<Down>" | |
inoremap <expr><Up> pumvisible() ? "\<C-p>" : "\<Up>" | |
" tabs | |
nnoremap <F2> :args *<CR>:tab all<CR> | |
nnoremap ' :tabe<Space> | |
" visual select | |
nnoremap <C-A> ggvG | |
" don't copy deleted or overwritted text | |
nnoremap d "_d | |
vnoremap d "_d | |
nnoremap D "_D | |
vnoremap D "_D | |
nnoremap c "_c | |
vnoremap c "_c | |
nnoremap C "_C | |
vnoremap C "_C | |
vnoremap p "_dP | |
vnoremap P "_dP | |
" file operations | |
nnoremap <C-W> :q<CR> | |
vnoremap <C-W> :q<CR> | |
nnoremap <C-S> :w<CR> | |
vnoremap <C-S> :w<CR> | |
" lightline | |
set laststatus=2 | |
let g:lightline = { | |
\ 'colorscheme': 'powerline', | |
\ 'active': { | |
\ 'left': [ [ 'mode', 'paste' ], | |
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] | |
\ }, | |
\ 'component_function': { | |
\ 'gitbranch': 'fugitive#head' | |
\ }, | |
\ } | |
" ignore function keys for input mode | |
inoremap <F1> <NOP> | |
inoremap <F2> <NOP> | |
inoremap <F3> <NOP> | |
inoremap <F4> <NOP> | |
inoremap <F5> <NOP> | |
inoremap <F6> <NOP> | |
inoremap <F7> <NOP> | |
inoremap <F8> <NOP> | |
inoremap <F9> <NOP> | |
inoremap <F10> <NOP> | |
inoremap <F11> <NOP> | |
inoremap <F12> <NOP> | |
inoremap <F13> <NOP> | |
inoremap <F14> <NOP> | |
inoremap <F15> <NOP> | |
inoremap <F16> <NOP> | |
inoremap <F17> <NOP> | |
inoremap <F18> <NOP> | |
inoremap <F19> <NOP> | |
inoremap <F20> <NOP> | |
" some copied from http://spf13.com/post/perfect-vimrc-vim-config-file | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment