[Up]常用資訊

[重點文章] 重點文章 [重點文章] 重點文章

2020年6月27日 星期六

[FreeBSD] FreeBSD 安裝 vim

[FreeBSD] FreeBSD 安裝 vim

 
#Step: 01 – FreeBSD 安裝新版的 套件
FreeBSD 安裝新版的 套件

安裝 vim

pkg install vim


Installing Vim-plug

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

:PlugInstall

檔案

set nocompatible
" Use Vim settings, rather than Vi settings
set softtabstop=2
" Indent by 2 spaces when hitting tab
set shiftwidth=4
" Indent by 4 spaces when auto-indenting
set tabstop=4
" Show existing tab with 4 spaces width
syntax on
highlight Comment ctermfg=darkcyan
highlight Search term=reverse ctermbg=4 ctermfg=7
" Enable syntax highlighting
filetype indent plugin on
" Enable indenting for files
set autoindent
" Enable auto indenting
set number
" Enable line numbers
colorscheme desert
" Set nice looking colorscheme
set nobackup
" Disable backup files
set laststatus=2
"show status line
"set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
"set statusline=
"set statusline+=%1*\[%n]                                  "buffernr
"set statusline+=%2*\ %<%F\                                "File+path
"set statusline+=%3*\ %=\ %{''.(&fenc!=''?&fenc:&enc).''}\ "Encoding
"set statusline+=%4*\ %{(&bomb?\",BOM\":\"\")}\            "Encoding2
"set statusline+=%5*\ %{&ff}\                              "FileFormat (dos/unix..)
"set statusline+=%6*\ row:%l/%L\ col:%03c\ (%03p%%)\             "Rownumber/total (%)
"set statusline+=%0*\ \ %m%r%w\ %P\ \                      "Modified? Readonly? Top/bot.
"hi User2 ctermfg=3  ctermbg=0
"hi User6 ctermfg=3  ctermbg=4
"set laststatus=2
" ==================
set statusline=%y\ %t\%r%h%w\ %m%=\ %{&fileencoding}\ [%{&ff}]\ [AscII=\%03.3b]\ [Hex=\%02.2B]\ [LINE=%L]\ [Pos=%l,%v,%p%%]
"set laststatus=2
"set statusline=%4*%<\ %1*[%F]
"set statusline+=%4*\ %5*[%{&encoding}, " encoding
"set statusline+=%{&fileformat}%{\"\".((exists(\"+bomb\")\ &&\ &bomb)?\",BOM\":\"\").\"\"}]%m
"set statusline+=%4*%=\ %6*%y%4*\ %3*%l%4*,\ %3*%c%4*\ \<\ %2*%P%4*\ \>
"highlight User1 ctermfg=red
"highlight User1 term=underline cterm=underline ctermfg=red
"highlight User2 term=underline cterm=underline ctermfg=green
"highlight User3 term=underline cterm=underline ctermfg=yellow
"highlight User4 term=underline cterm=underline ctermfg=white
"highlight User5 ctermfg=cyan
"highlight User6 ctermfg=white
"=========================
set wildmenu
" Display command line's tab complete options as a menu.
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
" install and use neomake linting
Plug 'neomake/neomake'
" install jedi auto for python
Plug 'davidhalter/jedi-vim'
" Install  PEP8 support
Plug 'Vimjas/vim-python-pep8-indent'
"
Plug 'preservim/nerdtree'
"
call plug#end()
colorscheme desert
" Get help
nnoremap  H :execute "!pydoc3 " . expand("")
" Run code
autocmd FileType python nnoremap   :exec '!clear; python3' shellescape(@%, 1)
" Edit vimr configuration file
nnoremap ve :e $MYVIMRC
" " Reload vimr configuration file
nnoremap vw :source $MYVIMRC
map  :NERDTree
"#vim Vundle Start
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
Plugin 'vim-scripts/indentpython.vim'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
" ...

" All of your Plugins must be added before the following line
call vundle#end()            " required
"#vim Vundle end

安裝 vim-plug
 
#Step: 02 – FreeBSD 安裝 vim-plug
FreeBSD 安裝 vim-plug


curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim\


##

