Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev2 #95

Closed
wants to merge 5 commits into from
Closed

Dev2 #95

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '20.x'

- name: Cache dependencies
uses: actions/cache@v3
Expand Down
34 changes: 34 additions & 0 deletions _posts/fzf-linux-ctrl-r.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: fzfの履歴検索(Ctrl + r)が動いてないときに確認すること
date: '2024-02-18'
tag:
- linux
- EndeavourOS
- fzf
---

### 対処前の状況
EndeavourOSにfzfをインストールしたが、fzfの履歴検索が機能しない
![対処前イメージ](https://i.gyazo.com/d3febdcaec7dd79a7c5f2d69a0fe3719.png)

### 対処方法
環境によって異なるが私の環境の場合は`/usr/share/fzf`にあった。人によっては`/usr/loxal/share/docs/fzf`などにある場合もあるらしい。
```
$ls /usr/share/fzf/
合計 52
drwxr-xr-x 2 root 4096 2月 15 22:54 .
drwxr-xr-x 177 root 4096 2月 15 22:55 ..
-rw-r--r-- 1 root 14523 2月 4 00:41 completion.bash
-rw-r--r-- 1 root 11766 2月 4 00:41 completion.zsh
-rw-r--r-- 1 root 5524 2月 4 00:41 key-bindings.bash
-rw-r--r-- 1 root 4115 2月 4 00:41 key-bindings.zsh
```


私はzshを使っているので.zshrcなどに以下を追記した
```bash
source /usr/share/fzf/key-bindings.zsh
```

### 参考文献
- [fzf bash history CTRL+R not working · Issue #1190 · junegunn/fzf](https://github.com/junegunn/fzf/issues/1190)
2,329 changes: 1,301 additions & 1,028 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.4",
"markdown-it-prism": "^2.3.0",
"next": "^12.3.0",
"next": "^14.1.3",
"prism-themes": "^1.9.0",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-instantsearch-hooks-server": "^6.45.0",
"react-instantsearch-hooks-web": "^6.45.0",
"sharp": "^0.31.0",
"sharp": "^0.33.2",
"typescript": "^4.8.3"
},
"devDependencies": {
Expand Down Expand Up @@ -78,6 +78,6 @@
"*.**": "prettier --check --ignore-unknown"
},
"volta": {
"node": "18.9.0"
"node": "18.19.1"
}
}
6 changes: 3 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Header() {
<header className="mb-4 p-4 md:px-8 grid grid-cols-1 md:grid-cols-2 max-w-screen-lg mx-auto">
{/* Left Menu */}
<h1 className="">
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
{/* aタグになんでalt="HOME"をつけてたんだっけ? */}
<a className="header-text md:text-5xl text-3xl font-serif decoration-dotted hover:opacity-50 hover:underline active:opacity-30">
ikmnjrd.github.io
Expand All @@ -25,12 +25,12 @@ export default function Header() {
>
<Search />
</Modal>
<Link href="/about" passHref>
<Link href="/about" passHref legacyBehavior>
<a className="header-text mr-4 md:text-3xl text-2xl font-serif decoration-dotted hover:opacity-50 hover:underline active:opacity-30">
About
</a>
</Link>
<Link href="/tags" passHref>
<Link href="/tags" passHref legacyBehavior>
{/* aタグになんでalt="tag一覧"をつけてたんだっけ? */}
<a className="header-text md:text-3xl text-2xl font-serif decoration-dotted hover:opacity-50 hover:underline active:opacity-30">
Tags
Expand Down
2 changes: 1 addition & 1 deletion src/components/Hit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type HitProps = {

export function Hit({ hit }: HitProps) {
return (
<Link href={`/blog/${hit.slug}`} passHref>
<Link href={`/blog/${hit.slug}`} passHref legacyBehavior>
{/* FIXME: devモードでもモーダルが閉じるようにする */}
<a className="hover:cursor-pointer" data-custom-close>
<h1>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Post({
width="16px"
height="16px"
/>
<Link href={`/blog/${slug}`}>
<Link href={`/blog/${slug}`} legacyBehavior>
<a className="hover:underline hover:text-newmo-400 visited:text-newmo-300">
{frontmatter?.title}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tag/[tag].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function TagLinkPage({ tag, posts }: Props) {
<div>
{posts.map((post) => (
<li key={post.slug}>
<Link href={`/blog/${post.slug}`}>
<Link href={`/blog/${post.slug}`} legacyBehavior>
<a className="hover:underline hover:text-newmo-400 visited:text-newmo-300">
{post.frontmatter.title}
</a>
Expand Down
22 changes: 22 additions & 0 deletions src/scripts/algolia.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
import getPostFilesData from '~/utils/getPostFilesData'
import { index } from '~/utils/algoriaClient'

function bytes2(str: string) {
return encodeURIComponent(str).replace(/%../g, 'x').length
}

export const sendAlgoliaIndex = async (): Promise<void> => {
const blogData = await getPostFilesData()
const blogSubset = blogData.map((blog) => {
const { slug, frontmatter, content } = blog
// 無料プランでは1つあたり10KBまでしかたいおうしてくれない
// https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/in-depth/index-and-records-size-and-usage-limitations/#record-size-limits
const contentByte = bytes2(content)
const slugByte = bytes2(slug)
const fmByte = bytes2(JSON.stringify(frontmatter))

const MAX_BYTE = 10000
const sum = contentByte + slugByte + fmByte

if (sum > MAX_BYTE) {
const hoge = content.slice(0, sum - MAX_BYTE)
return {
slug,
content: hoge,
...frontmatter,
}
}

return {
slug,
content,
Expand Down
Loading