diff options
-rw-r--r-- | hosts/morpheus/home.nix | 4 | ||||
-rw-r--r-- | modules/init.vim | 169 | ||||
-rw-r--r-- | modules/neovim.nix | 34 |
3 files changed, 206 insertions, 1 deletions
diff --git a/hosts/morpheus/home.nix b/hosts/morpheus/home.nix index e1647cc..2eb9c55 100644 --- a/hosts/morpheus/home.nix +++ b/hosts/morpheus/home.nix | |||
@@ -17,8 +17,8 @@ | |||
17 | pass | 17 | pass |
18 | tmux | 18 | tmux |
19 | fzf | 19 | fzf |
20 | jq | ||
20 | docker | 21 | docker |
21 | neovim | ||
22 | nmap | 22 | nmap |
23 | lf | 23 | lf |
24 | pinentry_mac | 24 | pinentry_mac |
@@ -32,6 +32,7 @@ | |||
32 | k9s | 32 | k9s |
33 | kubernetes-helm | 33 | kubernetes-helm |
34 | python38 | 34 | python38 |
35 | awscli | ||
35 | # gui | 36 | # gui |
36 | zoom-us | 37 | zoom-us |
37 | slack | 38 | slack |
@@ -47,5 +48,6 @@ | |||
47 | 48 | ||
48 | imports = [ | 49 | imports = [ |
49 | ../../modules/common.nix | 50 | ../../modules/common.nix |
51 | ../../modules/neovim.nix | ||
50 | ]; | 52 | ]; |
51 | } | 53 | } |
diff --git a/modules/init.vim b/modules/init.vim new file mode 100644 index 0000000..99b1938 --- /dev/null +++ b/modules/init.vim | |||
@@ -0,0 +1,169 @@ | |||
1 | let &t_ZM = "\e[3m" | ||
2 | |||
3 | " augroups | ||
4 | |||
5 | augroup plaintext | ||
6 | autocmd! | ||
7 | autocmd FileType text,markdown setlocal ts=2 sts=2 sw=2 expandtab textwidth=60 | ||
8 | augroup END | ||
9 | |||
10 | augroup webdev | ||
11 | autocmd! | ||
12 | autocmd FileType less,css,html,js?,ts? setlocal ts=2 sts=2 sw=2 expandtab | ||
13 | autocmd FileType less,css,html nnoremap <Leader>s viB:sort<cr> | ||
14 | augroup END | ||
15 | |||
16 | augroup lisp_stuff | ||
17 | autocmd! | ||
18 | autocmd BufReadPost *.lisp set filetype=scheme | ||
19 | augroup END | ||
20 | |||
21 | augroup yankhl | ||
22 | autocmd! | ||
23 | autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank() | ||
24 | augroup END | ||
25 | |||
26 | augroup restorecursor | ||
27 | autocmd BufReadPost * | ||
28 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
29 | \ execute "normal! g`\"" | | ||
30 | \ endif | ||
31 | augroup END | ||
32 | |||
33 | augroup fzfstatus | ||
34 | if has('nvim') && !exists('g:fzf_layout') | ||
35 | autocmd! FileType fzf | ||
36 | autocmd FileType fzf set laststatus=0 noshowmode noruler | ||
37 | \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler | ||
38 | endif | ||
39 | augroup END | ||
40 | |||
41 | " general settings | ||
42 | set nobackup | ||
43 | set nowritebackup | ||
44 | set noswapfile " get rid of swapfiles everywhere | ||
45 | set dir=/tmp | ||
46 | |||
47 | syntax on | ||
48 | |||
49 | set omnifunc=syntaxcomplete#Complete | ||
50 | set completefunc=LanguageClient#complete | ||
51 | set list | ||
52 | filetype off | ||
53 | filetype plugin indent on | ||
54 | set laststatus=2 | ||
55 | set nowrap | ||
56 | set noshowmode | ||
57 | set listchars=tab:┊\ ,nbsp:␣,trail:·,extends:>,precedes:< | ||
58 | set fillchars=vert:\│,stl:\ ,stlnc:\ | ||
59 | set ignorecase | ||
60 | set smartcase | ||
61 | set sidescroll=40 | ||
62 | set incsearch | ||
63 | set hlsearch | ||
64 | set undofile | ||
65 | set undodir=~/tmp | ||
66 | set path+=** | ||
67 | set backspace=indent,eol,start | ||
68 | set hidden | ||
69 | set wildmenu | ||
70 | set complete=.,w,b,i,u,t, | ||
71 | set background=dark | ||
72 | set mouse=a | ||
73 | set conceallevel=0 | ||
74 | set nonumber | ||
75 | set grepprg=rg\ --vimgrep\ --no-heading | ||
76 | set grepformat=%f:%l:%c:%m,%f:%l:%m | ||
77 | set cmdheight=2 | ||
78 | set shortmess+=c | ||
79 | set updatetime=300 | ||
80 | set signcolumn=yes | ||
81 | set inccommand=split | ||
82 | set showmatch | ||
83 | set diffopt+=vertical | ||
84 | set completeopt=menu,menuone,noselect | ||
85 | set exrc | ||
86 | |||
87 | let g:netrw_browsex_viewer= "xdg-open" | ||
88 | |||
89 | colorscheme plain | ||
90 | |||
91 | set shiftwidth=4 " indent = 4 spaces | ||
92 | set expandtab | ||
93 | set tabstop=4 " tab = 4 spaces | ||
94 | set softtabstop=4 " backspace through spaces | ||
95 | |||
96 | " Functions | ||
97 | function! GetTabber() " a lil function that integrates well with Tabular.vim | ||
98 | let c = nr2char(getchar()) | ||
99 | :execute 'Tabularize /' . c | ||
100 | endfunction | ||
101 | |||
102 | " Ugh | ||
103 | command! WQ wq | ||
104 | command! Wq wq | ||
105 | command! Wqa wqa | ||
106 | command! WQa wqa | ||
107 | command! W w | ||
108 | command! Q q | ||
109 | |||
110 | " abbreviations | ||
111 | abclear | ||
112 | iab #i #include | ||
113 | iab #d #define | ||
114 | cab dst put =strftime('%d %a, %b %Y')<cr> | ||
115 | cab vg vimgrep | ||
116 | cab vga vimgrepadd | ||
117 | cab bfd bufdo | ||
118 | |||
119 | " man pages | ||
120 | let g:ft_man_open_mode = 'tab' | ||
121 | |||
122 | let g:gitgutter_override_sign_column_highlight = 0 | ||
123 | let g:gitgutter_sign_added = '+' | ||
124 | let g:gitgutter_sign_modified = '~' | ||
125 | let g:gitgutter_sign_removed = '-' | ||
126 | let g:gitgutter_sign_removed_first_line = '-' | ||
127 | let g:gitgutter_sign_modified_removed = '~' | ||
128 | |||
129 | let g:fzf_colors = | ||
130 | \ { 'fg': ['fg', 'Noise'], | ||
131 | \ 'bg': ['bg', 'Noise'], | ||
132 | \ 'hl': ['fg', 'Statement'], | ||
133 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | ||
134 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | ||
135 | \ 'hl+': ['fg', 'Statement'], | ||
136 | \ 'info': ['fg', 'PreProc'], | ||
137 | \ 'border': ['fg', 'Ignore'], | ||
138 | \ 'prompt': ['fg', 'Conditional'], | ||
139 | \ 'pointer': ['fg', 'Exception'], | ||
140 | \ 'marker': ['fg', 'Keyword'], | ||
141 | \ 'spinner': ['fg', 'Label'], | ||
142 | \ 'header': ['fg', 'Comment'] } | ||
143 | let g:fzf_layout = { 'down': '40%' } | ||
144 | let g:fzf_preview_window = [] | ||
145 | |||
146 | highlight GitGutterAdd ctermfg=8 | ||
147 | highlight GitGutterChange ctermfg=8 | ||
148 | highlight GitGutterDelete ctermfg=8 | ||
149 | |||
150 | let g:rustfmt_autosave = 1 | ||
151 | |||
152 | let g:latex_view_general_viewer = "zathura" | ||
153 | let g:vimtex_view_method = "zathura" | ||
154 | let g:tex_flavor = 'latex' | ||
155 | |||
156 | let g:elm_setup_keybindings = 0 | ||
157 | |||
158 | sign define LspDiagnosticsSignError text=× texthl=LspDiagnosticsSignError linehl= numhl= | ||
159 | sign define LspDiagnosticsSignWarning text=\! texthl=LspDiagnosticsSignWarning linehl= numhl= | ||
160 | sign define LspDiagnosticsSignInformation text=i texthl=LspDiagnosticsSignInformation linehl= numhl= | ||
161 | sign define LspDiagnosticsSignHint text=\~ texthl=LspDiagnosticsSignHint linehl= numhl= | ||
162 | |||
163 | let g:user_emmet_leader_key='<C-X>' | ||
164 | |||
165 | lua << EOF | ||
166 | require 'lspconfig' | ||
167 | require 'treesitter' | ||
168 | require 'completions' | ||
169 | EOF | ||
diff --git a/modules/neovim.nix b/modules/neovim.nix new file mode 100644 index 0000000..1897223 --- /dev/null +++ b/modules/neovim.nix | |||
@@ -0,0 +1,34 @@ | |||
1 | { config, pkgs, ... }: | ||
2 | |||
3 | { | ||
4 | programs.neovim = { | ||
5 | enable = true; | ||
6 | defaultEditor = true; | ||
7 | viAlias = true; | ||
8 | vimAlias = true; | ||
9 | vimdiffAlias = true; | ||
10 | extraConfig = builtins.readFile ./init.vim; | ||
11 | plugins = with pkgs.vimPlugins; [ | ||
12 | # lsp | ||
13 | nvim-lspconfig | ||
14 | nvim-cmp | ||
15 | (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) | ||
16 | # autocompletion | ||
17 | cmp-nvim-lsp | ||
18 | cmp-buffer | ||
19 | cmp-path | ||
20 | cmp-cmdline | ||
21 | # tpope | ||
22 | vim-surround | ||
23 | vim-fugitive | ||
24 | # syntax | ||
25 | vim-nix | ||
26 | vimtex | ||
27 | # others | ||
28 | vim-gitgutter | ||
29 | tabular | ||
30 | vimwiki | ||
31 | fzf-vim | ||
32 | ]; | ||
33 | }; | ||
34 | } | ||