set nocompatible
" Use Vim settings, rather than Vi settings
set softtabstop=2
" Indent by 2 spaces when hitting tab
set shiftwidth=4
" Indent by 4 spaces when auto-indenting
set tabstop=4
" Show existing tab with 4 spaces width
syntax on
highlight Comment ctermfg=darkcyan
highlight Search term=reverse ctermbg=4 ctermfg=7
" Enable syntax highlighting
filetype indent plugin on
" Enable indenting for files
set autoindent
" Enable auto indenting
set number
" Enable line numbers
colorscheme desert
" Set nice looking colorscheme
set nobackup
" Disable backup files
set laststatus=2
"show status line
"set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
"set statusline=
"set statusline+=%1*\[%n]                                  "buffernr
"set statusline+=%2*\ %<%F\                                "File+path
"set statusline+=%3*\ %=\ %{''.(&fenc!=''?&fenc:&enc).''}\ "Encoding
"set statusline+=%4*\ %{(&bomb?\",BOM\":\"\")}\            "Encoding2
"set statusline+=%5*\ %{&ff}\                              "FileFormat (dos/unix..)
"set statusline+=%6*\ row:%l/%L\ col:%03c\ (%03p%%)\             "Rownumber/total (%)
"set statusline+=%0*\ \ %m%r%w\ %P\ \                      "Modified? Readonly? Top/bot.
"hi User2 ctermfg=3  ctermbg=0
"hi User6 ctermfg=3  ctermbg=4
"set laststatus=2
" ==================
"set laststatus=2
"set statusline=%4*%<\ %1*[%F]
"set statusline+=%4*\ %5*[%{&encoding}, " encoding
"set statusline+=%{&fileformat}%{\"\".((exists(\"+bomb\")\ &&\ &bomb)?\",BOM\":\"\").\"\"}]%m
"set statusline+=%4*%=\ %6*%y%4*\ %3*%l%4*,\ %3*%c%4*\ \<\ %2*%P%4*\ \>
"highlight User1 ctermfg=red
"highlight User2 term=underline cterm=underline ctermfg=green
"highlight User3 term=underline cterm=underline ctermfg=yellow
"highlight User4 term=underline cterm=underline ctermfg=white
"highlight User5 ctermfg=cyan
"highlight User6 ctermfg=white
"=========================
set wildmenu
" Display command line's tab complete options as a menu.
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
" install and use neomake linting
Plug 'neomake/neomake'
" install jedi auto for python
Plug 'davidhalter/jedi-vim'
" Install  PEP8 support
Plug 'Vimjas/vim-python-pep8-indent'
"
Plug 'preservim/nerdtree'
" 
Plug 'vim-airline/vim-airline'
"
call plug#end()
colorscheme desert
" Get help
nnoremap  H :execute "!pydoc3 " . expand("")
" Run code
autocmd FileType python nnoremap   :exec '!clear; python3' shellescape(@%, 1)
" Edit vimr configuration file
nnoremap ve :e $MYVIMRC
" " Reload vimr configuration file
nnoremap vw :source $MYVIMRC
map  :NERDTree
"#vim Vundle Start
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
Plugin 'vim-scripts/indentpython.vim'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
" ...

" All of your Plugins must be added before the following line
call vundle#end()            " required
"#vim Vundle end

 
#Step: 02 – FreeBSD .cshrc
FreeBSD .cshrc


alias h         history 1000
alias j         jobs -l
alias la        ls -A
alias lf        ls -FA
alias ll        ls -lA
alias lh        ll -h
alias ls        ls -FGI
alias .         ls
alias ..        cd ../
alias man       env LC_ALL=C man
alias s         screen
alias r         screen -r

set     autolist

setenv  LSCOLORS "ExFxcxdxbxegedabagacad"

setenv  TERMCAP 'xterm|xterm-color:Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm:tc=xterm-xfree86:'

setenv  LANG zh_TW.UTF-8
setenv  LC_CTYPE zh_TW.UTF-8
setenv  LC_COLLATE zh_TW.UTF-8
setenv  LC_TIME zh_TW.UTF-8
setenv  LC_NUMERIC zh_TW.UTF-8
setenv  LC_MONETARY zh_TW.UTF-8
setenv  LC_MESSAGES zh_TW.UTF-8
setenv  LC_ALL zh_TW.UTF-8

umask   22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin)

if (-x /usr/local/bin/vim) then
        setenv  EDITOR  vim
        alias vi        vim
else
        setenv  EDITOR  vi
endif
setenv  PAGER   less
setenv  BLOCKSIZE       K

if ($?prompt) then
        if ($USER == root) then
            set prompt = "[ %U%{^[[36;1m%}%n%{^[[m%}%B@%{^[[33m%}%m%{^[[m%} ] %{^[[35;1m%}%T%{^[[m%} [%{^[[32;1m%}%~%{^[[m%}] %# "
        else
            set prompt = "%B[%{\033[36m%}%n%{\033[37m%}@%m %~]%# "
        endif
        set filec
        set history = 5000
        set savehist = 5000
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif
endif

##################

配置sudo的简单方法:

# User privilege specification
root    ALL=(ALL) ALL
test    ALL=(ALL) ALL
%wheel ALL=(ALL) ALL

沒有留言:

張貼留言