vim + ssh

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-10-13 01:08:56 +02:00
parent 8224a4bdea
commit a12c502c85
5 changed files with 156 additions and 16 deletions

132
files/vimrc Normal file
View file

@ -0,0 +1,132 @@
"set ttyfast
set lazyredraw
set modeline
syntax on
color desert
hi clear SpellBad
hi SpellBad cterm=underline,bold ctermfg=lightblue
set backspace=indent,eol,start
"set ruler
set number
set ts=8 "Un tab, huit espaces
set noexpandtab "On veut pas remplacer tab -> espace
set wrap "Une grande ligne continue à la ligne
"set mouse=a
set hlsearch "On souligne les mots cherchés
set incsearch "recherche peu à peu
set ignorecase
set foldmethod=marker
set cul "souligner la ligne actuelle
set cursorline
hi CursorLine term=bold cterm=bold
"ctermbg=lightblack
set showcmd "on affiche la commande qu'on écrit
set laststatus=2
set statusline=
set statusline +=%5*%{&ff}%* "file format
set statusline +=%3*%y%* "file type
set statusline +=%4*\ %<%F%* "full path
set statusline +=%2*%m%* "modified flag
set statusline +=%1*%=%5l%* "current line
set statusline +=%2*/%L%* "total lines
set statusline +=%1*%4v\ %* "virtual column number
set statusline +=%2*0x%04B\ %* "character under cursor
hi User1 guifg=#eea040 guibg=#222222
hi User2 guifg=#dd3333 guibg=#222222
hi User3 guifg=#ff66ff guibg=#222222
hi User4 guifg=#a0ee40 guibg=#222222
hi User5 guifg=#eeee40 guibg=#222222
filetype plugin on
filetype indent on
noremap <S-Space> <Esc>
noremap j gj
noremap k gk
cmap Q q
command W w
map <Tab> <C-w>w
map <S-Tab> <C-w>W
nnoremap n nzz
set list
set listchars=tab:\|\-"Cool for ifs/whiles
set listchars+=trail"For eol with spaces
set listchars+=nbsp:⍽ "For unbreakeable spaces
highlight NonText ctermfg=8 guifg=lightblue "EOL
highlight SpecialKey ctermfg=lightblue
set history=500
set undolevels=500
set title "titre du terminal
set autoindent
set smartindent
set copyindent
set preserveindent
set autoread "lit les modifs externes
" lines longer than 80 chars {{{
set cc=80
hi ColorColumn ctermbg=lightblue guibg=lightgrey
" }}}
autocmd BufRead,BufNewFile *.markdown set tw=80 fo+=aw
autocmd BufRead,BufNewFile *.tex set filetype=tex tw=80 fo+=aw
autocmd BufRead,BufNewFile *.latex set tw=80 fo+=aw ts=4 sw=4
autocmd BufRead,BufNewFile *.lista set filetype=lisp
autocmd BufRead,BufNewFile *.xml set ts=4 sw=4
autocmd BufRead,BufNewFile *.html set ts=4 sw=4
autocmd BufRead,BufNewFile *.md set filetype=markdown tw=80 fo+=aw
autocmd BufRead,BufNewFile *.ts set filetype=typescript
autocmd BufRead,BufNewFile *.lib set syntax=no filetype=
"Automatic documentation
autocmd BufNewFile,BufRead *.yml set autoindent ts=2 sw=2 expandtab
autocmd BufNewFile,BufRead *.sh set autoindent ts=2 sw=2 noexpandtab
autocmd BufNewFile,BufRead *.yaml set autoindent ts=2 sw=2 expandtab
autocmd BufNewFile,BufRead *.py set keywordprg=pydoc ts=4 sw=4 expandtab
autocmd BufNewFile,BufRead *.php set autoindent ts=4 sw=4
"Yeah, well, fuck you !
autocmd BufNewFile,BufRead *.rs set noexpandtab
if bufwinnr(1)
map + <C-W>>
map - <C-W><
endif
"vimdiff
set diffopt+=iwhite

15
tasks/auth.yml Normal file
View file

@ -0,0 +1,15 @@
- name: Set up authorized_keys file for root
file:
path: /root/.ssh
state: directory
mode: '0700'
owner: root
group: root
- name: Ensure authorized_keys keys
copy:
dest: /root/.ssh/authorized_keys
content: "{{ vars.ssh_keys | join('\n') }}"
owner: root
group: root
mode: '0600'

View file

@ -1,4 +1,5 @@
- import_tasks: bash.yml - import_tasks: bash.yml
- import_tasks: auth.yml
- import_tasks: journald.yml - import_tasks: journald.yml
- import_tasks: ntp.yml - import_tasks: ntp.yml
- import_tasks: ssh.yml - import_tasks: ssh.yml
@ -8,3 +9,4 @@
- import_tasks: setup_backup.yml - import_tasks: setup_backup.yml
- import_tasks: pkgs.yml - import_tasks: pkgs.yml
- import_tasks: git.yml - import_tasks: git.yml
- import_tasks: vim.yml

View file

@ -6,22 +6,6 @@
state: present state: present
notify: restart sshd notify: restart sshd
- name: Set up authorized_keys file for root
file:
path: /root/.ssh
state: directory
mode: '0700'
owner: root
group: root
- name: Ensure authorized_keys keys
copy:
dest: /root/.ssh/authorized_keys
content: "{{ vars.ssh_keys | join('\n') }}"
owner: root
group: root
mode: '0600'
- name: Ensure ssh service is started and enabled - name: Ensure ssh service is started and enabled
systemd: systemd:
name: ssh name: ssh

7
tasks/vim.yml Normal file
View file

@ -0,0 +1,7 @@
- name: Copy simple vimrc
copy:
src: files/vimrc
dest: /etc/vim/vimrc
owner: root
group: root
mode: 0644