config: nvim: split config into multiple files
This commit is contained in:
parent
846c204094
commit
d13d72ec80
3 changed files with 171 additions and 171 deletions
149
config/nvim/general.vim
Normal file
149
config/nvim/general.vim
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
" drop vi-compatibility
|
||||||
|
set nocompatible
|
||||||
|
" disable autocmd
|
||||||
|
set secure
|
||||||
|
" use utf8 only
|
||||||
|
set encoding=utf8
|
||||||
|
|
||||||
|
" file/directory matching
|
||||||
|
set wildmode=list:longest,full
|
||||||
|
" ignore case when completing
|
||||||
|
if exists('+wildignorecase')
|
||||||
|
set wildignorecase
|
||||||
|
endif
|
||||||
|
" ignorelist
|
||||||
|
set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc
|
||||||
|
|
||||||
|
" show completion menu even with only one match
|
||||||
|
if exists('+completeopt')
|
||||||
|
set completeopt+=menuone
|
||||||
|
endif
|
||||||
|
|
||||||
|
" increase command history
|
||||||
|
set history=1000
|
||||||
|
" increase count of possible undos
|
||||||
|
set undolevels=1000
|
||||||
|
|
||||||
|
" encrypt buffers when saved to files
|
||||||
|
if exists('+cryptmethod')
|
||||||
|
set cryptmethod=blowfish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" enable fast terminal for tmux but not for ssh connection
|
||||||
|
if &term =~# '^screen' && !exists('SSH_CONNECTION')
|
||||||
|
set ttyfast
|
||||||
|
endif
|
||||||
|
|
||||||
|
" enable automatic file detection, plugin and indention support
|
||||||
|
if has('autocmd')
|
||||||
|
filetype off "for pathogen
|
||||||
|
filetype plugin indent on
|
||||||
|
endif
|
||||||
|
|
||||||
|
" use utf8 encoding for all files and recognize latin1
|
||||||
|
set fileencodings=utf-8,latin1
|
||||||
|
|
||||||
|
" use unix line-endings and recognize dos endings
|
||||||
|
set fileformats=unix,dos
|
||||||
|
|
||||||
|
" tabs
|
||||||
|
set tabstop=4
|
||||||
|
set shiftwidth=4
|
||||||
|
set autoindent
|
||||||
|
set smartindent
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
" allow backspacing over autoindent and line breaks
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
|
||||||
|
" already display matches while searching
|
||||||
|
set incsearch
|
||||||
|
" only check for case if the searched word contains a capital
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
" highlight all matches. use <C-L> to remove the highlights
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" treat hyphenated words as a single word
|
||||||
|
set iskeyword+=-
|
||||||
|
|
||||||
|
" syntax folding
|
||||||
|
if has('folding')
|
||||||
|
set foldmethod=syntax
|
||||||
|
" only use folding when there is enough space
|
||||||
|
" if &columns > 80
|
||||||
|
" set foldcolumn=2
|
||||||
|
" endif
|
||||||
|
set foldlevel=99
|
||||||
|
|
||||||
|
" dont open fold for block movements
|
||||||
|
set foldopen-=block
|
||||||
|
endif
|
||||||
|
|
||||||
|
" allow buffers with changes to be hidden
|
||||||
|
set hidden
|
||||||
|
|
||||||
|
" correct splitting
|
||||||
|
if has('vertsplit')
|
||||||
|
set splitright
|
||||||
|
set splitbelow
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Visual
|
||||||
|
" set text color for dark terminal background
|
||||||
|
set background=dark
|
||||||
|
|
||||||
|
" activate syntax highlighting
|
||||||
|
if has('syntax')
|
||||||
|
syntax enable
|
||||||
|
endif
|
||||||
|
|
||||||
|
" set colorscheme
|
||||||
|
colorscheme ron
|
||||||
|
|
||||||
|
" display line at which the current is positioned
|
||||||
|
if exists('+cursorline')
|
||||||
|
set cursorline
|
||||||
|
" remove line and make the line bold instead
|
||||||
|
highlight CursorLine term=bold cterm=bold
|
||||||
|
highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey
|
||||||
|
endif
|
||||||
|
|
||||||
|
" display box from column 81 to 100
|
||||||
|
let &colorcolumn=join(range(81, 100), ",")
|
||||||
|
highlight ColorColumn ctermbg=235 guibg=#2d2d2d
|
||||||
|
|
||||||
|
" display line numbers
|
||||||
|
set number
|
||||||
|
|
||||||
|
" show cursor position all the time
|
||||||
|
set ruler
|
||||||
|
|
||||||
|
" show tabs all the time
|
||||||
|
set showtabline=2
|
||||||
|
|
||||||
|
" show currently typed command
|
||||||
|
set showcmd
|
||||||
|
|
||||||
|
" define characters to display when using 'set list'
|
||||||
|
set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣
|
||||||
|
|
||||||
|
" increase completion performance and reduce time until timeout
|
||||||
|
set updatetime=300
|
||||||
|
set timeoutlen=500
|
||||||
|
|
||||||
|
" copy paste between vim and everything else
|
||||||
|
" TODO: check whether the 'plus' suffix works with plain vim
|
||||||
|
set clipboard=unnamedplus
|
||||||
|
|
||||||
|
" Misc
|
||||||
|
set mouse=n
|
||||||
|
|
||||||
|
" remove windows ^M when the encoding gets messed up
|
||||||
|
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||||
|
|
||||||
|
" autoreload vimrc when writing init.vim
|
||||||
|
au! BufWritePost $MYVIMRC source %
|
||||||
|
|
||||||
|
" add convenience command for force-saving read-only files
|
||||||
|
cmap w!! w !sudo tee %
|
||||||
|
|
@ -1,171 +1,2 @@
|
||||||
" drop vi-compatibility
|
source $HOME/.config/nvim/general.vim
|
||||||
set nocompatible
|
source $HOME/.config/nvim/keybindings.vim
|
||||||
" disable autocmd
|
|
||||||
set secure
|
|
||||||
" use utf8 only
|
|
||||||
set encoding=utf8
|
|
||||||
|
|
||||||
" file/directory matching
|
|
||||||
set wildmode=list:longest,full
|
|
||||||
" ignore case when completing
|
|
||||||
if exists('+wildignorecase')
|
|
||||||
set wildignorecase
|
|
||||||
endif
|
|
||||||
" ignorelist
|
|
||||||
set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc
|
|
||||||
|
|
||||||
" show completion menu even with only one match
|
|
||||||
if exists('+completeopt')
|
|
||||||
set completeopt+=menuone
|
|
||||||
endif
|
|
||||||
|
|
||||||
" increase command history
|
|
||||||
set history=1000
|
|
||||||
" increase count of possible undos
|
|
||||||
set undolevels=1000
|
|
||||||
|
|
||||||
" encrypt buffers when saved to files
|
|
||||||
if exists('+cryptmethod')
|
|
||||||
set cryptmethod=blowfish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" enable fast terminal for tmux but not for ssh connection
|
|
||||||
if &term =~# '^screen' && !exists('SSH_CONNECTION')
|
|
||||||
set ttyfast
|
|
||||||
endif
|
|
||||||
|
|
||||||
" enable automatic file detection, plugin and indention support
|
|
||||||
if has('autocmd')
|
|
||||||
filetype off "for pathogen
|
|
||||||
filetype plugin indent on
|
|
||||||
endif
|
|
||||||
|
|
||||||
" use utf8 encoding for all files and recognize latin1
|
|
||||||
set fileencodings=utf-8,latin1
|
|
||||||
|
|
||||||
" use unix line-endings and recognize dos endings
|
|
||||||
set fileformats=unix,dos
|
|
||||||
|
|
||||||
" tabs
|
|
||||||
set tabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set autoindent
|
|
||||||
set smartindent
|
|
||||||
set smarttab
|
|
||||||
|
|
||||||
" allow backspacing over autoindent and line breaks
|
|
||||||
set backspace=indent,eol,start
|
|
||||||
|
|
||||||
" already display matches while searching
|
|
||||||
set incsearch
|
|
||||||
" only check for case if the searched word contains a capital
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
" highlight all matches. use <C-L> to remove the highlights
|
|
||||||
set hlsearch
|
|
||||||
|
|
||||||
" treat hyphenated words as a single word
|
|
||||||
set iskeyword+=-
|
|
||||||
|
|
||||||
" syntax folding
|
|
||||||
if has('folding')
|
|
||||||
set foldmethod=syntax
|
|
||||||
" only use folding when there is enough space
|
|
||||||
" if &columns > 80
|
|
||||||
" set foldcolumn=2
|
|
||||||
" endif
|
|
||||||
set foldlevel=99
|
|
||||||
|
|
||||||
" dont open fold for block movements
|
|
||||||
set foldopen-=block
|
|
||||||
endif
|
|
||||||
|
|
||||||
" allow buffers with changes to be hidden
|
|
||||||
set hidden
|
|
||||||
|
|
||||||
" correct splitting
|
|
||||||
if has('vertsplit')
|
|
||||||
set splitright
|
|
||||||
set splitbelow
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Visual
|
|
||||||
" set text color for dark terminal background
|
|
||||||
set background=dark
|
|
||||||
|
|
||||||
" activate syntax highlighting
|
|
||||||
if has('syntax')
|
|
||||||
syntax enable
|
|
||||||
endif
|
|
||||||
|
|
||||||
" set colorscheme
|
|
||||||
colorscheme ron
|
|
||||||
|
|
||||||
" display line at which the current is positioned
|
|
||||||
if exists('+cursorline')
|
|
||||||
set cursorline
|
|
||||||
" remove line and make the line bold instead
|
|
||||||
highlight CursorLine term=bold cterm=bold
|
|
||||||
highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey
|
|
||||||
endif
|
|
||||||
|
|
||||||
" display box from column 81 to 100
|
|
||||||
let &colorcolumn=join(range(81, 100), ",")
|
|
||||||
highlight ColorColumn ctermbg=235 guibg=#2d2d2d
|
|
||||||
|
|
||||||
" display line numbers
|
|
||||||
set number
|
|
||||||
|
|
||||||
" show cursor position all the time
|
|
||||||
set ruler
|
|
||||||
|
|
||||||
" show tabs all the time
|
|
||||||
set showtabline=2
|
|
||||||
|
|
||||||
" show currently typed command
|
|
||||||
set showcmd
|
|
||||||
|
|
||||||
" define characters to display when using 'set list'
|
|
||||||
set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣
|
|
||||||
|
|
||||||
" increase completion performance and reduce time until timeout
|
|
||||||
set updatetime=300
|
|
||||||
set timeoutlen=500
|
|
||||||
|
|
||||||
" copy paste between vim and everything else
|
|
||||||
" TODO: check whether the 'plus' suffix works with plain vim
|
|
||||||
set clipboard=unnamedplus
|
|
||||||
|
|
||||||
" Keybindings
|
|
||||||
" allow easier pane switching
|
|
||||||
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>
|
|
||||||
|
|
||||||
" allow easier pane resizing
|
|
||||||
nnoremap <M-J> :resize -2<CR>
|
|
||||||
nnoremap <M-K> :resize +2<CR>
|
|
||||||
nnoremap <M-L> :vertical resize -2<CR>
|
|
||||||
nnoremap <M-H> :vertical resize +2<CR>
|
|
||||||
|
|
||||||
" use TAB to switch to next buffers
|
|
||||||
nnoremap <TAB> :bnext<CR>
|
|
||||||
" use Shift-TAB to switch to previous buffers
|
|
||||||
nnoremap <S-TAB> :bprevious<CR>
|
|
||||||
|
|
||||||
" use TAB for skipping through completion options
|
|
||||||
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
|
||||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
|
|
||||||
|
|
||||||
" Misc
|
|
||||||
set mouse=n
|
|
||||||
|
|
||||||
" remove windows ^M when the encoding gets messed up
|
|
||||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
|
||||||
|
|
||||||
" autoreload vimrc when writing init.vim
|
|
||||||
au! BufWritePost $MYVIMRC source %
|
|
||||||
|
|
||||||
" add convenience command for force-saving read-only files
|
|
||||||
cmap w!! w !sudo tee %
|
|
||||||
|
|
|
||||||
20
config/nvim/keybindings.vim
Normal file
20
config/nvim/keybindings.vim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
" allow easier pane switching
|
||||||
|
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>
|
||||||
|
|
||||||
|
" allow easier pane resizing
|
||||||
|
nnoremap <M-J> :resize -2<CR>
|
||||||
|
nnoremap <M-K> :resize +2<CR>
|
||||||
|
nnoremap <M-L> :vertical resize -2<CR>
|
||||||
|
nnoremap <M-H> :vertical resize +2<CR>
|
||||||
|
|
||||||
|
" use TAB to switch to next buffers
|
||||||
|
nnoremap <TAB> :bnext<CR>
|
||||||
|
" use Shift-TAB to switch to previous buffers
|
||||||
|
nnoremap <S-TAB> :bprevious<CR>
|
||||||
|
|
||||||
|
" use TAB for completion
|
||||||
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||||
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue