1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

Adding vim stuff

This commit is contained in:
Henrik Hautakoski 2023-09-14 19:55:17 +02:00
parent b77ac31173
commit 81d5cc35ce
11 changed files with 3006 additions and 0 deletions

5
nvim/README.md Normal file
View file

@ -0,0 +1,5 @@
# vim-config
Just my vim config.
Run `:PlugInstall` to install all plugins.

2812
nvim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

20
nvim/binds.vim Normal file
View file

@ -0,0 +1,20 @@
" Keybinds
let mapleader=","
:nmap <c-s> :w<CR>
:imap <c-s> <Esc>:w<CR>a
:nmap <c-v> :Vex<CR>
:noremap <Home> 0w
:inoremap <Home> <ESC>0wi
" -- NERDTree
nnoremap <C-n> :NERDTreeFocus<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" -- Insert date
:noremap <C-D> a<C-R>=strftime('%F')<CR><ESC>
:xmap <C-D> di<Space><C-R>=strftime('%F')<CR><Esc>

17
nvim/coc.vim Normal file
View file

@ -0,0 +1,17 @@
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction

76
nvim/colors/kodex.vim Normal file
View file

@ -0,0 +1,76 @@
:highlight clear
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
let colors_name='kodex'
" Color table
:hi! Black ctermfg=0
:hi! Red ctermfg=1
:hi! Green ctermfg=2
:hi! Yellow ctermfg=3
:hi! Blue ctermfg=4
:hi! Purple ctermfg=5
:hi! Cyan ctermfg=6
:hi! White ctermfg=7
:hi Normal ctermfg=White
:hi Comment ctermfg=red
:hi Special ctermfg=white
:hi String ctermfg=blue
:hi Function ctermfg=yellow
:hi Structure ctermfg=yellow
:hi Statement ctermfg=yellow
:hi Identifier ctermfg=green cterm=none
:hi Operator ctermfg=yellow
:hi Constant ctermfg=darkred
:hi Define ctermfg=yellow
:hi Type ctermfg=yellow
:hi PreProc ctermfg=yellow
:hi Error cterm=underline ctermfg=red ctermbg=none
:hi MatchParen ctermfg=cyan ctermbg=none
:hi Directory ctermfg=blue cterm=bold
" php
:hi link phpVarSelector Identifier
" StatusLine
:hi StatusLine ctermbg=red
" Cursor
:hi CursorLine cterm=NONE ctermfg=NONE ctermbg=NONE
" Line numbers
:hi LineNr guifg=grey50 ctermfg=grey
function! ResetCursorLineNrColor()
hi CursorLineNR guifg=grey50 ctermfg=grey cterm=bold
endfunction
if exists("g:kodex#color_cursor_line_insert")
function! CursorLineNrColorInsert()
let mode = v:insertmode
" Insert mode: blue
if mode == "i"
hi CursorLineNr ctermfg=yellow
" Replace mode: red
elseif mode == "r"
hi CursorLineNr ctermfg=red
else
hi CursorLineNr ctermfg=green
endif
endfunction
autocmd InsertEnter * call CursorLineNrColorInsert()
autocmd InsertLeave * call ResetCursorLineNrColor()
endif
:call ResetCursorLineNrColor()

6
nvim/git.vim Normal file
View file

@ -0,0 +1,6 @@
function! GitStatus()
let l:branchname = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
return strlen(l:branchname) > 0?'branch:'.l:branchname.' ':''
endfunction

44
nvim/init.vim Normal file
View file

@ -0,0 +1,44 @@
:language en_US
:set encoding=UTF-8
:runtime plugins.vim
:runtime tab.vim
:runtime git.vim
:runtime binds.vim
:runtime terminal.vim
:runtime coc.vim
:runtime nerdtree.vim
:syntax on
:set number
:set numberwidth=4
:set cursorline
:set showmode
:set guicursor=a:ver100,c-ci-cr:hor80-blinkon100-blinkwait300
" -- Color scheme
let g:kodex#color_cursor_line_insert=1
:colorscheme kodex
let g:lightline={
\ "colorscheme": "one"
\ }
" STATUS LINE ------------------------------------------------------------ {{{
" Clear status line when vimrc is reloaded.
set statusline=
" Status line left side.
"set statusline+=\ %{GitStatus()}\ %y\ %f:%l
" Use a divider to separate the left side from the right side.
"set statusline+=%=
" Status line right side.
"set statusline+=L\ %l:%c\ \%m\
" Show the status on the second to last line.
set laststatus=2
" }}}

2
nvim/nerdtree.vim Normal file
View file

@ -0,0 +1,2 @@
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif

7
nvim/plugins.vim Normal file
View file

@ -0,0 +1,7 @@
call plug#begin()
Plug 'itchyny/lightline.vim'
Plug 'ryanoasis/vim-devicons'
Plug 'preservim/nerdtree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

12
nvim/tab.vim Normal file
View file

@ -0,0 +1,12 @@
" --- Tab Settings
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent
" Set hardtabs for make
:autocmd FileType make setlocal ts=4 sts=0 sw=4 noexpandtab
" Set 2 softtab for yaml files
:autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Set hardtabs for cpp
:autocmd FileType cpp setlocal ts=8 sts=0 sw=8 noexpandtab

5
nvim/terminal.vim Normal file
View file

@ -0,0 +1,5 @@
" Use a blinking upright bar cursor in Insert mode, a blinking block in normal
" if &term == 'xterm-256color' || &term == 'screen-256color'
" let &t_SI = "\<Esc>[5 q"
" let &t_EI = "\<Esc>[5 q"
"endif